diff --git a/src/bin/Jamfile b/src/bin/Jamfile index d3a43b93a8..65bd3d5c06 100644 --- a/src/bin/Jamfile +++ b/src/bin/Jamfile @@ -159,7 +159,6 @@ SubInclude HAIKU_TOP src bin addattr ; SubInclude HAIKU_TOP src bin bash ; SubInclude HAIKU_TOP src bin bc ; SubInclude HAIKU_TOP src bin bemail_utils ; -SubInclude HAIKU_TOP src bin bison ; SubInclude HAIKU_TOP src bin chkbfs ; SubInclude HAIKU_TOP src bin compress ; SubInclude HAIKU_TOP src bin coreutils ; @@ -167,7 +166,6 @@ SubInclude HAIKU_TOP src bin ctags ; SubInclude HAIKU_TOP src bin desklink ; SubInclude HAIKU_TOP src bin diffutils ; SubInclude HAIKU_TOP src bin findutils ; -SubInclude HAIKU_TOP src bin flex ; SubInclude HAIKU_TOP src bin fwcontrol ; SubInclude HAIKU_TOP src bin gawk ; SubInclude HAIKU_TOP src bin gdb ; diff --git a/src/bin/bison/ABOUT-NLS b/src/bin/bison/ABOUT-NLS deleted file mode 100644 index 47d5e39f0e..0000000000 --- a/src/bin/bison/ABOUT-NLS +++ /dev/null @@ -1,625 +0,0 @@ -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 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 at translations should 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. - -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'. - -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 GNU `gettext' own -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 be not what is 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 have usually 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. - -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 country 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'. - - 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. - -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. - -Available Packages -================== - - Languages are not equally supported in all packages. The following -matrix shows the current state of internationalization, as of May 2003. -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 am az be bg ca cs da de el en en_GB eo es - +-------------------------------------------+ - a2ps | [] [] [] [] | - aegis | () | - anubis | | - ap-utils | | - bash | [] [] [] | - batchelor | | - bfd | [] [] | - binutils | [] [] | - bison | [] [] [] | - bluez-pin | [] [] | - clisp | | - clisp | [] [] [] | - coreutils | [] [] [] [] | - cpio | [] [] [] | - darkstat | () [] | - diffutils | [] [] [] [] [] [] [] | - e2fsprogs | [] [] | - enscript | [] [] [] [] | - error | [] [] [] [] [] | - fetchmail | [] () [] [] [] [] | - fileutils | [] [] [] | - findutils | [] [] [] [] [] [] | - flex | [] [] [] [] | - gas | [] | - gawk | [] [] [] [] | - gcal | [] | - gcc | [] [] | - gettext | [] [] [] [] [] | - gettext-runtime | [] [] [] [] [] | - gettext-tools | [] [] | - gimp-print | [] [] [] [] [] | - gliv | | - glunarclock | [] [] [] | - gnucash | () [] | - gnucash-glossary | [] () [] | - gnupg | [] () [] [] [] [] | - gpe-calendar | [] | - gpe-conf | [] | - gpe-contacts | [] | - gpe-edit | | - gpe-login | [] | - gpe-ownerinfo | [] | - gpe-sketchbook | [] | - gpe-timesheet | | - gpe-today | [] | - gpe-todo | [] | - gphoto2 | [] [] [] [] | - gprof | [] [] | - gpsdrive | () () () | - grep | [] [] [] [] [] | - gretl | [] | - hello | [] [] [] [] [] [] | - id-utils | [] [] | - indent | [] [] [] [] | - jpilot | [] [] [] [] | - jwhois | [] | - kbd | [] [] [] [] [] | - ld | [] [] | - libc | [] [] [] [] [] [] | - libgpewidget | [] | - libiconv | [] [] [] [] [] | - lifelines | [] () | - lilypond | [] | - lingoteach | | - lingoteach_lessons | () () | - lynx | [] [] [] [] | - m4 | [] [] [] [] | - mailutils | [] [] | - make | [] [] [] | - man-db | [] () [] [] () | - mysecretdiary | [] [] [] | - nano | [] () [] [] [] | - nano_1_0 | [] () [] [] [] | - opcodes | [] [] | - parted | [] [] [] [] [] | - ptx | [] [] [] [] [] | - python | | - radius | | - recode | [] [] [] [] [] [] | - screem | | - sed | [] [] [] [] [] | - sh-utils | [] [] [] | - sharutils | [] [] [] [] [] [] | - sketch | [] () [] | - soundtracker | [] [] [] | - sp | [] | - tar | [] [] [] [] | - texinfo | [] [] [] [] | - textutils | [] [] [] [] | - tin | () () | - util-linux | [] [] [] [] [] | - vorbis-tools | [] [] [] | - wastesedge | () | - wdiff | [] [] [] [] | - wget | [] [] [] [] [] [] [] | - xchat | [] [] [] | - xpad | | - +-------------------------------------------+ - am az be bg ca cs da de el en en_GB eo es - 0 1 4 2 31 17 54 60 14 1 4 12 56 - - et fa fi fr ga gl he hr hu id it ja ko - +----------------------------------------+ - a2ps | [] [] [] () () | - aegis | | - anubis | [] | - ap-utils | [] | - bash | [] [] | - batchelor | [] | - bfd | [] [] | - binutils | [] [] | - bison | [] [] [] [] | - bluez-pin | [] [] [] [] | - clisp | | - clisp | [] | - coreutils | [] [] [] [] | - cpio | [] [] [] [] | - darkstat | () [] [] [] | - diffutils | [] [] [] [] [] [] [] | - e2fsprogs | | - enscript | [] [] | - error | [] [] [] [] | - fetchmail | [] | - fileutils | [] [] [] [] [] | - findutils | [] [] [] [] [] [] [] [] [] [] [] | - flex | [] [] | - gas | [] | - gawk | [] [] | - gcal | [] | - gcc | [] | - gettext | [] [] [] | - gettext-runtime | [] [] [] [] | - gettext-tools | [] | - gimp-print | [] [] | - gliv | () | - glunarclock | [] [] [] [] | - gnucash | [] | - gnucash-glossary | [] | - gnupg | [] [] [] [] [] [] [] | - gpe-calendar | [] | - gpe-conf | | - gpe-contacts | [] | - gpe-edit | [] [] | - gpe-login | [] | - gpe-ownerinfo | [] [] [] | - gpe-sketchbook | [] | - gpe-timesheet | [] [] [] | - gpe-today | [] [] | - gpe-todo | [] [] | - gphoto2 | [] [] [] | - gprof | [] [] | - gpsdrive | () [] () () | - grep | [] [] [] [] [] [] [] [] [] [] [] | - gretl | [] | - hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | - id-utils | [] [] [] | - indent | [] [] [] [] [] [] [] [] | - jpilot | [] () | - jwhois | [] [] [] [] | - kbd | [] | - ld | [] | - libc | [] [] [] [] [] [] | - libgpewidget | [] [] [] | - libiconv | [] [] [] [] [] [] [] [] | - lifelines | () | - lilypond | [] | - lingoteach | [] [] | - lingoteach_lessons | | - lynx | [] [] [] [] | - m4 | [] [] [] [] | - mailutils | | - make | [] [] [] [] [] [] | - man-db | [] () () | - mysecretdiary | [] [] | - nano | [] [] [] [] | - nano_1_0 | [] [] [] [] | - opcodes | [] [] | - parted | [] [] [] | - ptx | [] [] [] [] [] [] [] | - python | | - radius | | - recode | [] [] [] [] [] [] | - screem | | - sed | [] [] [] [] [] [] [] [] | - sh-utils | [] [] [] [] [] [] | - sharutils | [] [] [] [] [] | - sketch | [] | - soundtracker | [] [] [] | - sp | [] () | - tar | [] [] [] [] [] [] [] [] [] | - texinfo | [] [] [] [] | - textutils | [] [] [] [] [] | - tin | [] () | - util-linux | [] [] [] [] () [] | - vorbis-tools | [] | - wastesedge | () | - wdiff | [] [] [] [] [] | - wget | [] [] [] [] [] [] [] [] | - xchat | [] [] [] | - xpad | | - +----------------------------------------+ - et fa fi fr ga gl he hr hu id it ja ko - 20 1 15 73 14 24 8 10 30 31 19 31 9 - - lg lt lv ms nb nl nn no pl pt pt_BR ro - +----------------------------------------+ - a2ps | [] [] () () () [] [] | - aegis | () | - anubis | [] [] | - ap-utils | () | - bash | [] | - batchelor | | - bfd | | - binutils | | - bison | [] [] [] [] | - bluez-pin | [] | - clisp | | - clisp | [] | - coreutils | [] | - cpio | [] [] [] | - darkstat | [] [] [] [] | - diffutils | [] [] [] | - e2fsprogs | | - enscript | [] [] | - error | [] [] | - fetchmail | () () | - fileutils | [] | - findutils | [] [] [] [] | - flex | [] | - gas | | - gawk | [] | - gcal | | - gcc | | - gettext | [] | - gettext-runtime | [] | - gettext-tools | | - gimp-print | [] | - gliv | [] | - glunarclock | [] | - gnucash | | - gnucash-glossary | [] [] | - gnupg | | - gpe-calendar | [] [] | - gpe-conf | [] [] | - gpe-contacts | [] | - gpe-edit | [] [] | - gpe-login | [] [] | - gpe-ownerinfo | [] [] | - gpe-sketchbook | [] [] | - gpe-timesheet | [] [] | - gpe-today | [] [] | - gpe-todo | [] [] | - gphoto2 | | - gprof | [] | - gpsdrive | () () () | - grep | [] [] [] [] | - gretl | | - hello | [] [] [] [] [] [] [] [] [] | - id-utils | [] [] [] | - indent | [] [] [] | - jpilot | () () | - jwhois | [] [] [] | - kbd | | - ld | | - libc | [] [] [] [] | - libgpewidget | [] [] | - libiconv | [] [] | - lifelines | | - lilypond | [] | - lingoteach | | - lingoteach_lessons | | - lynx | [] [] | - m4 | [] [] [] [] | - mailutils | | - make | [] [] | - man-db | [] | - mysecretdiary | [] | - nano | [] [] [] [] | - nano_1_0 | [] [] [] [] | - opcodes | [] [] [] | - parted | [] [] [] | - ptx | [] [] [] [] [] [] [] | - python | | - radius | | - recode | [] [] [] | - screem | | - sed | [] [] | - sh-utils | [] | - sharutils | [] | - sketch | [] | - soundtracker | | - sp | | - tar | [] [] [] [] [] [] | - texinfo | [] | - textutils | [] | - tin | | - util-linux | [] [] | - vorbis-tools | [] [] | - wastesedge | | - wdiff | [] [] [] [] | - wget | [] [] [] | - xchat | [] [] | - xpad | [] | - +----------------------------------------+ - lg lt lv ms nb nl nn no pl pt pt_BR ro - 0 0 2 11 7 26 3 4 18 15 34 34 - - ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW - +-------------------------------------------+ - a2ps | [] [] [] [] [] | 16 - aegis | () | 0 - anubis | [] [] | 5 - ap-utils | () | 1 - bash | [] | 7 - batchelor | | 1 - bfd | [] [] [] | 7 - binutils | [] [] [] | 7 - bison | [] [] | 13 - bluez-pin | | 7 - clisp | | 0 - clisp | | 5 - coreutils | [] [] [] [] [] | 14 - cpio | [] [] [] | 13 - darkstat | [] () () | 9 - diffutils | [] [] [] [] | 21 - e2fsprogs | [] | 3 - enscript | [] [] [] | 11 - error | [] [] [] | 14 - fetchmail | [] | 7 - fileutils | [] [] [] [] [] [] | 15 - findutils | [] [] [] [] [] [] | 27 - flex | [] [] [] | 10 - gas | [] | 3 - gawk | [] [] | 9 - gcal | [] [] | 4 - gcc | [] | 4 - gettext | [] [] [] [] [] [] | 15 - gettext-runtime | [] [] [] [] [] [] | 16 - gettext-tools | [] [] | 5 - gimp-print | [] [] | 10 - gliv | | 1 - glunarclock | [] [] [] | 11 - gnucash | [] [] | 4 - gnucash-glossary | [] [] [] | 8 - gnupg | [] [] [] [] | 16 - gpe-calendar | [] | 5 - gpe-conf | | 3 - gpe-contacts | [] | 4 - gpe-edit | [] | 5 - gpe-login | [] | 5 - gpe-ownerinfo | [] | 7 - gpe-sketchbook | [] | 5 - gpe-timesheet | [] | 6 - gpe-today | [] | 6 - gpe-todo | [] | 6 - gphoto2 | [] [] | 9 - gprof | [] [] | 7 - gpsdrive | [] [] | 3 - grep | [] [] [] [] | 24 - gretl | | 2 - hello | [] [] [] [] [] | 33 - id-utils | [] [] [] | 11 - indent | [] [] [] [] | 19 - jpilot | [] [] [] [] [] | 10 - jwhois | () () [] [] | 10 - kbd | [] [] | 8 - ld | [] [] | 5 - libc | [] [] [] [] | 20 - libgpewidget | | 6 - libiconv | [] [] [] [] [] [] | 21 - lifelines | [] | 2 - lilypond | [] | 4 - lingoteach | | 2 - lingoteach_lessons | () | 0 - lynx | [] [] [] [] | 14 - m4 | [] [] [] | 15 - mailutils | | 2 - make | [] [] [] [] | 15 - man-db | [] | 6 - mysecretdiary | [] [] | 8 - nano | [] [] [] | 15 - nano_1_0 | [] [] [] | 15 - opcodes | [] [] | 9 - parted | [] [] | 13 - ptx | [] [] [] | 22 - python | | 0 - radius | | 0 - recode | [] [] [] [] | 19 - screem | [] | 1 - sed | [] [] [] [] [] | 20 - sh-utils | [] [] [] | 13 - sharutils | [] [] [] [] | 16 - sketch | [] | 5 - soundtracker | [] | 7 - sp | [] | 3 - tar | [] [] [] [] [] | 24 - texinfo | [] [] [] [] | 13 - textutils | [] [] [] [] [] | 15 - tin | | 1 - util-linux | [] [] | 14 - vorbis-tools | [] | 7 - wastesedge | | 0 - wdiff | [] [] [] [] | 17 - wget | [] [] [] [] [] [] [] | 25 - xchat | [] [] [] | 11 - xpad | | 1 - +-------------------------------------------+ - 50 teams ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW - 97 domains 32 19 16 0 56 0 48 10 1 1 12 23 913 - - 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 May 2003 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'. - -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/src/bin/bison/AUTHORS b/src/bin/bison/AUTHORS deleted file mode 100644 index 0a3ca6fd51..0000000000 --- a/src/bin/bison/AUTHORS +++ /dev/null @@ -1,8 +0,0 @@ -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/src/bin/bison/COPYING b/src/bin/bison/COPYING deleted file mode 100644 index 3912109b5c..0000000000 --- a/src/bin/bison/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 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. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) 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 -this service 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 make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. 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. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program 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. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -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 -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the 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 a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE 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. - - 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 -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - 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 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 St, Fifth Floor, Boston, MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This 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 Library General -Public License instead of this License. diff --git a/src/bin/bison/ChangeLog b/src/bin/bison/ChangeLog deleted file mode 100644 index c44f0e4c72..0000000000 --- a/src/bin/bison/ChangeLog +++ /dev/null @@ -1,16034 +0,0 @@ -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 `Bison 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. - (Bison 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-10-28 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 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/src/bin/bison/GNUmakefile b/src/bin/bison/GNUmakefile deleted file mode 100644 index 675af82285..0000000000 --- a/src/bin/bison/GNUmakefile +++ /dev/null @@ -1,58 +0,0 @@ -# Having a separate GNUmakefile lets me `include' the dynamically -# generated rules created via Makefile.maint as well as Makefile.maint itself. -# This makefile is used only if you run GNU Make. -# It is necessary if you want to build targets usually of interest -# only to the maintainer. - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 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. - -# Systems where /bin/sh is not the default shell need this. The $(shell) -# command below won't work with e.g. stock DOS/Windows shells. -ifeq ($(wildcard /bin/s[h]),/bin/sh) -SHELL = /bin/sh -else -# will be used only with the next shell-test line, then overwritten -# by a configured-in value -SHELL = sh -endif - -have-Makefile := $(shell test -f Makefile && echo yes) - -# If the user runs GNU make but has not yet run ./configure, -# give them a diagnostic. -ifeq ($(have-Makefile),yes) - -# Make tar archive easier to reproduce. -export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner - -include Makefile -include $(srcdir)/Makefile.cfg -include $(srcdir)/Makefile.maint - -else - -all: - @echo There seems to be no Makefile in this directory. - @echo "You must run ./configure before running \`make'." - @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/src/bin/bison/INSTALL b/src/bin/bison/INSTALL deleted file mode 100644 index 23e5f25d0e..0000000000 --- a/src/bin/bison/INSTALL +++ /dev/null @@ -1,236 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free -Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -These are generic installation instructions. - - 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 only 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. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. 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. - -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=c89 CFLAGS=-O2 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 must use a version of `make' that -supports the `VPATH' variable, such as 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 `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have 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. - -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. - -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). Here is a another example: - - /bin/bash ./configure CONFIG_SHELL=/bin/bash - -Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent -configuration-related scripts to be executed by `/bin/bash'. - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--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. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/src/bin/bison/Jamfile b/src/bin/bison/Jamfile deleted file mode 100644 index d3f5f91ae7..0000000000 --- a/src/bin/bison/Jamfile +++ /dev/null @@ -1,5 +0,0 @@ -SubDir HAIKU_TOP src bin bison ; - -SubInclude HAIKU_TOP src bin bison data ; -SubInclude HAIKU_TOP src bin bison lib ; -SubInclude HAIKU_TOP src bin bison src ; diff --git a/src/bin/bison/Makefile.am b/src/bin/bison/Makefile.am deleted file mode 100644 index f247e24a2e..0000000000 --- a/src/bin/bison/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -## Process this file with automake to produce Makefile.in -*-Makefile-*- -## 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 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 - -ACLOCAL_AMFLAGS = -I m4 - -SUBDIRS = build-aux po runtime-po lib data src doc examples tests - -# Files installed for use by Automake. -aclocaldir = @aclocaldir@ -aclocal_DATA = m4/bison-i18n.m4 - -EXTRA_DIST = GNUmakefile Makefile.cfg Makefile.maint \ - 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 - - -.PHONY: maintainer-check -maintainer-check: - cd tests && $(MAKE) $(AM_MAKEFLAGS) $@ diff --git a/src/bin/bison/Makefile.cfg b/src/bin/bison/Makefile.cfg deleted file mode 100644 index fb15523168..0000000000 --- a/src/bin/bison/Makefile.cfg +++ /dev/null @@ -1,48 +0,0 @@ -# Customize Makefile.maint for Bison. -*- makefile -*- -# Copyright (C) 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 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. - -build_aux_dir = $(srcdir)/build-aux -prev_version_file = $(build_aux_dir)/prev-version.txt -announce_gen = $(build_aux_dir)/announce-gen -release_archive_dir = releases - -# Use alpha.gnu.org for alpha and beta releases. -# Use ftp.gnu.org for major releases. -gnu_ftp_host-alpha = alpha -gnu_ftp_host-beta = alpha -gnu_ftp_host-major = ftp -gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE)) - -url_dir_list = \ - ftp://$(gnu_rel_host).gnu.org/gnu/bison - -# Files to update automatically. -wget_files = \ - $(build_aux_dir)/config.guess \ - $(build_aux_dir)/config.sub \ - $(build_aux_dir)/texinfo.tex \ - -cvs_files = \ - $(build_aux_dir)/install-sh \ - $(build_aux_dir)/mdate-sh \ - $(build_aux_dir)/missing \ - $(build_aux_dir)/mkinstalldirs - -# Tests not to run. -local-checks-to-skip = \ - changelog-check diff --git a/src/bin/bison/Makefile.in b/src/bin/bison/Makefile.in deleted file mode 100644 index 9c62f024be..0000000000 --- a/src/bin/bison/Makefile.in +++ /dev/null @@ -1,704 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 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@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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 $(srcdir)/config.hin \ - $(top_srcdir)/configure ABOUT-NLS AUTHORS COPYING ChangeLog \ - INSTALL NEWS THANKS TODO -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/bison-i18n.m4 \ - $(top_srcdir)/m4/c-working.m4 $(top_srcdir)/m4/cxx.m4 \ - $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ - $(top_srcdir)/m4/dos.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_gl.m4 \ - $(top_srcdir)/m4/gnulib.m4 $(top_srcdir)/m4/hard-locale.m4 \ - $(top_srcdir)/m4/hash.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/inttypes_h_gl.m4 \ - $(top_srcdir)/m4/lib-ld_gl.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix_gl.m4 $(top_srcdir)/m4/m4.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/obstack.m4 $(top_srcdir)/m4/onceonly.m4 \ - $(top_srcdir)/m4/po_gl.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \ - $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \ - $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.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/uintmax_t_gl.m4 \ - $(top_srcdir)/m4/ulonglong_gl.m4 \ - $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.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 configure.status.lineno -mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-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) -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@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOM4TE = @AUTOM4TE@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BISON_CXX_WORKS = @BISON_CXX_WORKS@ -BISON_CXX_WORKS_FALSE = @BISON_CXX_WORKS_FALSE@ -BISON_CXX_WORKS_TRUE = @BISON_CXX_WORKS_TRUE@ -BISON_LOCALEDIR = @BISON_LOCALEDIR@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -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@ -EXEEXT = @EXEEXT@ -GCC = @GCC@ -GETOPT_H = @GETOPT_H@ -GMSGFMT = @GMSGFMT@ -HAVE__BOOL = @HAVE__BOOL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -O0CFLAGS = @O0CFLAGS@ -O0CXXFLAGS = @O0CXXFLAGS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STDBOOL_H = @STDBOOL_H@ -STRIP = @STRIP@ -UNISTD_H = @UNISTD_H@ -USE_NLS = @USE_NLS@ -VALGRIND = @VALGRIND@ -VERSION = @VERSION@ -WARNING_CFLAGS = @WARNING_CFLAGS@ -WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ -WERROR_CFLAGS = @WERROR_CFLAGS@ -XGETTEXT = @XGETTEXT@ -YACC = @YACC@ -YACC_LIBRARY = @YACC_LIBRARY@ -YACC_SCRIPT = @YACC_SCRIPT@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ - -# Files installed for use by Automake. -aclocaldir = @aclocaldir@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -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@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = build-aux po runtime-po lib data src doc examples tests -aclocal_DATA = m4/bison-i18n.m4 -EXTRA_DIST = GNUmakefile Makefile.cfg Makefile.maint \ - 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 - -all: config.h - $(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) --gnu '; \ - cd $(srcdir) && $(AUTOMAKE) --gnu \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu 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) - -config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) stamp-h1; \ - else :; fi - -stamp-h1: $(srcdir)/config.hin $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status 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 -uninstall-info-am: -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" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @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; } \ - END { 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; } \ - END { 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=; \ - here=`pwd`; \ - 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; } \ - END { 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) - mkdir $(distdir) - $(mkdir_p) $(distdir)/djgpp $(distdir)/m4 $(distdir)/po $(distdir)/runtime-po $(distdir)/tests - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - 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" \ - distdir) \ - || exit 1; \ - fi; \ - done - -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 $(SHELL) $(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-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.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 '1{h;s/./=/g;p;x;}' -e '$${p;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: check-recursive -all-am: Makefile $(DATA) config.h -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(aclocaldir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -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 $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-hdr distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: install-aclocalDATA - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -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 uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ - check-am clean clean-generic clean-recursive ctags \ - ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ - dist-tarZ dist-zip distcheck distclean distclean-generic \ - distclean-hdr distclean-recursive 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-exec install-exec-am \ - install-info install-info-am install-man install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-aclocalDATA uninstall-am uninstall-info-am - - -.PHONY: maintainer-check -maintainer-check: - cd tests && $(MAKE) $(AM_MAKEFLAGS) $@ -# 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/bin/bison/Makefile.maint b/src/bin/bison/Makefile.maint deleted file mode 100644 index 9bae6be665..0000000000 --- a/src/bin/bison/Makefile.maint +++ /dev/null @@ -1,639 +0,0 @@ -# -*-Makefile-*- -# This Makefile fragment is shared between the coreutils, -# CPPI, Bison, and Autoconf. - -## Copyright (C) 2001-2006 Free Software Foundation, Inc. -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 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. - -# This is reported not to work with make-3.79.1 -# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) -ME := Makefile.maint - -# Do not save the original name or timestamp in the .tar.gz file. -# Use --rsyncable if available. -gzip_rsyncable = \ - (gzip --help|grep rsyncable) >/dev/null 2>&1 && echo --rsyncable -GZIP_ENV = "--no-name --best `$(gzip_rsyncable)`" - -CVS = cvs - -# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/ -CVS_LIST = sh -c ' \ - if test -x $(srcdir)/build-aux/cvsu; then \ - $(srcdir)/build-aux/cvsu --find --types=AFGM $$*; \ - else \ - awk -F/ '\''{ \ - if (!$$1 && $$3 !~ /^-/) { \ - f=FILENAME; \ - sub(/CVS\/Entries/, "", f); \ - print f $$2; \ - }}'\'' \ - $$(find $${*-*} -name Entries -print) /dev/null; \ - fi \ - ' dummy - -CVS_LIST_EXCEPT = \ - $(CVS_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi - -ifeq ($(origin prev_version_file), undefined) - prev_version_file = .prev-version -endif - -PREV_VERSION := $(shell cat $(prev_version_file)) -VERSION_REGEXP = $(subst .,\.,$(VERSION)) - -tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]') -tag-this-version = $(subst .,_,$(VERSION)) -this-cvs-tag = $(tag-package)-$(tag-this-version) -my_distdir = $(PACKAGE)-$(VERSION) - -# Old releases are stored here. -# Used for diffs and xdeltas. -release_archive_dir ?= ../release - -# Prevent programs like 'sort' from considering distinct strings to be equal. -# Doing it here saves us from having to set LC_ALL elsewhere in this file. -export LC_ALL = C - - - -## --------------- ## -## Sanity checks. ## -## --------------- ## - -# FIXME: add a check to prohibit definition in src/*.c of symbols defined -# in system.h. E.g. today I removed from tail.c a useless definition of -# ENOSYS. It was useless because system.h ensures it's defined. - -# Checks that don't require cvs. -# Run `changelog-check' last, as previous test may reveal problems requiring -# new ChangeLog entries. -local-checks-available = \ - po-check copyright-check writable-files m4-check author_mark_check \ - changelog-check strftime-check $(syntax-check-rules) \ - makefile_path_separator_check \ - makefile-check -.PHONY: $(local-checks-available) - -local-check = $(filter-out $(local-checks-to-skip), $(local-checks-available)) - -.PHONY: $(syntax-check-rules) -syntax-check-rules = \ - sc_cast_of_argument_to_free \ - sc_cast_of_x_alloc_return_value \ - sc_cast_of_alloca_return_value \ - sc_changelog \ - sc_dd_max_sym_length \ - sc_error_exit_success \ - sc_file_system \ - sc_no_if_have_config_h \ - sc_obsolete_symbols \ - sc_prohibit_atoi_atof \ - sc_prohibit_jm_in_m4 \ - sc_prohibit_assert_without_use \ - sc_require_config_h \ - sc_root_tests \ - sc_space_tab \ - sc_sun_os_names \ - sc_system_h_headers \ - sc_tight_scope \ - sc_trailing_blank \ - sc_two_space_separator_in_usage \ - sc_unmarked_diagnostics \ - sc_useless_cpp_parens - -syntax-check: $(syntax-check-rules) -# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \ -# $$(find -type f -name '*.[chly]') && \ -# { echo '$(ME): found conditional include' 1>&2; \ -# exit 1; } || : - -# grep -nE '^# *include <(string|stdlib)\.h>' \ -# $(srcdir)/{lib,src}/*.[chy] && \ -# { echo '$(ME): FIXME' 1>&2; \ -# exit 1; } || : -# FIXME: don't allow `#include .strings\.h' anywhere - -sc_cast_of_argument_to_free: - @grep -nE '\&2; \ - exit 1; } || : - -sc_cast_of_x_alloc_return_value: - @grep -nE --exclude=$(srcdir)/lib/regex.c \ - '\*\) *x(m|c|re)alloc\>' \ - $(srcdir)/{lib,src}/*.[chy] && \ - { echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \ - exit 1; } || : - -sc_cast_of_alloca_return_value: - @grep -nE '\*\) *alloca\>' \ - $(srcdir)/src/*.[chy] && \ - { echo '$(ME): don'\''t cast alloca return value' 1>&2; \ - exit 1; } || : - -sc_space_tab: - @grep -n '[ ] ' $$($(CVS_LIST_EXCEPT)) && \ - { echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \ - 1>&2; exit 1; } || : - -# Don't use the old ato* functions in `real' code. -# They provide no error checking mechanism. -# Instead, use strto* functions. -sc_prohibit_atoi_atof: - @grep -nE '\' $$($(CVS_LIST_EXCEPT)) && \ - { echo '$(ME): do not use ato''f, ato''i, ato''l, ato''ll, or ato''q' \ - 1>&2; exit 1; } || : - -# Using EXIT_SUCCESS as the first argument to error is misleading, -# since when that parameter is 0, error does not exit. Use `0' instead. -sc_error_exit_success: - @grep -nF 'error (EXIT_SUCCESS,' \ - $$(find -type f -name '*.[chly]') && \ - { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \ - exit 1; } || : - -sc_file_system: - @grep -ni 'file''system' $$($(CVS_LIST_EXCEPT)) && \ - { echo '$(ME): found use of "file''system";' \ - 'rewrite to use "file system"' 1>&2; \ - exit 1; } || : - -sc_no_if_have_config_h: - @grep -n '^# *if HAVE_CONFIG_H' $$($(CVS_LIST_EXCEPT)) && \ - { echo '$(ME): found use of #if HAVE_CONFIG_H; use #ifdef' \ - 1>&2; exit 1; } || : - -# Nearly all .c files must include . -sc_require_config_h: - @grep -L '^# *include ' \ - $$($(CVS_LIST_EXCEPT) | grep '\.c$$') \ - | grep . && \ - { echo '$(ME): the above files do not include ' \ - 1>&2; exit 1; } || : - -# Prohibit the inclusion of assert.h without an actual use of assert. -sc_prohibit_assert_without_use: - @files=$$(grep -l '# *include ' \ - $$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \ - grep -L '\ but don't use it" \ - 1>&2; exit 1; } || : - -sc_obsolete_symbols: - @grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \ - $$($(CVS_LIST_EXCEPT)) && \ - { echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \ - 1>&2; exit 1; } || : - -# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ - -# Each nonempty line must start with a year number, or a TAB. -sc_changelog: - @grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) && \ - { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \ - exit 1; } || : - -# Ensure that dd's definition of LONGEST_SYMBOL stays in sync -# with the strings from the two affected variables. -dd_c = $(srcdir)/src/dd.c -sc_dd_max_sym_length: -ifneq ($(wildcard $(dd_c)),) - @len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\ - sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \ - |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \ - | wc --max-line-length); \ - max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \ - |tr -d '"' | wc --max-line-length); \ - if test "$$len" = "$$max"; then :; else \ - echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \ - exit 1; \ - fi -endif - -# Many m4 macros names once began with `jm_'. -# On 2004-04-13, they were all changed to start with gl_ instead. -# Make sure that none are inadvertently reintroduced. -sc_prohibit_jm_in_m4: - @grep -nE 'jm_[A-Z]' \ - $$($(CVS_LIST) $(srcdir)/m4 |grep '\.m4$$') && \ - { echo '$(ME): do not use jm_ in m4 macro names' \ - 1>&2; exit 1; } || : - -sc_root_tests: - @t1=sc-root.expected; t2=sc-root.actual; \ - grep -nl '^PRIV_CHECK_ARG=require-root' \ - $$($(CVS_LIST) tests) |sed s,tests,., |sort > $$t1; \ - sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \ - $(srcdir)/tests/Makefile.am |sort > $$t2; \ - diff -u $$t1 $$t2 || diff=1; \ - rm -f $$t1 $$t2; \ - test "$$diff" \ - && { echo 'tests/Makefile.am: missing check-root action'>&2; \ - exit 1; } || : - -# Create a list of regular expressions matching the names -# of files included from system.h. Exclude a couple. -.re-list: - @sed -n '/^# *include /s///p' $(srcdir)/src/system.h \ - | grep -Ev 'sys/(param|file)\.h' \ - | sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \ - > $@-t - @mv $@-t $@ - -# Files in src/ should not include directly any of -# the headers already included via system.h. -sc_system_h_headers: .re-list - @if test -f $(srcdir)/src/system.h; then \ - trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \ - grep -nE -f .re-list \ - $$($(CVS_LIST) src | \ - grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \ - && { echo '$(ME): the above are already included via system.h'\ - 1>&2; exit 1; } || :; \ - fi - -sc_sun_os_names: - @grep -nEi \ - 'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \ - $$($(CVS_LIST_EXCEPT)) && \ - { echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \ - exit 1; } || : - -sc_tight_scope: - $(MAKE) -C src $@ - -sc_trailing_blank: - @grep -n '[ ]$$' $$($(CVS_LIST_EXCEPT)) && \ - { echo '$(ME): found trailing blank(s)' \ - 1>&2; exit 1; } || : - -sc_two_space_separator_in_usage: - @grep -n '^ *--[a-z][0-9A-Za-z-]* [^ ].*\\$$' \ - $$($(CVS_LIST_EXCEPT)) && \ - { echo "$(ME): help2man requires at least two spaces between"; \ - echo "$(ME): an option and its description"; \ - 1>&2; exit 1; } || : - -# Look for diagnostics that aren't marked for translation. -# This won't find any for which error's format string is on a separate line. -sc_unmarked_diagnostics: - @grep -nE \ - '\&2; \ - exit 1; } || : - -# Avoid useless parentheses like those in this example: -# #if defined (SYMBOL) || defined (SYM2) -sc_useless_cpp_parens: - @grep -n '^# *if .*defined *(' $$($(CVS_LIST_EXCEPT)) && \ - { echo '$(ME): found useless parentheses in cpp directive' \ - 1>&2; exit 1; } || : - -# Ensure that date's --help output stays in sync with the info -# documentation for GNU strftime. The only exception is %N, -# which date accepts but GNU strftime does not. -extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/' -strftime-check: - if test -f $(srcdir)/src/date.c; then \ - grep '^ %. ' $(srcdir)/src/date.c | sort \ - | $(extract_char) > $@-src; \ - { echo N; \ - info libc date calendar format | grep '^ `%.'\' \ - | $(extract_char); } | sort > $@-info; \ - diff -u $@-src $@-info || exit 1; \ - rm -f $@-src $@-info; \ - fi - -# Ensure that we use only the standard $(VAR) notation, -# not @...@ in Makefile.am, now that we can rely on automake -# to emit a definition for each substituted variable. -makefile-check: - grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \ - && { echo 'Makefile.maint: use $$(...), not @...@' 1>&2; exit 1; } || : - -news-date-check: NEWS - today=`date +%Y-%m-%d`; \ - if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \ - >/dev/null; then \ - :; \ - else \ - echo "version or today's date is not in NEWS" 1>&2; \ - exit 1; \ - fi - -changelog-check: - if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \ - >/dev/null; then \ - :; \ - else \ - echo "$(VERSION) not in ChangeLog" 1>&2; \ - exit 1; \ - fi - -m4-check: - @grep -n 'AC_DEFUN([^[]' m4/*.m4 \ - && { echo 'Makefile.maint: quote the first arg to AC_DEFUN' 1>&2; \ - exit 1; } || : - -# Verify that all source files using _() are listed in po/POTFILES.in. -# FIXME: don't hard-code file names below; use a more general mechanism. -po-check: - if test -f po/POTFILES.in; then \ - grep -E -v '^(#|$$)' po/POTFILES.in \ - | grep -v '^src/false\.c$$' | sort > $@-1; \ - files=; \ - for file in $$($(CVS_LIST_EXCEPT)) lib/*.[ch]; do \ - case $$file in \ - djgpp/* | man/*) continue;; \ - esac; \ - case $$file in \ - *.[ch]) \ - base=`expr " $$file" : ' \(.*\)\..'`; \ - { test -f $$base.l || test -f $$base.y; } && continue;; \ - esac; \ - files="$$files $$file"; \ - done; \ - grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort -u > $@-2; \ - diff -u $@-1 $@-2 || exit 1; \ - rm -f $@-1 $@-2; \ - fi - -# In a definition of #define AUTHORS "... and ..." where the RHS contains -# the English word `and', the string must be marked with `N_ (...)' so that -# gettext recognizes it as a string requiring translation. -author_mark_check: - @grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \ - { echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \ - exit 1; } || : - -# Sometimes it is useful to change the PATH environment variable -# in Makefiles. When doing so, it's better not to use the Unix-centric -# path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'. -# It'd be better to use `find -print0 ...|xargs -0 ...', but less portable, -# and there probably aren't many projects with so many Makefile.am files -# that we'd have to worry about limits on command line length. -msg = 'Makefile.maint: Do not use `:'\'' above; use @PATH_SEPARATOR@ instead' -makefile_path_separator_check: - @grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \ - && { echo $(msg) 1>&2; exit 1; } || : - -# Check that `make alpha' will not fail at the end of the process. -writable-files: - if test -d $(release_archive_dir); then :; else \ - mkdir $(release_archive_dir); \ - fi - for file in $(distdir).tar.gz $(xd-delta) \ - $(release_archive_dir)/$(distdir).tar.gz \ - $(release_archive_dir)/$(xd-delta); do \ - test -e $$file || continue; \ - test -w $$file \ - || { echo ERROR: $$file is not writable; fail=1; }; \ - done; \ - test "$$fail" && exit 1 || : - -v_etc_file = lib/version-etc.c -# Make sure that the copyright date in $(v_etc_file) is up to date. -copyright-check: - @if test -f $(v_etc_file); then \ - grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \ - >/dev/null \ - || { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \ - exit 1; }; \ - fi - - -# Sanity checks with the CVS repository. -cvs-tag-check: - echo $(this-cvs-tag); \ - if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \ - echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \ - exit 1; \ - else :; fi - -cvs-diff-check: - if $(CVS) diff >cvs-diffs; then \ - rm cvs-diffs; \ - else \ - echo "Some files are locally modified:" 1>&2; \ - cat cvs-diffs; \ - exit 1; \ - fi - -cvs-check: cvs-diff-check cvs-tag-check - -maintainer-distcheck: changelog-check - $(MAKE) distcheck - $(MAKE) my-distcheck - - -# Tag before making distribution. Also, don't make a distribution if -# checks fail. Also, make sure the NEWS file is up-to-date. -# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck. -cvs-dist: $(local-check) cvs-check maintainer-distcheck - $(CVS) update po - $(CVS) tag -c $(this-cvs-tag) - $(MAKE) dist - -# Use this to make sure we don't run these programs when building -# from a virgin tgz file, below. -null_AM_MAKEFLAGS = \ - ACLOCAL=false \ - AUTOCONF=false \ - AUTOMAKE=false \ - AUTOHEADER=false \ - MAKEINFO=false - -# Detect format-string/arg-list mismatches that would normally be obscured -# by the use of _(). The --disable-nls effectively defines away that macro, -# and building with CFLAGS='-Wformat -Werror' causes any format warning to be -# treated as a failure. Also, check for shadowing problems with -Wshadow. -# These CFLAGS are pretty strict. If you build this target, you probably -# have to have a recent version of gcc and glibc headers. -TMPDIR ?= /tmp -t=$(TMPDIR)/$(PACKAGE)/test -my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz) - -rm -rf $(t) - mkdir -p $(t) - GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz - cd $(t)/$(distdir) \ - && ./configure --disable-nls \ - && $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow' \ - AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \ - && $(MAKE) dvi \ - && $(MAKE) check \ - && $(MAKE) distclean - (cd $(t) && mv $(distdir) $(distdir).old \ - && $(AMTAR) -zxf - ) < $(distdir).tar.gz - diff -ur $(t)/$(distdir).old $(t)/$(distdir) - -rm -rf $(t) - @echo "========================"; \ - echo "$(distdir).tar.gz is ready for distribution"; \ - echo "========================" - -WGET = wget -WGETFLAGS = -C off - -rel-check: - tarz=/tmp/rel-check-tarz-$$$$; \ - md5_tmp=/tmp/rel-check-md5-$$$$; \ - set -e; \ - trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \ - $(WGET) $(WGETFLAGS) -q --output-document=$$tarz $(url); \ - echo "$(md5) -" > $$md5_tmp; \ - md5sum -c $$md5_tmp < $$tarz - -prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz -xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta - -rel-files = $(xd-delta) $(DIST_ARCHIVES) -announcement: NEWS ChangeLog $(rel-files) - @./announce-gen \ - --release-type=$(RELEASE_TYPE) \ - --package=$(PACKAGE) \ - --prev=$(PREV_VERSION) \ - --curr=$(VERSION) \ - --release-archive-directory=$(release_archive_dir) \ - --gpg-key-id=$(gpg_key_ID) \ - --news=NEWS \ - $(addprefix --url-dir=, $(url_dir_list)) \ - - -## ---------------- ## -## Updating files. ## -## ---------------- ## - -ftp-gnu = ftp://ftp.gnu.org/gnu -www-gnu = http://www.gnu.org - -# Use mv, if you don't have/want move-if-change. -move_if_change ?= move-if-change - - -# --------------------- # -# Updating everything. # -# --------------------- # - -.PHONY: update -local_updates ?= wget-update cvs-update po-update -update: $(local_updates) - - -# ------------------- # -# Updating PO files. # -# ------------------- # - -po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE) -.PHONY: do-po-update po-update -do-po-update: - tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\ - rm -rf $$tmppo && \ - mkdir $$tmppo && \ - (cd $$tmppo && \ - $(WGET) $(WGETFLAGS) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\ - cp $$tmppo/*.po po - cd po && $(MAKE) update-po - $(MAKE) po-check - -po-update: - if test -d "po"; then \ - $(MAKE) do-po-update; \ - fi - -# -------------------------- # -# Updating GNU build tools. # -# -------------------------- # - -# The following pseudo table associates a local directory and a URL -# with each of the files that belongs to some other package and is -# regularly updated from the specified URL. -wget_files ?= \ - $(srcdir)/build-aux/config.guess \ - $(srcdir)/build-aux/config.sub \ - $(srcdir)/build-aux/texinfo.tex \ - $(srcdir)/src/ansi2knr.c - -get-targets = $(patsubst %, get-%, $(wget_files)) - -config.guess-url_prefix = $(ftp-gnu)/build-aux/ -config.sub-url_prefix = $(ftp-gnu)/build-aux/ - -ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/ - -texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/ - -standards.texi-url_prefix = $(www-gnu)/prep/ -make-stds.texi-url_prefix = $(standards.texi-url_prefix) - -target = $(patsubst get-%, %, $@) -url = $($(notdir $(target))-url_prefix)$(notdir $(target)) - -.PHONY: $(get-targets) -$(get-targets): - $(WGET) $(WGETFLAGS) $(url) -O $(target).t \ - && $(move_if_change) $(target).t $(target) - -cvs_files ?= \ - $(srcdir)/build-aux/depcomp \ - $(srcdir)/build-aux/install-sh \ - $(srcdir)/build-aux/missing \ - $(srcdir)/build-aux/mkinstalldirs \ - $(srcdir)/src/ansi2knr.c -automake_repo=:pserver:anoncvs:anoncvs@sources.redhat.com:/cvs/automake -.PHONY: wget-update -wget-update: $(get-targets) - -.PHONY: cvs-update -cvs-update: - fail=; \ - for f in $(cvs_files); do \ - test -f $$f || { echo "*** skipping $$f" 1>&2; continue; }; \ - cvs diff $$f > /dev/null \ - || { echo "*** $$f is locally modified; skipping it" 1>&2; \ - fail=yes; continue; }; \ - file=$$(basename $$f); \ - echo checking out $$file...; \ - $(CVS) -d $(automake_repo) co -p automake/lib/$$file> $$f.t \ - && $(move_if_change) $$f.t $$f; \ - done; \ - test "$$fail" && exit 1 - -emit_upload_commands: - @echo ===================================== - @echo ===================================== - @echo "$(srcdir)/gnupload $(GNUPLOADFLAGS) \\" - @echo " --to $(gnu_rel_host):coreutils \\" - @echo " $(rel-files)" - @echo '# send the /tmp/announcement e-mail' - @echo ===================================== - @echo ===================================== - -$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz - xdelta delta -9 $^ $@ || : - -.PHONY: alpha beta major -alpha beta major: news-date-check $(local-check) - $(MAKE) cvs-dist - $(MAKE) $(xd-delta) - $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir) - ln $(rel-files) $(release_archive_dir) - chmod a-w $(rel-files) - $(MAKE) -s emit_upload_commands RELEASE_TYPE=$@ - echo $(VERSION) > $(prev_version_file) - $(CVS) ci -m. $(prev_version_file) diff --git a/src/bin/bison/NEWS b/src/bin/bison/NEWS deleted file mode 100644 index 3dca4fe091..0000000000 --- a/src/bin/bison/NEWS +++ /dev/null @@ -1,732 +0,0 @@ -Bison News ----------- - -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'. - The old spelling still works, but is not documented and will be - removed. - - - 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 and later] - explicitly associate look-ahead 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 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 autoconf; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. diff --git a/src/bin/bison/OChangeLog b/src/bin/bison/OChangeLog deleted file mode 100644 index 5ae60b926c..0000000000 --- a/src/bin/bison/OChangeLog +++ /dev/null @@ -1,1500 +0,0 @@ -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/src/bin/bison/PACKAGING b/src/bin/bison/PACKAGING deleted file mode 100644 index dd285c990c..0000000000 --- a/src/bin/bison/PACKAGING +++ /dev/null @@ -1,56 +0,0 @@ -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. - -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 autoconf; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. diff --git a/src/bin/bison/README b/src/bin/bison/README deleted file mode 100644 index a053f4b81e..0000000000 --- a/src/bin/bison/README +++ /dev/null @@ -1,41 +0,0 @@ -This directory contains the Bison parser generator. - -See the file INSTALL for generic compilation and installation instructions. -See the file doc/FAQ for frequently asked questions. - -Bison requires GNU m4 1.4.3 or later. See: - -ftp://ftp.gnu.org/gnu/m4/m4-1.4.3.tar.gz - -Bison can work with pre-1.4.3 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.3 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 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 autoconf; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. diff --git a/src/bin/bison/THANKS b/src/bin/bison/THANKS deleted file mode 100644 index c00580e0b8..0000000000 --- a/src/bin/bison/THANKS +++ /dev/null @@ -1,90 +0,0 @@ -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 -Bruce Lilly blilly@erols.com -Bruno Haible bruno@clisp.org -Charles-Henri de Boysson de-boy_c@epita.fr -Cris Bailiff c.bailiff+bison@awayweb.com -Cris van Pelt cris@amf03054.office.wxs.nl -Daniel Hagerty hag@gnu.org -David J. MacKenzie djm@gnu.org -Derek M. Jones derek@knosof.co.uk -Dick Streefland dick.streefland@altium.nl -Enrico Scholz enrico.scholz@informatik.tu-chemnitz.de -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 -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 ST001906@HRZ1.HRZ.TU-Darmstadt.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 -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 -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 -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 - twlevo@xs4all.nl - -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/src/bin/bison/TODO b/src/bin/bison/TODO deleted file mode 100644 index 76ca736275..0000000000 --- a/src/bin/bison/TODO +++ /dev/null @@ -1,328 +0,0 @@ --*- 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...). - - -* 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 look-ahead 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. - - -* 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. - - -** Java - -There are a couple of proposed outputs: - -- BYACC/J - which is based on Byacc. - - -- Bison Java - which is based on Bison. - - -Sebastien Serrurier (serrur_s@epita.fr) is working on this: he is -expected to contact the authors, design the output, and implement it -into Bison. - - -* 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 ? -** %no-parser -** %token-table -** Skeleton strategy -Must we keep %no-parser? %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). - -This will be possible with a Bison parser for the grammar, as it will -make it much easier to extend the grammar. - -** 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. - -* Move to Graphviz -Well, VCG seems really dead. Move to Graphviz instead. Also, 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. - -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. diff --git a/src/bin/bison/aclocal.m4 b/src/bin/bison/aclocal.m4 deleted file mode 100644 index 3c5426ae3d..0000000000 --- a/src/bin/bison/aclocal.m4 +++ /dev/null @@ -1,924 +0,0 @@ -# generated automatically by aclocal 1.9.6 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 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. - -# 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. - -# Copyright (C) 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. - -# 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. -AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.6])]) - -# 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` -]) - - -# Copyright (C) 1996, 1997, 1999, 2000, 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 4 - -# This was merged into AC_PROG_CC in Autoconf. - -AU_DEFUN([AM_PROG_CC_STDC], -[AC_PROG_CC -AC_DIAGNOSE([obsolete], [$0: - your code should no longer depend upon `am_cv_prog_cc_stdc', but upon - `ac_cv_prog_cc_stdc'. Remove this warning and the assignment when - you adjust the code. You can also remove the above call to - AC_PROG_CC if you already called it elsewhere.]) -am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc -]) -AU_DEFUN([fp_PROG_CC_STDC]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997, 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 7 - -# 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]) -AC_SUBST([$1_FALSE]) -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 -# 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 - -# 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], 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/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]) -]) - -# 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. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /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 -# 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 12 - -# 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.58])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 -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi - -# 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 - 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 -]) -]) - - -# 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_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $1 | $1:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/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-"$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 -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997, 1999, 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_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 -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 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 whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. -# -# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories -# created by `make install' are always world readable, even if the -# installer happens to have an overly restrictive umask (e.g. 077). -# This was a mistake. There are at least two reasons why we must not -# use `-m 0755': -# - it causes special bits like SGID to be ignored, -# - it may be too restrictive (some setups expect 775 directories). -# -# Do not use -m 0755 and let people choose whatever they expect by -# setting umask. -# -# We cannot accept any implementation of `mkdir' that recognizes `-p'. -# Some implementations (such as Solaris 8's) are not thread-safe: if a -# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' -# concurrently, both version can detect that a/ is missing, but only -# one can create it and the other will error out. Consequently we -# restrict ourselves to GNU make (using the --version option ensures -# this.) -AC_DEFUN([AM_PROG_MKDIR_P], -[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi -AC_SUBST([mkdir_p])]) - -# 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="\${SHELL} \$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# 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/bison-i18n.m4]) -m4_include([m4/c-working.m4]) -m4_include([m4/cxx.m4]) -m4_include([m4/dirname.m4]) -m4_include([m4/dmalloc.m4]) -m4_include([m4/dos.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_gl.m4]) -m4_include([m4/gnulib.m4]) -m4_include([m4/hard-locale.m4]) -m4_include([m4/hash.m4]) -m4_include([m4/iconv.m4]) -m4_include([m4/inttypes_h_gl.m4]) -m4_include([m4/lib-ld_gl.m4]) -m4_include([m4/lib-link.m4]) -m4_include([m4/lib-prefix_gl.m4]) -m4_include([m4/m4.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/obstack.m4]) -m4_include([m4/onceonly.m4]) -m4_include([m4/po_gl.m4]) -m4_include([m4/progtest.m4]) -m4_include([m4/quote.m4]) -m4_include([m4/quotearg.m4]) -m4_include([m4/stdbool.m4]) -m4_include([m4/stdint_h_gl.m4]) -m4_include([m4/stdio-safer.m4]) -m4_include([m4/stpcpy.m4]) -m4_include([m4/strdup.m4]) -m4_include([m4/strerror.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/uintmax_t_gl.m4]) -m4_include([m4/ulonglong_gl.m4]) -m4_include([m4/unistd-safer.m4]) -m4_include([m4/unistd_h.m4]) -m4_include([m4/unlocked-io.m4]) -m4_include([m4/warning.m4]) -m4_include([m4/xalloc.m4]) -m4_include([m4/xstrndup.m4]) diff --git a/src/bin/bison/config.h b/src/bin/bison/config.h deleted file mode 100644 index e7d486d23f..0000000000 --- a/src/bin/bison/config.h +++ /dev/null @@ -1,352 +0,0 @@ -/* config.h. Generated by configure. */ -/* config.hin. Generated from configure.ac by autoheader. */ - -/* 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. */ -#define FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX 0 - -/* Define if the backslash character may also serve as a file name component - separator. */ -#define FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR 0 - -#if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX -# define FILE_SYSTEM_PREFIX_LEN(Filename) \ - ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0) -#else -# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 -#endif - -/* Define to 1 if the system has the type `clock_t'. */ -#define HAVE_CLOCK_T 1 - -/* 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. */ -#define HAVE_DECL_CLEARERR_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `clock', and to 0 if you don't. - */ -#define HAVE_DECL_CLOCK 1 - -/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you - don't. */ -#define HAVE_DECL_FEOF_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if - you don't. */ -#define HAVE_DECL_FERROR_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if - you don't. */ -#define HAVE_DECL_FFLUSH_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if - you don't. */ -#define HAVE_DECL_FGETS_UNLOCKED 0 - -/* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if - you don't. */ -#define HAVE_DECL_FPUTC_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if - you don't. */ -#define HAVE_DECL_FPUTS_UNLOCKED 0 - -/* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if - you don't. */ -#define HAVE_DECL_FREAD_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if - you don't. */ -#define HAVE_DECL_FWRITE_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if - you don't. */ -#define HAVE_DECL_GETCHAR_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you - don't. */ -#define HAVE_DECL_GETC_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `getrusage', and to 0 if you - don't. */ -#define HAVE_DECL_GETRUSAGE 1 - -/* Define to 1 if you have a declaration of mbswidth() in , and to 0 - otherwise. */ -#define HAVE_DECL_MBSWIDTH_IN_WCHAR_H 0 - -/* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if - you don't. */ -#define HAVE_DECL_PUTCHAR_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you - don't. */ -#define HAVE_DECL_PUTC_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you - don't. */ -#define HAVE_DECL_STRERROR_R 1 - -/* Define to 1 if you have the declaration of `strnlen', and to 0 if you - don't. */ -/* #undef HAVE_DECL_STRNLEN */ -#define HAVE_DECL_STRNLEN 1 - -/* Define to 1 if you have the declaration of `sysconf', and to 0 if you - don't. */ -#define HAVE_DECL_SYSCONF 1 - -/* Define to 1 if you have the declaration of `times', and to 0 if you don't. - */ -#define HAVE_DECL_TIMES 1 - -/* Define to 1 if you have the declaration of wcwidth(), and to 0 otherwise. - */ -#define HAVE_DECL_WCWIDTH 1 - -/* Define to 1 if you have the `dup2' function. */ -#define HAVE_DUP2 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `fork' function. */ -#define HAVE_FORK 1 - -/* Define if the GNU gettext() function is already present or preinstalled. */ -/* #undef HAVE_GETTEXT */ - -/* Define if you have the iconv() function. */ -/* #undef HAVE_ICONV */ - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `isascii' function. */ -#define HAVE_ISASCII 1 - -/* Define to 1 if you have the `iswcntrl' function. */ -#define HAVE_ISWCNTRL 1 - -/* Define to 1 if you have the `iswprint' function. */ -#define HAVE_ISWPRINT 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#define HAVE_MALLOC 1 - -/* Define to 1 if mbrtowc and mbstate_t are properly declared. */ -/* #undef HAVE_MBRTOWC */ - -/* Define to 1 if you have the `mbsinit' function. */ -#define HAVE_MBSINIT 1 - -/* Define to 1 if declares mbstate_t. */ -/* #undef HAVE_MBSTATE_T */ - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if libc includes obstacks. */ -#define HAVE_OBSTACK 1 - -/* Define to 1 if you have the `setlocale' function. */ -#define HAVE_SETLOCALE 1 - -/* 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. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `stpcpy' function. */ -#define HAVE_STPCPY 1 - -/* Define to 1 if you have the `strerror_r' function. */ -#define HAVE_STRERROR_R 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strndup' function. */ -#define HAVE_STRNDUP 1 - -/* Define to 1 if the system has the type `struct tms'. */ -#define HAVE_STRUCT_TMS 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_RESOURCE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIMES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define to 1 if you have the `times' function. */ -#define HAVE_TIMES 1 - -/* Define to 1 if the system has the type `uintptr_t'. */ -#define HAVE_UINTPTR_T 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the `vfork' function. */ -//#define HAVE_VFORK 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_VFORK_H */ - -/* Define to 1 if you have the `waitpid' function. */ -#define HAVE_WAITPID 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_WCHAR_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_WCTYPE_H */ - -/* Define to 1 if you have the `wcwidth' function. */ -#define HAVE_WCWIDTH 1 - -/* Define to 1 if `fork' works. */ -#define HAVE_WORKING_FORK 1 - -/* Define to 1 if `vfork' works. */ -//#define HAVE_WORKING_VFORK 1 - -/* 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. */ -#define M4 "/bin/m4" - -/* Name of package */ -#define PACKAGE "bison" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "bug-bison@gnu.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "GNU Bison" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "GNU Bison 2.3" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "bison" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.3" - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -/* #undef STACK_DIRECTION */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if strerror_r returns char *. */ -#define STRERROR_R_CHAR_P 1 - -/* Version number of package */ -#define VERSION "2.3" - -/* Define if using the dmalloc debugging malloc package */ -/* #undef WITH_DMALLOC */ - -/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a - `char[]'. */ -#define YYTEXT_POINTER 1 - -/* Define to 1 if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -/* # undef _ALL_SOURCE */ -#endif - -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -/* 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 Solaris. */ -#ifndef __EXTENSIONS__ -# define __EXTENSIONS__ 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 - -/* 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. */ -//#define mbstate_t int - -/* Define to `int' if does not define. */ -/* #undef pid_t */ - -/* Define to rpl_realloc if the replacement function should be used. */ -/* #undef realloc */ - -/* Define to rpl_strnlen if the replacement function should be used. */ -/* #undef strnlen */ - -/* Define as `fork' if `vfork' does not work. */ -/* #undef vfork */ diff --git a/src/bin/bison/config.hin b/src/bin/bison/config.hin deleted file mode 100644 index ff0c48b96d..0000000000 --- a/src/bin/bison/config.hin +++ /dev/null @@ -1,413 +0,0 @@ -/* config.hin. Generated from configure.ac by autoheader. */ - -/* 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 - -#if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX -# define FILE_SYSTEM_PREFIX_LEN(Filename) \ - ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0) -#else -# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 -#endif - -/* 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 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 `strdup', and to 0 if you don't. - */ -#undef HAVE_DECL_STRDUP - -/* 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 `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 otherwise. - */ -#undef HAVE_DECL_WCWIDTH - -/* Define to 1 if you have the `dup2' function. */ -#undef HAVE_DUP2 - -/* 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. */ -#undef HAVE_ICONV - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define if exists, doesn't clash with , and - declares uintmax_t. */ -#undef HAVE_INTTYPES_H_WITH_UINTMAX - -/* 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 to 1 if you have the `iswprint' function. */ -#undef HAVE_ISWPRINT - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - -/* 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 `setlocale' function. */ -#undef HAVE_SETLOCALE - -/* 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 if exists, doesn't clash with , and declares - uintmax_t. */ -#undef HAVE_STDINT_H_WITH_UINTMAX - -/* 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 `strdup' function. */ -#undef HAVE_STRDUP - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* 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 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_RESOURCE_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 if you have the 'uintmax_t' type in or . */ -#undef HAVE_UINTMAX_T - -/* Define to 1 if the system has the type `uintptr_t'. */ -#undef HAVE_UINTPTR_T - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the 'unsigned long long' type. */ -#undef HAVE_UNSIGNED_LONG_LONG - -/* 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 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 `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 - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* 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 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 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 AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif - -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif - -/* 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 Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif - -/* Define to rpl_ if the getopt replacement functions and variables should be - used. */ -#undef __GETOPT_PREFIX - -/* 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 - -/* 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 rpl_strndup if the replacement function should be used, */ -#undef strndup - -/* Define to rpl_strnlen if the replacement function should be used. */ -#undef strnlen - -/* Define to unsigned long or unsigned long long if and - don't define. */ -#undef uintmax_t - -/* Define as `fork' if `vfork' does not work. */ -#undef vfork diff --git a/src/bin/bison/configure b/src/bin/bison/configure deleted file mode 100644 index 40270df340..0000000000 --- a/src/bin/bison/configure +++ /dev/null @@ -1,17646 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for GNU Bison 2.3. -# -# Report bugs to . -# -# Copyright (C) 2003 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 Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; 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 || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# 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 - -# 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 - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - 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 - - ;; - 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 - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - 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=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # 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 before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, 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 - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { 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 sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# 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'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# 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` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME='GNU Bison' -PACKAGE_TARNAME='bison' -PACKAGE_VERSION='2.3' -PACKAGE_STRING='GNU Bison 2.3' -PACKAGE_BUGREPORT='bug-bison@gnu.org' - -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_STAT_H -# include -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif -#if HAVE_UNISTD_H -# include -#endif" - -gl_header_list= -gl_func_list= -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 datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM 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 CPP EGREP WARNING_CFLAGS WERROR_CFLAGS WARNING_CXXFLAGS YACC_SCRIPT YACC_LIBRARY LEX LEXLIB LEX_OUTPUT_ROOT YACC RANLIB ac_ct_RANLIB M4 STDBOOL_H HAVE__BOOL LIBOBJS GETOPT_H MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE build build_cpu build_vendor build_os host host_cpu host_vendor host_os INTL_MACOSX_LIBS LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB UNISTD_H 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 LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# 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. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -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 - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -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 | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$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 ;; - - -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 ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - 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 ;; - - -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=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 ;; - - -*) { 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 && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - 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'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -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 - 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 - - -# 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 its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - 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 - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP -ac_env_CXX_set=${CXX+set} -ac_env_CXX_value=$CXX -ac_cv_env_CXX_set=${CXX+set} -ac_cv_env_CXX_value=$CXX -ac_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_env_CXXFLAGS_value=$CXXFLAGS -ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_cv_env_CXXFLAGS_value=$CXXFLAGS - -# -# 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.3 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 \`..'] - -_ACEOF - - cat <<_ACEOF -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] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --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] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_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.3:";; - esac - cat <<\_ACEOF - -Optional Features: - --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 - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - CPP C preprocessor - 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 -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style 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 - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd "$ac_popdir" - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF -GNU Bison configure 2.3 -generated by GNU Autoconf 2.59 - -Copyright (C) 2003 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 0 -fi -exec 5>config.log -cat >&5 <<_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.3, which was -generated by GNU Autoconf 2.59. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -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` -hostinfo = `(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=. - echo "PATH: $as_dir" -done - -} >&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_sep= -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=`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_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - 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: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -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, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core && - rm -rf 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 -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >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 explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -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 - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -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 - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`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 - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -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 - - -gl_header_list="$gl_header_list locale.h" -gl_func_list="$gl_func_list setlocale" -gl_header_list="$gl_header_list wchar.h" -gl_header_list="$gl_header_list wctype.h" -gl_func_list="$gl_func_list isascii" -gl_func_list="$gl_func_list iswprint" -gl_func_list="$gl_func_list mbsinit" - - - - - - - - - - - - - - - - - - - - - - - - - -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 - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in build-aux $srcdir/build-aux" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in build-aux $srcdir/build-aux" >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - -case m4 in - [\\/]* | ?:[\\/]* ) ac_macro_dir=m4 ;; - *) ac_macro_dir=$srcdir/m4 ;; -esac -if test -d "$ac_macro_dir"; then : -else - { { echo "$as_me:$LINENO: error: cannot find macro directory \`m4'" >&5 -echo "$as_me: error: cannot find macro directory \`m4'" >&2;} - { (exit 1); exit 1; }; } -fi - - -# We don't have a file m4/Makefile.am, so we need Automake 1.8 or later. -am__api_version="1.9" -# 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. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$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 - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done - - -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. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$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' - -echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&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". - { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -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 - { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}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 $. echo might interpret backslashes. -# By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm conftest.sed - -# 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= - { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi - -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$AWK" && break -done - -echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.make <<\_ACEOF -all: - @echo 'ac_maketemp="$(MAKE)"' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftest.make -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - SET_MAKE= -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 - -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } -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.3' - - -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-"$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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - STRIP=$ac_ct_STRIP -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(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 config.h:config.hin" - - - -cat >>confdefs.h <<\_ACEOF -#define _GNU_SOURCE 1 -_ACEOF - - -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. -echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&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 - - -echo "$as_me:$LINENO: result: $_am_result" >&5 -echo "${ECHO_T}$_am_result" >&6 -rm -f confinc confmf - -# Check whether --enable-dependency-tracking or --disable-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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$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" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -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 - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -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. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - 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.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. -echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -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 -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&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' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - 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 - { { 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 -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 -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - 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 | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -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 -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -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 -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$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 -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=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 -std1 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 -std1. */ -int osf4_cc_array ['\x00' == 0 ? 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 -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f 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 - -depcc="$CC" am_compiler_list= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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/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 -echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$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 - - - -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 -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&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 - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - 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 non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - 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 -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - 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 non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - 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 - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -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 - - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - - -echo "$as_me:$LINENO: checking for AIX" >&5 -echo $ECHO_N "checking for AIX... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef _AIX - yes -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<\_ACEOF -#define _ALL_SOURCE 1 -_ACEOF - -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest* - - -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no -fi -rm -f 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 -#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)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$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=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -if test "${ac_cv_header_minix_config_h+set}" = set; then - echo "$as_me:$LINENO: checking for minix/config.h" >&5 -echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6 -if test "${ac_cv_header_minix_config_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 -echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking minix/config.h usability" >&5 -echo $ECHO_N "checking minix/config.h usability... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking minix/config.h presence" >&5 -echo $ECHO_N "checking minix/config.h presence... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5 -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 -echo "$as_me:$LINENO: checking for minix/config.h" >&5 -echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6 -if test "${ac_cv_header_minix_config_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_minix_config_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 -echo "${ECHO_T}$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 - - - - - - - - - - - - echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5 -echo $ECHO_N "checking whether it is safe to define __EXTENSIONS__... $ECHO_C" >&6 -if test "${ac_cv_safe_to_define___extensions__+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_safe_to_define___extensions__=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_safe_to_define___extensions__=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5 -echo "${ECHO_T}$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 _POSIX_PTHREAD_SEMANTICS 1 -_ACEOF - - - -# Checks for the compiler. -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$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" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -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 - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -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. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$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 -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=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 -std1 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 -std1. */ -int osf4_cc_array ['\x00' == 0 ? 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 -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f 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 - -depcc="$CC" am_compiler_list= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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/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 -echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$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 - - -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$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" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -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 - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -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. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$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 -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=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 -std1 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 -std1. */ -int osf4_cc_array ['\x00' == 0 ? 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 -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f 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 - -depcc="$CC" am_compiler_list= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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/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 -echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$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 - - - -am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc - -# Check whether --enable-gcc-warnings or --disable-gcc-warnings was given. -if test "${enable_gcc_warnings+set}" = set; then - enableval="$enable_gcc_warnings" - case "${enableval}" in - yes|no) ;; - *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for gcc-warnings option" >&5 -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 - echo "$as_me:$LINENO: checking whether compiler accepts -Werror" >&5 -echo $ECHO_N "checking whether compiler accepts -Werror... $ECHO_C" >&6 - -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -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 () -{ -int x; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - WARNING_CFLAGS="$WARNING_CFLAGS -Werror" -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$ac_save_CFLAGS" - WERROR_CFLAGS=$WARNING_CFLAGS - - WARNING_CFLAGS= - echo "$as_me:$LINENO: checking whether compiler accepts -W" >&5 -echo $ECHO_N "checking whether compiler accepts -W... $ECHO_C" >&6 - -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -W" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -int x; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - WARNING_CFLAGS="$WARNING_CFLAGS -W" -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$ac_save_CFLAGS" - echo "$as_me:$LINENO: checking whether compiler accepts -Wall" >&5 -echo $ECHO_N "checking whether compiler accepts -Wall... $ECHO_C" >&6 - -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -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 () -{ -int x; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - WARNING_CFLAGS="$WARNING_CFLAGS -Wall" -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$ac_save_CFLAGS" - echo "$as_me:$LINENO: checking whether compiler accepts -Wcast-align" >&5 -echo $ECHO_N "checking whether compiler accepts -Wcast-align... $ECHO_C" >&6 - -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -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 () -{ -int x; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - WARNING_CFLAGS="$WARNING_CFLAGS -Wcast-align" -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$ac_save_CFLAGS" - echo "$as_me:$LINENO: checking whether compiler accepts -Wcast-qual" >&5 -echo $ECHO_N "checking whether compiler accepts -Wcast-qual... $ECHO_C" >&6 - -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -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 () -{ -int x; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - WARNING_CFLAGS="$WARNING_CFLAGS -Wcast-qual" -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$ac_save_CFLAGS" - echo "$as_me:$LINENO: checking whether compiler accepts -Wformat" >&5 -echo $ECHO_N "checking whether compiler accepts -Wformat... $ECHO_C" >&6 - -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -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 () -{ -int x; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - WARNING_CFLAGS="$WARNING_CFLAGS -Wformat" -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$ac_save_CFLAGS" - echo "$as_me:$LINENO: checking whether compiler accepts -Wwrite-strings" >&5 -echo $ECHO_N "checking whether compiler accepts -Wwrite-strings... $ECHO_C" >&6 - -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -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 () -{ -int x; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - WARNING_CFLAGS="$WARNING_CFLAGS -Wwrite-strings" -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$ac_save_CFLAGS" - WARNING_CXXFLAGS=$WARNING_CFLAGS - - # The following warnings are not suitable for C++. - echo "$as_me:$LINENO: checking whether compiler accepts -Wbad-function-cast" >&5 -echo $ECHO_N "checking whether compiler accepts -Wbad-function-cast... $ECHO_C" >&6 - -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -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 () -{ -int x; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - WARNING_CFLAGS="$WARNING_CFLAGS -Wbad-function-cast" -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$ac_save_CFLAGS" - echo "$as_me:$LINENO: checking whether compiler accepts -Wmissing-declarations" >&5 -echo $ECHO_N "checking whether compiler accepts -Wmissing-declarations... $ECHO_C" >&6 - -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -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 () -{ -int x; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - WARNING_CFLAGS="$WARNING_CFLAGS -Wmissing-declarations" -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$ac_save_CFLAGS" - echo "$as_me:$LINENO: checking whether compiler accepts -Wmissing-prototypes" >&5 -echo $ECHO_N "checking whether compiler accepts -Wmissing-prototypes... $ECHO_C" >&6 - -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -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 () -{ -int x; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - WARNING_CFLAGS="$WARNING_CFLAGS -Wmissing-prototypes" -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$ac_save_CFLAGS" - echo "$as_me:$LINENO: checking whether compiler accepts -Wshadow" >&5 -echo $ECHO_N "checking whether compiler accepts -Wshadow... $ECHO_C" >&6 - -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -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 () -{ -int x; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - WARNING_CFLAGS="$WARNING_CFLAGS -Wshadow" -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$ac_save_CFLAGS" - echo "$as_me:$LINENO: checking whether compiler accepts -Wstrict-prototypes" >&5 -echo $ECHO_N "checking whether compiler accepts -Wstrict-prototypes... $ECHO_C" >&6 - -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -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 () -{ -int x; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - WARNING_CFLAGS="$WARNING_CFLAGS -Wstrict-prototypes" -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$ac_save_CFLAGS" - -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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compile a simple C program -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compile a simple C program -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - - -# Check whether --enable-yacc or --disable-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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_LEX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LEX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -LEX=$ac_cv_prog_LEX -if test -n "$LEX"; then - echo "$as_me:$LINENO: result: $LEX" >&5 -echo "${ECHO_T}$LEX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$LEX" && break -done -test -n "$LEX" || LEX=":" - -if test -z "$LEXLIB" -then - echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 -echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 -if test "${ac_cv_lib_fl_yywrap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lfl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap (); -int -main () -{ -yywrap (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_fl_yywrap=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_fl_yywrap=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 -echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 -if test $ac_cv_lib_fl_yywrap = yes; then - LEXLIB="-lfl" -else - echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 -echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 -if test "${ac_cv_lib_l_yywrap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ll $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap (); -int -main () -{ -yywrap (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_l_yywrap=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_l_yywrap=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 -echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 -if test $ac_cv_lib_l_yywrap = yes; then - LEXLIB="-ll" -fi - -fi - -fi - -if test "x$LEX" != "x:"; then - echo "$as_me:$LINENO: checking lex output file root" >&5 -echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 -if test "${ac_cv_prog_lex_root+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # The minimal lex program is just a single line: %%. But some broken lexes -# (Solaris, I think it was) want two %% lines, so accommodate them. -cat >conftest.l <<_ACEOF -%% -%% -_ACEOF -{ (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 - (eval $LEX conftest.l) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -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 - { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 -echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} - { (exit 1); exit 1; }; } -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 -echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 -rm -f conftest.l -LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root - -echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 -echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 -if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 -echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c -ac_save_LIBS=$LIBS -LIBS="$LIBS $LEXLIB" -cat >conftest.$ac_ext <<_ACEOF -`cat $LEX_OUTPUT_ROOT.c` -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_lex_yytext_pointer=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_save_LIBS -rm -f "${LEX_OUTPUT_ROOT}.c" - -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 -echo "${ECHO_T}$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 - -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_YACC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_YACC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -YACC=$ac_cv_prog_YACC -if test -n "$YACC"; then - echo "$as_me:$LINENO: result: $YACC" >&5 -echo "${ECHO_T}$YACC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - RANLIB=$ac_ct_RANLIB -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_M4+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_M4="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -M4=$ac_cv_path_M4 - -if test -n "$M4"; then - echo "$as_me:$LINENO: result: $M4" >&5 -echo "${ECHO_T}$M4" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$M4" && break -done -test -n "$M4" || M4="m4" - -echo "$as_me:$LINENO: checking whether m4 supports frozen files" >&5 -echo $ECHO_N "checking whether m4 supports frozen files... $ECHO_C" >&6 -if test "${ac_cv_prog_gnu_m4+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 -echo "$as_me:$LINENO: result: $ac_cv_prog_gnu_m4" >&5 -echo "${ECHO_T}$ac_cv_prog_gnu_m4" >&6 -if test x"$ac_cv_prog_gnu_m4" != xyes; then - { { echo "$as_me:$LINENO: error: GNU M4 1.4 is required" >&5 -echo "$as_me: error: GNU M4 1.4 is required" >&2;} - { (exit 1); exit 1; }; } -fi - -cat >>confdefs.h <<_ACEOF -#define M4 "$M4" -_ACEOF - - -# Checks for header files. - - - - - -for ac_header in $gl_header_list -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -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 -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - - - - - : - - - - - -echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 -echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6 -if test "${ac_cv_header_stdbool_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdbool_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdbool_h=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 -echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6 - echo "$as_me:$LINENO: checking for _Bool" >&5 -echo $ECHO_N "checking for _Bool... $ECHO_C" >&6 -if test "${ac_cv_type__Bool+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 () -{ -if ((_Bool *) 0) - return 0; -if (sizeof (_Bool)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type__Bool=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type__Bool=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 -echo "${ECHO_T}$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 - - - -# Checks for compiler characteristics. -echo "$as_me:$LINENO: checking for inline" >&5 -echo $ECHO_N "checking for inline... $ECHO_C" >&6 -if test "${ac_cv_c_inline+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_inline=$ac_kw; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 -echo "${ECHO_T}$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 - - -# Checks for types. -echo "$as_me:$LINENO: checking for uintptr_t" >&5 -echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 -if test "${ac_cv_type_uintptr_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 () -{ -if ((uintptr_t *) 0) - return 0; -if (sizeof (uintptr_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_uintptr_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_uintptr_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 -echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6 -if test $ac_cv_type_uintptr_t = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_UINTPTR_T 1 -_ACEOF - - -fi - - -# Checks for library functions. - - - - - -for ac_func in $gl_func_list -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - - - - - - : - - - - - -echo "$as_me:$LINENO: checking if malloc debugging is wanted" >&5 -echo $ECHO_N "checking if malloc debugging is wanted... $ECHO_C" >&6 - -# Check whether --with-dmalloc or --without-dmalloc was given. -if test "${with_dmalloc+set}" = set; then - withval="$with_dmalloc" - if test "$withval" = yes; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\_ACEOF -#define WITH_DMALLOC 1 -_ACEOF - - LIBS="$LIBS -ldmalloc" - LDFLAGS="$LDFLAGS -g" -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi; - - - echo "$as_me:$LINENO: checking for pid_t" >&5 -echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 -if test "${ac_cv_type_pid_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 () -{ -if ((pid_t *) 0) - return 0; -if (sizeof (pid_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_pid_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_pid_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 -echo "${ECHO_T}$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 - - echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 -echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 -if test "${ac_cv_header_sys_wait_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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)(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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_sys_wait_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_sys_wait_h=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 -echo "${ECHO_T}$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=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - -for ac_header in unistd.h vfork.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -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 -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -for ac_func in fork vfork -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -if test "x$ac_cv_func_fork" = xyes; then - echo "$as_me:$LINENO: checking for working fork" >&5 -echo $ECHO_N "checking for working fork... $ECHO_C" >&6 -if test "${ac_cv_func_fork_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_fork_works=cross -else - cat >conftest.$ac_ext <<_ACEOF -/* By Ruediger Kuhlmann. */ - #include - #if HAVE_UNISTD_H - # include - #endif - /* Some systems only have a dummy stub for fork() */ - int main () - { - if (fork() < 0) - exit (1); - exit (0); - } -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_fork_works=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_fork_works=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 -echo "${ECHO_T}$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 - { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 -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 - echo "$as_me:$LINENO: checking for working vfork" >&5 -echo $ECHO_N "checking for working vfork... $ECHO_C" >&6 -if test "${ac_cv_func_vfork_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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. */ -#include -#include -#include -#include -#include -#if HAVE_UNISTD_H -# include -#endif -#if 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) - ; - exit( - /* 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_vfork_works=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_vfork_works=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 -echo "${ECHO_T}$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 - { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 -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=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -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 -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in sys/resource.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_func in times -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -echo "$as_me:$LINENO: checking whether getrusage is declared" >&5 -echo $ECHO_N "checking whether getrusage is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_getrusage+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) getrusage; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_getrusage=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_getrusage=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_getrusage" >&5 -echo "${ECHO_T}$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 -echo "$as_me:$LINENO: checking whether times is declared" >&5 -echo $ECHO_N "checking whether times is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_times+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) times; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_times=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_times=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_times" >&5 -echo "${ECHO_T}$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 -echo "$as_me:$LINENO: checking whether clock is declared" >&5 -echo $ECHO_N "checking whether clock is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_clock+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) clock; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_clock=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_clock=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_clock" >&5 -echo "${ECHO_T}$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 -echo "$as_me:$LINENO: checking whether sysconf is declared" >&5 -echo $ECHO_N "checking whether sysconf is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_sysconf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) sysconf; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_sysconf=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_sysconf=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_sysconf" >&5 -echo "${ECHO_T}$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 - - - -echo "$as_me:$LINENO: checking for clock_t" >&5 -echo $ECHO_N "checking for clock_t... $ECHO_C" >&6 -if test "${ac_cv_type_clock_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 () -{ -if ((clock_t *) 0) - return 0; -if (sizeof (clock_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_clock_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_clock_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_clock_t" >&5 -echo "${ECHO_T}$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 -echo "$as_me:$LINENO: checking for struct tms" >&5 -echo $ECHO_N "checking for struct tms... $ECHO_C" >&6 -if test "${ac_cv_type_struct_tms+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 () -{ -if ((struct tms *) 0) - return 0; -if (sizeof (struct tms)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_struct_tms=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_struct_tms=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_struct_tms" >&5 -echo "${ECHO_T}$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 - - - -# gnulib and gettext. - - echo "$as_me:$LINENO: checking whether system is Windows or MSDOS" >&5 -echo $ECHO_N "checking whether system is Windows or MSDOS... $ECHO_C" >&6 -if test "${ac_cv_win_or_dos+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_win_or_dos=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_win_or_dos=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ac_cv_win_or_dos" >&5 -echo "${ECHO_T}$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 - else - ac_fs_accepts_drive_letter_prefix=0 - ac_fs_backslash_is_file_name_separator=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 - - -echo "$as_me:$LINENO: checking whether strerror_r is declared" >&5 -echo $ECHO_N "checking whether strerror_r is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_strerror_r+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) strerror_r; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_strerror_r=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_strerror_r=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_r" >&5 -echo "${ECHO_T}$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=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -echo "$as_me:$LINENO: checking whether strerror_r returns char *" >&5 -echo $ECHO_N "checking whether strerror_r returns char *... $ECHO_C" >&6 -if test "${ac_cv_func_strerror_r_char_p+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_strerror_r_char_p=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f 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); - exit (!isalpha (x)); - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_strerror_r_char_p=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - fi - -fi -echo "$as_me:$LINENO: result: $ac_cv_func_strerror_r_char_p" >&5 -echo "${ECHO_T}$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 - - - if test -z "$GETOPT_H"; then - -for ac_header in getopt.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -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 -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `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=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - GETOPT_H=getopt.h -fi -done - - fi - - if test -z "$GETOPT_H"; then - echo "$as_me:$LINENO: checking whether optreset is declared" >&5 -echo $ECHO_N "checking whether optreset is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_optreset+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) optreset; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_optreset=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_optreset=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_optreset" >&5 -echo "${ECHO_T}$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 - echo "$as_me:$LINENO: checking for working GNU getopt function" >&5 -echo $ECHO_N "checking for working GNU getopt function... $ECHO_C" >&6 -if test "${gl_cv_func_gnu_getopt+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - echo "$as_me:$LINENO: checking whether getopt_clip is declared" >&5 -echo $ECHO_N "checking whether getopt_clip is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_getopt_clip+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) getopt_clip; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_getopt_clip=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_getopt_clip=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_getopt_clip" >&5 -echo "${ECHO_T}$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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gl_cv_func_gnu_getopt=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -gl_cv_func_gnu_getopt=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $gl_cv_func_gnu_getopt" >&5 -echo "${ECHO_T}$gl_cv_func_gnu_getopt" >&6 - if test "$gl_cv_func_gnu_getopt" = "no"; then - GETOPT_H=getopt.h - fi - fi - - - echo "$as_me:$LINENO: checking whether getenv is declared" >&5 -echo $ECHO_N "checking whether getenv is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_getenv+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) getenv; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_getenv=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_getenv=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_getenv" >&5 -echo "${ECHO_T}$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 - - - - - - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - case "$ac_aux_dir" in - /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; - *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; - esac - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - - - - echo "$as_me:$LINENO: checking whether NLS is requested" >&5 -echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 - # Check whether --enable-nls or --disable-nls was given. -if test "${enable_nls+set}" = set; then - enableval="$enable_nls" - USE_NLS=$enableval -else - USE_NLS=yes -fi; - echo "$as_me:$LINENO: result: $USE_NLS" >&5 -echo "${ECHO_T}$USE_NLS" >&6 - - - - - - -# 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - echo "$as_me:$LINENO: result: $MSGFMT" >&5 -echo "${ECHO_T}$MSGFMT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_GMSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT=$ac_cv_path_GMSGFMT - -if test -n "$GMSGFMT"; then - echo "$as_me:$LINENO: result: $GMSGFMT" >&5 -echo "${ECHO_T}$GMSGFMT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -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 - -# 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_XGETTEXT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - echo "$as_me:$LINENO: result: $XGETTEXT" >&5 -echo "${ECHO_T}$XGETTEXT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - rm -f messages.po - - -# 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MSGMERGE+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - echo "$as_me:$LINENO: result: $MSGMERGE" >&5 -echo "${ECHO_T}$MSGMERGE" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - if test "$GMSGFMT" != ":"; then - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && - (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` - echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 -echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 - GMSGFMT=":" - fi - fi - - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && - (if $XGETTEXT --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 - : ; - else - echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 -echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 - XGETTEXT=":" - fi - rm -f messages.po - fi - - ac_config_commands="$ac_config_commands default-1" - - - - 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" - -# Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } - -echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6 -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 -build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 -host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - - -# Check whether --with-gnu-ld or --without-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. - echo "$as_me:$LINENO: checking for ld used by GCC" >&5 -echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&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 - echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 -else - echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 -fi -if test "${acl_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - echo "$as_me:$LINENO: result: $LD" >&5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 -if test "${acl_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6 -with_gnu_ld=$acl_cv_prog_gnu_ld - - - - - echo "$as_me:$LINENO: checking for shared library run path origin" >&5 -echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6 -if test "${acl_cv_rpath+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 -echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5 -echo "${ECHO_T}$acl_cv_rpath" >&6 - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - # Check whether --enable-rpath or --disable-rpath was given. -if test "${enable_rpath+set}" = set; then - enableval="$enable_rpath" - : -else - enable_rpath=yes -fi; - - - acl_libdirstem=lib - 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 - - - - - - - - - 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 or --without-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" - fi - fi - -fi; - LIBICONV= - LTLIBICONV= - INCICONV= - 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= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - 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 "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - 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"; 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 "$hardcode_direct" = yes; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$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 "$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/"'*$,,'` - 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"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; 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 "$hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$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=\"$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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo "$as_me:$LINENO: checking for inttypes.h" >&5 -echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 -if test "${gl_cv_header_inttypes_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 -int -main () -{ -uintmax_t i = (uintmax_t) -1; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gl_cv_header_inttypes_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gl_cv_header_inttypes_h=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gl_cv_header_inttypes_h" >&5 -echo "${ECHO_T}$gl_cv_header_inttypes_h" >&6 - if test $gl_cv_header_inttypes_h = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_INTTYPES_H_WITH_UINTMAX 1 -_ACEOF - - fi - - - echo "$as_me:$LINENO: checking for stdint.h" >&5 -echo $ECHO_N "checking for stdint.h... $ECHO_C" >&6 -if test "${gl_cv_header_stdint_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 -int -main () -{ -uintmax_t i = (uintmax_t) -1; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gl_cv_header_stdint_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gl_cv_header_stdint_h=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gl_cv_header_stdint_h" >&5 -echo "${ECHO_T}$gl_cv_header_stdint_h" >&6 - if test $gl_cv_header_stdint_h = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STDINT_H_WITH_UINTMAX 1 -_ACEOF - - fi - - - echo "$as_me:$LINENO: checking for unsigned long long" >&5 -echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6 -if test "${ac_cv_type_unsigned_long_long+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -unsigned long long ull = 1ULL; int i = 63; -int -main () -{ -unsigned long long ullmax = (unsigned long long) -1; - return ull << i | ull >> i | ullmax / ull | ullmax % ull; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_unsigned_long_long=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_unsigned_long_long=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5 -echo "${ECHO_T}$ac_cv_type_unsigned_long_long" >&6 - if test $ac_cv_type_unsigned_long_long = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_UNSIGNED_LONG_LONG 1 -_ACEOF - - fi - - - - - if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then - - test $ac_cv_type_unsigned_long_long = yes \ - && ac_type='unsigned long long' \ - || ac_type='unsigned long' - -cat >>confdefs.h <<_ACEOF -#define uintmax_t $ac_type -_ACEOF - - else - -cat >>confdefs.h <<\_ACEOF -#define HAVE_UINTMAX_T 1 -_ACEOF - - fi - - - echo "$as_me:$LINENO: checking whether strdup is declared" >&5 -echo $ECHO_N "checking whether strdup is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_strdup+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 strdup - char *p = (char *) strdup; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_strdup=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_strdup=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_strdup" >&5 -echo "${ECHO_T}$ac_cv_have_decl_strdup" >&6 -if test $ac_cv_have_decl_strdup = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRDUP 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRDUP 0 -_ACEOF - - -fi - - - - - echo "$as_me:$LINENO: checking whether strndup is declared" >&5 -echo $ECHO_N "checking whether strndup is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_strndup+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) strndup; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_strndup=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_strndup=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_strndup" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether strnlen is declared" >&5 -echo $ECHO_N "checking whether strnlen is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_strnlen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) strnlen; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_strnlen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_strnlen=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_strnlen" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether clearerr_unlocked is declared" >&5 -echo $ECHO_N "checking whether clearerr_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_clearerr_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) clearerr_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_clearerr_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_clearerr_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_clearerr_unlocked" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether feof_unlocked is declared" >&5 -echo $ECHO_N "checking whether feof_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_feof_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) feof_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_feof_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_feof_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_feof_unlocked" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether ferror_unlocked is declared" >&5 -echo $ECHO_N "checking whether ferror_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_ferror_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) ferror_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_ferror_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_ferror_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_ferror_unlocked" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether fflush_unlocked is declared" >&5 -echo $ECHO_N "checking whether fflush_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_fflush_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) fflush_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_fflush_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_fflush_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_fflush_unlocked" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether fgets_unlocked is declared" >&5 -echo $ECHO_N "checking whether fgets_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_fgets_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) fgets_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_fgets_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_fgets_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_fgets_unlocked" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether fputc_unlocked is declared" >&5 -echo $ECHO_N "checking whether fputc_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_fputc_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) fputc_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_fputc_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_fputc_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_fputc_unlocked" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether fputs_unlocked is declared" >&5 -echo $ECHO_N "checking whether fputs_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_fputs_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) fputs_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_fputs_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_fputs_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_fputs_unlocked" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether fread_unlocked is declared" >&5 -echo $ECHO_N "checking whether fread_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_fread_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) fread_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_fread_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_fread_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_fread_unlocked" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether fwrite_unlocked is declared" >&5 -echo $ECHO_N "checking whether fwrite_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_fwrite_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) fwrite_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_fwrite_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_fwrite_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_fwrite_unlocked" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether getc_unlocked is declared" >&5 -echo $ECHO_N "checking whether getc_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_getc_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) getc_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_getc_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_getc_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_getc_unlocked" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether getchar_unlocked is declared" >&5 -echo $ECHO_N "checking whether getchar_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_getchar_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) getchar_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_getchar_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_getchar_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_getchar_unlocked" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether putc_unlocked is declared" >&5 -echo $ECHO_N "checking whether putc_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_putc_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) putc_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_putc_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_putc_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_putc_unlocked" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether putchar_unlocked is declared" >&5 -echo $ECHO_N "checking whether putchar_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_putchar_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - char *p = (char *) putchar_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_putchar_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_putchar_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_putchar_unlocked" >&5 -echo "${ECHO_T}$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 - - - - - - - - case $LIBOBJS in - "dirname.$ac_objext" | \ - *" dirname.$ac_objext" | \ - "dirname.$ac_objext "* | \ - *" dirname.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS dirname.$ac_objext" ;; -esac - - - - - - - - echo "$as_me:$LINENO: checking for error_at_line" >&5 -echo $ECHO_N "checking for error_at_line... $ECHO_C" >&6 -if test "${ac_cv_lib_error_at_line+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 () -{ -error_at_line (0, 0, "", 0, ""); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_error_at_line=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_error_at_line=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_error_at_line" >&5 -echo "${ECHO_T}$ac_cv_lib_error_at_line" >&6 -if test $ac_cv_lib_error_at_line = no; then - case $LIBOBJS in - "error.$ac_objext" | \ - *" error.$ac_objext" | \ - "error.$ac_objext "* | \ - *" error.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS error.$ac_objext" ;; -esac - -fi - - - - : - - - - - - - case $LIBOBJS in - "exitfail.$ac_objext" | \ - *" exitfail.$ac_objext" | \ - "exitfail.$ac_objext "* | \ - *" exitfail.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS exitfail.$ac_objext" ;; -esac - - - : - - - - - - if test -n "$GETOPT_H"; then - - case $LIBOBJS in - "getopt.$ac_objext" | \ - *" getopt.$ac_objext" | \ - "getopt.$ac_objext "* | \ - *" getopt.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS getopt.$ac_objext" ;; -esac - - case $LIBOBJS in - "getopt1.$ac_objext" | \ - *" getopt1.$ac_objext" | \ - "getopt1.$ac_objext "* | \ - *" getopt1.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS getopt1.$ac_objext" ;; -esac - - - GETOPT_H=getopt.h - -cat >>confdefs.h <<\_ACEOF -#define __GETOPT_PREFIX rpl_ -_ACEOF - - - - - - : - - - - - - - -fi - - - - - - - - - - - - - - - - - - - - echo "$as_me:$LINENO: checking for CFPreferencesCopyAppValue" >&5 -echo $ECHO_N "checking for CFPreferencesCopyAppValue... $ECHO_C" >&6 -if test "${gt_cv_func_CFPreferencesCopyAppValue+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gt_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" - gt_save_LIBS="$LIBS" - LIBS="$LIBS -framework 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gt_cv_func_CFPreferencesCopyAppValue=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gt_cv_func_CFPreferencesCopyAppValue=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CPPFLAGS="$gt_save_CPPFLAGS" - LIBS="$gt_save_LIBS" -fi -echo "$as_me:$LINENO: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 -echo "${ECHO_T}$gt_cv_func_CFPreferencesCopyAppValue" >&6 - if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_CFPREFERENCESCOPYAPPVALUE 1 -_ACEOF - - fi - echo "$as_me:$LINENO: checking for CFLocaleCopyCurrent" >&5 -echo $ECHO_N "checking for CFLocaleCopyCurrent... $ECHO_C" >&6 -if test "${gt_cv_func_CFLocaleCopyCurrent+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gt_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" - gt_save_LIBS="$LIBS" - LIBS="$LIBS -framework 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gt_cv_func_CFLocaleCopyCurrent=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gt_cv_func_CFLocaleCopyCurrent=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CPPFLAGS="$gt_save_CPPFLAGS" - LIBS="$gt_save_LIBS" -fi -echo "$as_me:$LINENO: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether NLS is requested" >&5 -echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 - # Check whether --enable-nls or --disable-nls was given. -if test "${enable_nls+set}" = set; then - enableval="$enable_nls" - USE_NLS=$enableval -else - USE_NLS=yes -fi; - echo "$as_me:$LINENO: result: $USE_NLS" >&5 -echo "${ECHO_T}$USE_NLS" >&6 - - - - - LIBINTL= - LTLIBINTL= - POSUB= - - if test "$USE_NLS" = "yes"; then - gt_use_preinstalled_gnugettext=no - - - - - - - echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 -echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6 -if test "${gt_cv_func_gnugettext1_libc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 int _nl_msg_cat_cntr; -extern int *_nl_domain_bindings; -int -main () -{ -bindtextdomain ("", ""); -return * gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gt_cv_func_gnugettext1_libc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gt_cv_func_gnugettext1_libc=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5 -echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6 - - if test "$gt_cv_func_gnugettext1_libc" != "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 - - - echo "$as_me:$LINENO: checking for iconv" >&5 -echo $ECHO_N "checking for iconv... $ECHO_C" >&6 -if test "${am_cv_func_iconv+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_func_iconv=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_lib_iconv=yes - am_cv_func_iconv=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$am_save_LIBS" - fi - -fi -echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 -echo "${ECHO_T}$am_cv_func_iconv" >&6 - if test "$am_cv_func_iconv" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ICONV 1 -_ACEOF - - fi - if test "$am_cv_lib_iconv" = yes; then - echo "$as_me:$LINENO: checking how to link with libiconv" >&5 -echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $LIBICONV" >&5 -echo "${ECHO_T}$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 or --without-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" - fi - fi - -fi; - LIBINTL= - LTLIBINTL= - INCINTL= - 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= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - 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 "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - 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"; 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 "$hardcode_direct" = yes; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$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 "$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/"'*$,,'` - 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"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; 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 "$hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$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=\"$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 - - echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 -echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6 -if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 -extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias (const char *); -int -main () -{ -bindtextdomain ("", ""); -return * gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias ("") - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gt_cv_func_gnugettext1_libintl=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gt_cv_func_gnugettext1_libintl=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$gt_cv_func_gnugettext1_libintl" != 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 -extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias (const char *); -int -main () -{ -bindtextdomain ("", ""); -return * gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias ("") - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - LIBINTL="$LIBINTL $LIBICONV" - LTLIBINTL="$LTLIBINTL $LTLIBICONV" - gt_cv_func_gnugettext1_libintl=yes - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - CPPFLAGS="$gt_save_CPPFLAGS" - LIBS="$gt_save_LIBS" -fi -echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5 -echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6 - fi - - if test "$gt_cv_func_gnugettext1_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext1_libintl" = "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 - - echo "$as_me:$LINENO: checking whether to use NLS" >&5 -echo $ECHO_N "checking whether to use NLS... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $USE_NLS" >&5 -echo "${ECHO_T}$USE_NLS" >&6 - if test "$USE_NLS" = "yes"; then - echo "$as_me:$LINENO: checking where the gettext function comes from" >&5 -echo $ECHO_N "checking where the gettext function comes from... $ECHO_C" >&6 - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then - gt_source="external libintl" - else - gt_source="libc" - fi - else - gt_source="included intl directory" - fi - echo "$as_me:$LINENO: result: $gt_source" >&5 -echo "${ECHO_T}$gt_source" >&6 - fi - - if test "$USE_NLS" = "yes"; then - - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then - echo "$as_me:$LINENO: checking how to link with libintl" >&5 -echo $ECHO_N "checking how to link with libintl... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $LIBINTL" >&5 -echo "${ECHO_T}$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" - - - - - - - - - - - - case $LIBOBJS in - "hard-locale.$ac_objext" | \ - *" hard-locale.$ac_objext" | \ - "hard-locale.$ac_objext "* | \ - *" hard-locale.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS hard-locale.$ac_objext" ;; -esac - - - - - - case $LIBOBJS in - "hash.$ac_objext" | \ - *" hash.$ac_objext" | \ - "hash.$ac_objext "* | \ - *" hash.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS hash.$ac_objext" ;; -esac - - - - - - - -for ac_header in stdlib.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -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 -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 -echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6 -if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 STDC_HEADERS || HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif - -int -main () -{ -exit (malloc (0) ? 0 : 1); - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_malloc_0_nonnull=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -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 -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 -echo "${ECHO_T}$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 - - case $LIBOBJS in - "malloc.$ac_objext" | \ - *" malloc.$ac_objext" | \ - "malloc.$ac_objext "* | \ - *" malloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; -esac - - -cat >>confdefs.h <<\_ACEOF -#define malloc rpl_malloc -_ACEOF - -fi - - - - - - - : - - - - - - - - - - : - - - - - - - - - - - - - -for ac_func in iswcntrl wcwidth -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 -echo $ECHO_N "checking whether mbrtowc and mbstate_t are properly declared... $ECHO_C" >&6 -if test "${gl_cv_func_mbrtowc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gl_cv_func_mbrtowc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gl_cv_func_mbrtowc=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gl_cv_func_mbrtowc" >&5 -echo "${ECHO_T}$gl_cv_func_mbrtowc" >&6 - if test $gl_cv_func_mbrtowc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MBRTOWC 1 -_ACEOF - - fi - - - echo "$as_me:$LINENO: checking whether wcwidth is declared" >&5 -echo $ECHO_N "checking whether wcwidth is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_wcwidth+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 . */ -#if HAVE_STRING_H -# include -#endif -#if HAVE_WCHAR_H -# include -#endif - -int -main () -{ - -#ifndef wcwidth - char *p = (char *) wcwidth; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_wcwidth=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_wcwidth=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_wcwidth" >&5 -echo "${ECHO_T}$ac_cv_have_decl_wcwidth" >&6 - if test $ac_cv_have_decl_wcwidth = yes; then - ac_val=1 - else - ac_val=0 - fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_WCWIDTH $ac_val -_ACEOF - - - echo "$as_me:$LINENO: checking whether mbswidth is declared in " >&5 -echo $ECHO_N "checking whether mbswidth is declared in ... $ECHO_C" >&6 -if test "${ac_cv_have_decl_mbswidth+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#if HAVE_WCHAR_H -# include -#endif - -int -main () -{ - - char *p = (char *) mbswidth; - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_mbswidth=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_mbswidth=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_mbswidth" >&5 -echo "${ECHO_T}$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 - - - echo "$as_me:$LINENO: checking for mbstate_t" >&5 -echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6 -if test "${ac_cv_type_mbstate_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_mbstate_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_mbstate_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_mbstate_t" >&5 -echo "${ECHO_T}$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 - - - - echo "$as_me:$LINENO: checking for obstacks" >&5 -echo $ECHO_N "checking for obstacks... $ECHO_C" >&6 -if test "${ac_cv_func_obstack+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 "obstack.h" -int -main () -{ -struct obstack *mem; obstack_free(mem,(char *) 0) - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_obstack=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_obstack=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_obstack" >&5 -echo "${ECHO_T}$ac_cv_func_obstack" >&6 -if test $ac_cv_func_obstack = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_OBSTACK 1 -_ACEOF - -else - case $LIBOBJS in - "obstack.$ac_objext" | \ - *" obstack.$ac_objext" | \ - "obstack.$ac_objext "* | \ - *" obstack.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS obstack.$ac_objext" ;; -esac - -fi - - if test $ac_cv_func_obstack = no; then - - - - - : - - fi - - - - - case $LIBOBJS in - "quote.$ac_objext" | \ - *" quote.$ac_objext" | \ - "quote.$ac_objext "* | \ - *" quote.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS quote.$ac_objext" ;; -esac - - - - - - - case $LIBOBJS in - "quotearg.$ac_objext" | \ - *" quotearg.$ac_objext" | \ - "quotearg.$ac_objext "* | \ - *" quotearg.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS quotearg.$ac_objext" ;; -esac - - - - : - - - - - - - - - - : - - - - - - - - - echo "$as_me:$LINENO: checking for mbstate_t" >&5 -echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6 -if test "${ac_cv_type_mbstate_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_mbstate_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_mbstate_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_mbstate_t" >&5 -echo "${ECHO_T}$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 - - echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 -echo $ECHO_N "checking whether mbrtowc and mbstate_t are properly declared... $ECHO_C" >&6 -if test "${gl_cv_func_mbrtowc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gl_cv_func_mbrtowc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gl_cv_func_mbrtowc=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gl_cv_func_mbrtowc" >&5 -echo "${ECHO_T}$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 - - - - - - case $LIBOBJS in - "fopen-safer.$ac_objext" | \ - *" fopen-safer.$ac_objext" | \ - "fopen-safer.$ac_objext "* | \ - *" fopen-safer.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS fopen-safer.$ac_objext" ;; -esac - - - - - - - -for ac_func in stpcpy -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - case $LIBOBJS in - "$ac_func.$ac_objext" | \ - *" $ac_func.$ac_objext" | \ - "$ac_func.$ac_objext "* | \ - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; -esac - -fi -done - - - if test $ac_cv_func_stpcpy = no; then - - : - - fi - - - - - - -for ac_func in strdup -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - case $LIBOBJS in - "$ac_func.$ac_objext" | \ - *" $ac_func.$ac_objext" | \ - "$ac_func.$ac_objext "* | \ - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; -esac - -fi -done - - - - : - - - - - - : - - - - -for ac_func in strerror -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - case $LIBOBJS in - "$ac_func.$ac_objext" | \ - *" $ac_func.$ac_objext" | \ - "$ac_func.$ac_objext "* | \ - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; -esac - -fi -done - - - if test $ac_cv_func_strerror = no; then - - : - - fi - - - - - - - - - : - - - - - - - # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. - echo "$as_me:$LINENO: checking for working strndup" >&5 -echo $ECHO_N "checking for working strndup... $ECHO_C" >&6 -if test "${gl_cv_func_strndup+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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. */ - -#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 - 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 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gl_cv_func_strndup=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -gl_cv_func_strndup=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $gl_cv_func_strndup" >&5 -echo "${ECHO_T}$gl_cv_func_strndup" >&6 - if test $gl_cv_func_strndup = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_STRNDUP 1 -_ACEOF - - else - case $LIBOBJS in - "strndup.$ac_objext" | \ - *" strndup.$ac_objext" | \ - "strndup.$ac_objext "* | \ - *" strndup.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strndup.$ac_objext" ;; -esac - - -cat >>confdefs.h <<\_ACEOF -#define strndup rpl_strndup -_ACEOF - - : - fi - - - - - - - - echo "$as_me:$LINENO: checking for working strnlen" >&5 -echo $ECHO_N "checking for working strnlen... $ECHO_C" >&6 -if test "${ac_cv_func_strnlen_working+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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) - exit (1); - } - exit (0); - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_strnlen_working=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_strnlen_working=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_strnlen_working" >&5 -echo "${ECHO_T}$ac_cv_func_strnlen_working" >&6 -test $ac_cv_func_strnlen_working = no && case $LIBOBJS in - "strnlen.$ac_objext" | \ - *" strnlen.$ac_objext" | \ - "strnlen.$ac_objext "* | \ - *" strnlen.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strnlen.$ac_objext" ;; -esac - - - if test $ac_cv_func_strnlen_working = no; then - # This is necessary because automake-1.6.1 doens'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 - - - - -for ac_func in strtol -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - case $LIBOBJS in - "$ac_func.$ac_objext" | \ - *" $ac_func.$ac_objext" | \ - "$ac_func.$ac_objext "* | \ - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; -esac - -fi -done - - - if test $ac_cv_func_strtol = no; then - - - - : - - - - - - - fi - - - - -for ac_func in strtoul -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - case $LIBOBJS in - "$ac_func.$ac_objext" | \ - *" $ac_func.$ac_objext" | \ - "$ac_func.$ac_objext "* | \ - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; -esac - -fi -done - - - if test $ac_cv_func_strtoul = no; then - - - - - : - - - - - - - - fi - - - - - - - - -for ac_func in strverscmp -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - case $LIBOBJS in - "$ac_func.$ac_objext" | \ - *" $ac_func.$ac_objext" | \ - "$ac_func.$ac_objext "* | \ - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; -esac - -fi -done - - - if test $ac_cv_func_strverscmp = no; then - - : - - fi - - - - -for ac_header in unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -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 -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - - UNISTD_H='' - -else - - UNISTD_H='unistd.h' - -fi - -done - - - - - - - case $LIBOBJS in - "dup-safer.$ac_objext" | \ - *" dup-safer.$ac_objext" | \ - "dup-safer.$ac_objext "* | \ - *" dup-safer.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS dup-safer.$ac_objext" ;; -esac - - case $LIBOBJS in - "fd-safer.$ac_objext" | \ - *" fd-safer.$ac_objext" | \ - "fd-safer.$ac_objext "* | \ - *" fd-safer.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS fd-safer.$ac_objext" ;; -esac - - case $LIBOBJS in - "pipe-safer.$ac_objext" | \ - *" pipe-safer.$ac_objext" | \ - "pipe-safer.$ac_objext "* | \ - *" pipe-safer.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS pipe-safer.$ac_objext" ;; -esac - - - - - - - -cat >>confdefs.h <<\_ACEOF -#define USE_UNLOCKED_IO 1 -_ACEOF - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - - - - - case $LIBOBJS in - "xmalloc.$ac_objext" | \ - *" xmalloc.$ac_objext" | \ - "xmalloc.$ac_objext "* | \ - *" xmalloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS xmalloc.$ac_objext" ;; -esac - - - - : - - - - : - - - - - - - : - - - - -# We use po/Makevars, so we need at least gettext 0.12. - - - 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= - if test "$USE_NLS" = yes; then - if test -n "$YACC"; then - case "$YACC" in - *bison*) - if ($YACC --print-localedir) >/dev/null 2>&1; then - BISON_LOCALEDIR=`$YACC --print-localedir` - fi - ;; - esac - else - if test -n "$BISON"; then - if test "$BISON" != ":"; then - if ($BISON --print-localedir) >/dev/null 2>&1; then - BISON_LOCALEDIR=`$BISON --print-localedir` - fi - fi - fi - fi - - if test -n "$BISON_LOCALEDIR"; then - USER_LINGUAS="${LINGUAS-%UNSET%}" - if test -n "$USER_LINGUAS"; then - BISON_USE_NLS=yes - else - BISON_USE_NLS=no - fi - else - BISON_USE_NLS=no - fi - else - BISON_USE_NLS=no - 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' - - -# 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_VALGRIND+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_VALGRIND="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -VALGRIND=$ac_cv_prog_VALGRIND -if test -n "$VALGRIND"; then - echo "$as_me:$LINENO: result: $VALGRIND" >&5 -echo "${ECHO_T}$VALGRIND" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$VALGRIND" && break -done - -ac_ext=cc -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 -n "$ac_tool_prefix"; then - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CXX" && break -done -test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - - CXX=$ac_ct_CXX -fi - - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C++ compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cxx_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$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 -for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -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= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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/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 -echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$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 - - - - - echo "$as_me:$LINENO: checking whether $CXX builds executables that work" >&5 -echo $ECHO_N "checking whether $CXX builds executables that work... $ECHO_C" >&6 -if test "${bison_cv_cxx_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_ext=cc -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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; 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=$? - 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=$? - 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 - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f 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 -echo "$as_me:$LINENO: result: $bison_cv_cxx_works" >&5 -echo "${ECHO_T}$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] *//'` - - - ac_config_files="$ac_config_files Makefile build-aux/Makefile po/Makefile.in data/Makefile examples/Makefile examples/calc++/Makefile lib/Makefile src/Makefile doc/Makefile" - -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, don't put newlines in cache variables' values. -# 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. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *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 \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!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" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - 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}' - -# 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 - -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_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -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 - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -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 "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -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 "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -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 "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -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 - { { echo "$as_me:$LINENO: error: conditional \"BISON_CXX_WORKS\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -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_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $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 -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; 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 || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# 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 - -# 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 - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - 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 - - ;; - 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 - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - 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=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # 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 before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, 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 - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -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 sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# 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'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by GNU Bison $as_me 2.3, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -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, 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 commands: -$config_commands - -Report bugs to ." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -GNU Bison config.status 2.3 -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -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 - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -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" ;; - - 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 -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS section. -# - -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" -# Capture the value of obsolete ALL_LINGUAS because we need it to compute - # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it - # from automake. - 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 -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "runtime-po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES runtime-po/Makefile.in" ;; - "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" ;; - "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" ;; - "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; - "tests/atconfig" ) CONFIG_COMMANDS="$CONFIG_COMMANDS tests/atconfig" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.hin" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -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_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 to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $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 -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@CYGPATH_W@,$CYGPATH_W,;t t -s,@PACKAGE@,$PACKAGE,;t t -s,@VERSION@,$VERSION,;t t -s,@ACLOCAL@,$ACLOCAL,;t t -s,@AUTOCONF@,$AUTOCONF,;t t -s,@AUTOMAKE@,$AUTOMAKE,;t t -s,@AUTOHEADER@,$AUTOHEADER,;t t -s,@MAKEINFO@,$MAKEINFO,;t t -s,@install_sh@,$install_sh,;t t -s,@STRIP@,$STRIP,;t t -s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t -s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t -s,@mkdir_p@,$mkdir_p,;t t -s,@AWK@,$AWK,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@am__leading_dot@,$am__leading_dot,;t t -s,@AMTAR@,$AMTAR,;t t -s,@am__tar@,$am__tar,;t t -s,@am__untar@,$am__untar,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@DEPDIR@,$DEPDIR,;t t -s,@am__include@,$am__include,;t t -s,@am__quote@,$am__quote,;t t -s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t -s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t -s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t -s,@CCDEPMODE@,$CCDEPMODE,;t t -s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t -s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@WARNING_CFLAGS@,$WARNING_CFLAGS,;t t -s,@WERROR_CFLAGS@,$WERROR_CFLAGS,;t t -s,@WARNING_CXXFLAGS@,$WARNING_CXXFLAGS,;t t -s,@YACC_SCRIPT@,$YACC_SCRIPT,;t t -s,@YACC_LIBRARY@,$YACC_LIBRARY,;t t -s,@LEX@,$LEX,;t t -s,@LEXLIB@,$LEXLIB,;t t -s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t -s,@YACC@,$YACC,;t t -s,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@M4@,$M4,;t t -s,@STDBOOL_H@,$STDBOOL_H,;t t -s,@HAVE__BOOL@,$HAVE__BOOL,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@GETOPT_H@,$GETOPT_H,;t t -s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t -s,@USE_NLS@,$USE_NLS,;t t -s,@MSGFMT@,$MSGFMT,;t t -s,@GMSGFMT@,$GMSGFMT,;t t -s,@XGETTEXT@,$XGETTEXT,;t t -s,@MSGMERGE@,$MSGMERGE,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t -s,@INTL_MACOSX_LIBS@,$INTL_MACOSX_LIBS,;t t -s,@LIBICONV@,$LIBICONV,;t t -s,@LTLIBICONV@,$LTLIBICONV,;t t -s,@INTLLIBS@,$INTLLIBS,;t t -s,@LIBINTL@,$LIBINTL,;t t -s,@LTLIBINTL@,$LTLIBINTL,;t t -s,@POSUB@,$POSUB,;t t -s,@UNISTD_H@,$UNISTD_H,;t t -s,@BISON_LOCALEDIR@,$BISON_LOCALEDIR,;t t -s,@aclocaldir@,$aclocaldir,;t t -s,@VALGRIND@,$VALGRIND,;t t -s,@CXX@,$CXX,;t t -s,@CXXFLAGS@,$CXXFLAGS,;t t -s,@ac_ct_CXX@,$ac_ct_CXX,;t t -s,@CXXDEPMODE@,$CXXDEPMODE,;t t -s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t -s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t -s,@BISON_CXX_WORKS@,$BISON_CXX_WORKS,;t t -s,@BISON_CXX_WORKS_TRUE@,$BISON_CXX_WORKS_TRUE,;t t -s,@BISON_CXX_WORKS_FALSE@,$BISON_CXX_WORKS_FALSE,;t t -s,@AUTOM4TE@,$AUTOM4TE,;t t -s,@GCC@,$GCC,;t t -s,@O0CFLAGS@,$O0CFLAGS,;t t -s,@O0CXXFLAGS@,$O0CXXFLAGS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac - - # 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. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;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,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - - # Run the commands associated with the file. - case $ac_file in - tests/bison ) chmod +x tests/bison ;; - esac -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #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. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # 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. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -# Compute $ac_file's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $ac_file | $ac_file:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || -$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X$ac_file | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'`/stamp-h$_am_stamp_count -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - depfiles ) 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. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`(dirname "$mf") 2>/dev/null || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -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=`(dirname "$file") 2>/dev/null || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p $dirpart/$fdir - else - as_dir=$dirpart/$fdir - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 -echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} - { (exit 1); exit 1; }; }; } - - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - default-1 ) - 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. - eval 'ALL_LINGUAS''=$ALL_LINGUAS_' - POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" - else - # The set of available languages was given in configure.in. - 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 ;; - tests/atconfig ) cat >tests/atconfig <>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# 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 - diff --git a/src/bin/bison/configure.ac b/src/bin/bison/configure.ac deleted file mode 100644 index 7804b023f7..0000000000 --- a/src/bin/bison/configure.ac +++ /dev/null @@ -1,144 +0,0 @@ -# Configure template for GNU Bison. -*-Autoconf-*- -# -# Copyright (C) 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 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 - -# This file uses AC_CONFIG_MACRO_DIR, so we need Autoconf 2.58 or better. -# But Autoconf 2.58 has a bug in the way that it generates tests: it -# puts the wrong absolute path names in the tests. So we need at -# least Autoconf 2.59. -AC_PREREQ(2.59) - -AC_INIT([GNU Bison], [2.3], [bug-bison@gnu.org]) -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. -AM_INIT_AUTOMAKE([1.8 check-news readme-alpha dist-bzip2]) -AC_CONFIG_HEADERS([config.h:config.hin]) - -gl_USE_SYSTEM_EXTENSIONS - -# Checks for the compiler. -AC_PROG_CC -AM_PROG_CC_STDC -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 - BISON_WARNING(-Werror) - AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS]) - WARNING_CFLAGS= - BISON_WARNING(-W) - BISON_WARNING(-Wall) - BISON_WARNING(-Wcast-align) - BISON_WARNING(-Wcast-qual) - BISON_WARNING(-Wformat) - BISON_WARNING(-Wwrite-strings) - AC_SUBST([WARNING_CXXFLAGS], [$WARNING_CFLAGS]) - # The following warnings are not suitable for C++. - BISON_WARNING(-Wbad-function-cast) - BISON_WARNING(-Wmissing-declarations) - BISON_WARNING(-Wmissing-prototypes) - BISON_WARNING(-Wshadow) - BISON_WARNING(-Wstrict-prototypes) - 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.]) - -# Checks for header files. -AC_CHECK_HEADERS_ONCE([locale.h]) -AM_STDBOOL_H - -# Checks for compiler characteristics. -AC_C_INLINE - -# Checks for types. -AC_CHECK_TYPES([uintptr_t]) - -# Checks for library functions. -AC_CHECK_FUNCS_ONCE([setlocale]) -AM_WITH_DMALLOC -BISON_PREREQ_SUBPIPE -BISON_PREREQ_TIMEVAR - -# gnulib and gettext. -GNULIB_AUTOCONF_SNIPPET -# We use po/Makevars, so we need at least gettext 0.12. -AM_GNU_GETTEXT_VERSION([0.12]) -BISON_I18N - -# Internationalized parsers. -AC_CONFIG_FILES([runtime-po/Makefile.in]) -# Autoconf macros for packages using internationalized parsers. -aclocaldir='${datadir}/aclocal' -AC_SUBST([aclocaldir]) - -# 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]) -O0CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]] *//'` -AC_SUBST([O0CFLAGS]) -O0CXXFLAGS=`echo $CXXFLAGS | sed 's/-O[[0-9]] *//'` -AC_SUBST([O0CXXFLAGS]) - -AC_CONFIG_FILES([Makefile - build-aux/Makefile - po/Makefile.in - data/Makefile - examples/Makefile - examples/calc++/Makefile - lib/Makefile src/Makefile doc/Makefile]) -AC_OUTPUT diff --git a/src/bin/bison/data/Jamfile b/src/bin/bison/data/Jamfile deleted file mode 100644 index d10869af10..0000000000 --- a/src/bin/bison/data/Jamfile +++ /dev/null @@ -1,24 +0,0 @@ -SubDir HAIKU_TOP src bin bison data ; - -# TODO: This must be done in HaikuImage. -# MakeLocate c.m4 : $(HAIKU_ETC_DIR) ; -# File c.m4 : c.m4 ; -# LocalClean clean : c.m4 ; -# -# MakeLocate glr.c : $(HAIKU_ETC_DIR) ; -# File glr.c : glr.c ; -# LocalClean clean : glr.c ; -# -# MakeLocate lalr1.cc : $(HAIKU_ETC_DIR) ; -# File lalr1.cc : lalr1.cc ; -# LocalClean clean : lalr1.cc ; -# -# MakeLocate yacc.c : $(HAIKU_ETC_DIR) ; -# File yacc.c : yacc.c ; -# LocalClean clean : yacc.c ; -# -# MakeLocate m4sugar.m4 : [ FDirName $(HAIKU_ETC_DIR) m4sugar ] ; -# File m4sugar.m4 : m4sugar.m4 ; -# LocalClean clean : m4sugar.m4 ; -# -# SEARCH on m4sugar.m4 = [ FDirName $(SUBDIR) m4sugar ] ; diff --git a/src/bin/bison/data/Makefile.am b/src/bin/bison/data/Makefile.am deleted file mode 100644 index 7c4ccf9661..0000000000 --- a/src/bin/bison/data/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -## Copyright (C) 2002, 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 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 - -dist_pkgdata_DATA = README \ - c.m4 yacc.c glr.c \ - c++.m4 location.cc lalr1.cc glr.cc - -m4sugardir = $(pkgdatadir)/m4sugar -dist_m4sugar_DATA = m4sugar/m4sugar.m4 diff --git a/src/bin/bison/data/Makefile.in b/src/bin/bison/data/Makefile.in deleted file mode 100644 index 3a5f561513..0000000000 --- a/src/bin/bison/data/Makefile.in +++ /dev/null @@ -1,412 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 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@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/bison-i18n.m4 \ - $(top_srcdir)/m4/c-working.m4 $(top_srcdir)/m4/cxx.m4 \ - $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ - $(top_srcdir)/m4/dos.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_gl.m4 \ - $(top_srcdir)/m4/gnulib.m4 $(top_srcdir)/m4/hard-locale.m4 \ - $(top_srcdir)/m4/hash.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/inttypes_h_gl.m4 \ - $(top_srcdir)/m4/lib-ld_gl.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix_gl.m4 $(top_srcdir)/m4/m4.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/obstack.m4 $(top_srcdir)/m4/onceonly.m4 \ - $(top_srcdir)/m4/po_gl.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \ - $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \ - $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.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/uintmax_t_gl.m4 \ - $(top_srcdir)/m4/ulonglong_gl.m4 \ - $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.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 = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/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)" -dist_m4sugarDATA_INSTALL = $(INSTALL_DATA) -dist_pkgdataDATA_INSTALL = $(INSTALL_DATA) -DATA = $(dist_m4sugar_DATA) $(dist_pkgdata_DATA) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOM4TE = @AUTOM4TE@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BISON_CXX_WORKS = @BISON_CXX_WORKS@ -BISON_CXX_WORKS_FALSE = @BISON_CXX_WORKS_FALSE@ -BISON_CXX_WORKS_TRUE = @BISON_CXX_WORKS_TRUE@ -BISON_LOCALEDIR = @BISON_LOCALEDIR@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -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@ -EXEEXT = @EXEEXT@ -GCC = @GCC@ -GETOPT_H = @GETOPT_H@ -GMSGFMT = @GMSGFMT@ -HAVE__BOOL = @HAVE__BOOL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -O0CFLAGS = @O0CFLAGS@ -O0CXXFLAGS = @O0CXXFLAGS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STDBOOL_H = @STDBOOL_H@ -STRIP = @STRIP@ -UNISTD_H = @UNISTD_H@ -USE_NLS = @USE_NLS@ -VALGRIND = @VALGRIND@ -VERSION = @VERSION@ -WARNING_CFLAGS = @WARNING_CFLAGS@ -WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ -WERROR_CFLAGS = @WERROR_CFLAGS@ -XGETTEXT = @XGETTEXT@ -YACC = @YACC@ -YACC_LIBRARY = @YACC_LIBRARY@ -YACC_SCRIPT = @YACC_SCRIPT@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -aclocaldir = @aclocaldir@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -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@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -dist_pkgdata_DATA = README \ - c.m4 yacc.c glr.c \ - c++.m4 location.cc lalr1.cc glr.cc - -m4sugardir = $(pkgdatadir)/m4sugar -dist_m4sugar_DATA = m4sugar/m4sugar.m4 -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) --gnu data/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu 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 -uninstall-info-am: -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 -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/m4sugar - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - 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)"; 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-exec-am: - -install-info: install-info-am - -install-man: - -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-info-am - -.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-exec \ - install-exec-am install-info install-info-am install-man \ - 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-info-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/src/bin/bison/data/README b/src/bin/bison/data/README deleted file mode 100644 index 226779178c..0000000000 --- a/src/bin/bison/data/README +++ /dev/null @@ -1,45 +0,0 @@ --*- outline -*- - -This directory contains Bison skeletons: the general shapes of the -different parser kinds, that are specialized for specific grammars by -the bison program. - -Currently, there are only three supported skeletons: - -- 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. It is still very experimental, and not - yet supported. Please, subscribe to bison-patches@gnu.org. - -- glr.c - A Generalized LR C parser based on Bison's LALR(1) tables. - -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. - ------ - -Copyright (C) 2002 Free Software Foundation, Inc. - -This file is part of GNU Bison. - -GNU 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. - -GNU 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. diff --git a/src/bin/bison/data/c++.m4 b/src/bin/bison/data/c++.m4 deleted file mode 100644 index 57aee0ceb0..0000000000 --- a/src/bin/bison/data/c++.m4 +++ /dev/null @@ -1,122 +0,0 @@ -m4_divert(-1) -*- Autoconf -*- - -# C++ skeleton for Bison - -# 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 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 - -m4_include(b4_pkgdatadir/[c.m4]) - -## ---------------- ## -## Default values. ## -## ---------------- ## - -# Default parser class name. -m4_define_default([b4_parser_class_name], [parser]) -m4_define_default([b4_location_type], [location]) -m4_define_default([b4_filename_type], [std::string]) -m4_define_default([b4_namespace], m4_defn([b4_prefix])) - - -# 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/src/bin/bison/data/c.m4 b/src/bin/bison/data/c.m4 deleted file mode 100644 index f10e090114..0000000000 --- a/src/bin/bison/data/c.m4 +++ /dev/null @@ -1,534 +0,0 @@ -m4_divert(-1) -*- Autoconf -*- - -# C M4 Macros for Bison. -# 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 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 - - -## ---------------- ## -## Identification. ## -## ---------------- ## - -# b4_copyright(TITLE, YEARS) -# -------------------------- -m4_define([b4_copyright], -[/* A Bison parser, made by GNU Bison b4_version. */ - -/* $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 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, 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. */]) - - -# b4_identification -# ----------------- -m4_define([b4_identification], -[/* Identify Bison output. */ -[#]define YYBISON 1 - -/* Bison version. */ -[#]define YYBISON_VERSION "b4_version" - -/* Skeleton name. */ -[#]define YYSKELETON_NAME b4_skeleton - -/* Pure parsers. */ -[#]define YYPURE b4_pure_flag - -/* Using locations. */ -[#]define YYLSP_NEEDED b4_locations_flag -]) - - - -## ---------------- ## -## Default values. ## -## ---------------- ## - -m4_define_default([b4_epilogue], []) - - - -## ------------------------ ## -## 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_default([b4_parse_param]) -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_fst($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_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])]) - - -# 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)]) - - -## ------------------ ## -## 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]) # Wheter error are verbose. -b4_define_flag_if([locations]) # Whether locations are tracked. -b4_define_flag_if([pure]) # Whether the interface is pure. - - - -## ------------------------- ## -## 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([$@], [[]], [], -[/* 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([$@], [[]], [], -[/* 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) as enums and #defines. -m4_define([b4_token_enums_defines], -[b4_token_enums($@)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_shiftn(2, $@))) -b4_c_knr_formal_decls(m4_shiftn(2, $@)) -#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_shiftn(2, $@)))[]dnl -]) - - -# b4_c_ansi_formals([DECL1, NAME1], ...) -# -------------------------------------- -# Output the arguments ANSI-C definition. -m4_define([b4_c_ansi_formals], -[m4_case([$@], - [], [void], - [[]], [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_shiftn(2, $@)));[]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_shiftn(2, $@)))[]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_syncline(LINE, FILE) -# ----------------------- -m4_define([b4_syncline], -[b4_flag_if([synclines], [[#]line $1 $2])]) - - - -## -------------- ## -## User actions. ## -## -------------- ## - -# 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/src/bin/bison/data/glr.c b/src/bin/bison/data/glr.c deleted file mode 100644 index b872bf404a..0000000000 --- a/src/bin/bison/data/glr.c +++ /dev/null @@ -1,2616 +0,0 @@ -m4_divert(-1) -*- C -*- - -# GLR skeleton for Bison -# 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 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 - - -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_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 look-ahead, 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 look-ahead, 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(0)dnl -@output @output_parser_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 - -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]) - -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_token_enums(b4_tokens)[ - -/* Copy the first part of user declarations. */ -]b4_pre_prologue[ - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -]m4_ifdef([b4_stype], -[typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ]) -b4_stype -/* Line __line__ of glr.c. */ -b4_syncline([@oline@], [@ofile@]) - YYSTYPE;], -[typedef int YYSTYPE;])[ -# define YYSTYPE_IS_DECLARED 1 -# 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_defines_if([#include @output_header_name@], - [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_post_prologue[ - -]/* Line __line__ of glr.c. */ -b4_syncline([@oline@], [@ofile@]) -[ -#include -#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) \ - ((YYX <= 0) ? YYEOF : \ - (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_actions -/* Line __line__ of glr.c. */ -b4_syncline([@oline@], [@ofile@])[ - 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++) - { - fprintf (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[); - fprintf (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; - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - else - yytoken = YYTRANSLATE (yychar); - 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 look-ahead. */ -/*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; - 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;]])[ - 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 = 1; - yylloc.first_column = yylloc.last_column = 0; -#endif -]) -m4_ifdef([b4_initial_action], [ -m4_pushdef([b4_at_dollar], [yylloc])dnl -m4_pushdef([b4_dollar_dollar], [yylval])dnl - /* User initialization code. */ - b4_initial_action -m4_popdef([b4_dollar_dollar])dnl -m4_popdef([b4_at_dollar])dnl -/* Line __line__ of glr.c. */ -b4_syncline([@oline@], [@ofile@])])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; - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - else - yytoken = YYTRANSLATE (yychar); - yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); - if (*yyconflicts != 0) - break; - if (yyisShiftAction (yyaction)) - { - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - if (yychar != YYEOF) - 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 != YYEOF && 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;]] -)[ 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 */ -#ifdef 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); - fprintf (stderr, " -> "); - } - fprintf (stderr, "%d@@%lu", yys->yylrState, (unsigned long int) yys->yyposn); -} - -static void -yypstates (yyGLRState* yyst) -{ - if (yyst == NULL) - fprintf (stderr, ""); - else - yy_yypstack (yyst); - fprintf (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) - { - fprintf (stderr, "%3lu. ", (unsigned long int) (yyp - yystackp->yyitems)); - if (*(yybool *) yyp) - { - fprintf (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) - fprintf (stderr, ", firstVal: %ld", - (long int) YYINDEX (yyp->yystate.yysemantics.yyfirstVal)); - } - else - { - fprintf (stderr, "Option. rule: %d, state: %ld, next: %ld", - yyp->yyoption.yyrule - 1, - (long int) YYINDEX (yyp->yyoption.yystate), - (long int) YYINDEX (yyp->yyoption.yynext)); - } - fprintf (stderr, "\n"); - } - fprintf (stderr, "Tops:"); - for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) - fprintf (stderr, "%lu: %ld; ", (unsigned long int) yyi, - (long int) YYINDEX (yystackp->yytops.yystates[yyi])); - fprintf (stderr, "\n"); -} -#endif -] - -b4_epilogue -b4_defines_if( -[@output @output_header_name@ -b4_copyright([Skeleton interface for Bison GLR parsers in C], - [2002, 2003, 2004, 2005, 2006]) - -b4_shared_declarations - -extern YYSTYPE b4_prefix[]lval; - -b4_locations_if([b4_pure_if([], -[extern YYLTYPE b4_prefix[]lloc;]) -]) -]) diff --git a/src/bin/bison/data/glr.cc b/src/bin/bison/data/glr.cc deleted file mode 100644 index d07b5a48b8..0000000000 --- a/src/bin/bison/data/glr.cc +++ /dev/null @@ -1,389 +0,0 @@ -m4_divert(-1) -*- C -*- - -# C++ GLR skeleton for Bison -# 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 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 - - -# 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([], - [m4_fatal(b4_skeleton[: using %defines is mandatory])]) - -m4_include(b4_pkgdatadir/[c++.m4]) -m4_include(b4_pkgdatadir/[location.cc]) - - -# 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::b4_parser_class_name::semantic_type *yyvaluep], - [yyvaluep]], - [[const b4_namespace::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], -[/* Line __line__ of glr.cc. */ -b4_syncline([@oline@], [@ofile@]) - -b4_c_ansi_function_decl([yyerror], - [static void], - [[b4_namespace::b4_parser_class_name::location_type *yylocationp], [yylocationp]], - b4_parse_param, - [[const char* msg], [msg]])]) - - -# Define yyerror. -m4_append([b4_epilogue], -[/* Line __line__ of glr.cc. */ -b4_syncline([@oline@], [@ofile@])[ -/*------------------. -| Report an error. | -`------------------*/ - -]b4_c_ansi_function_def([yyerror], - [static void], - [[b4_namespace::b4_parser_class_name::location_type *yylocationp], [yylocationp]], - b4_parse_param, - [[const char* msg], [msg]])[ -{ -]b4_parse_param_use[]dnl -[ yyparser.error (*yylocationp, msg); -} - - -namespace ]b4_namespace[ -{ -]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[) - : yycdebug_ (&std::cerr)]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 /* ! YYDEBUG */ -]m4_popdef([b4_parse_param])dnl -[} // namespace ]b4_namespace[ - -]]) - - -# 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::b4_parser_class_name& yyparser], [[yyparser]]],] -m4_defn([b4_parse_param])))], -[m4_pushdef([b4_parse_param], - [[[[b4_namespace::b4_parser_class_name& yyparser], [[yyparser]]]]]) -]) -m4_include(b4_pkgdatadir/[glr.c]) -m4_popdef([b4_parse_param]) - - -@output @output_header_name@ -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 - -#include -#include - -/* Using locations. */ -#define YYLSP_NEEDED ]b4_locations_flag[ - -namespace ]b4_namespace[ -{ - class position; - class location; -} - -/* Copy the first part of user declarations. */ -]b4_pre_prologue[ - -]/* Line __line__ of glr.cc. */ -b4_syncline([@oline@], [@ofile@])[ - -#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 = YYRHSLOC (Rhs, 1).begin; \ - (Current).end = YYRHSLOC (Rhs, N).end; \ - } \ - else \ - { \ - (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ - } \ - while (/*CONSTCOND*/ 0) -#endif - -namespace ]b4_namespace[ -{ - /// A Bison parser. - class ]b4_parser_class_name[ - { - public: - /// Symbol semantic values. -#ifndef YYSTYPE -]m4_ifdef([b4_stype], -[ union semantic_type -b4_stype -/* Line __line__ of lalr1.cc. */ -b4_syncline([@oline@], [@ofile@]) - ;], -[ typedef int semantic_type;])[ -#else - typedef YYSTYPE semantic_type; -#endif - /// Symbol locations. - typedef ]b4_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: -#endif /* ! YYDEBUG */ - - - /// \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); - - /* Debugging. */ - std::ostream* yycdebug_; -]b4_parse_param_vars[ - }; - -]dnl Redirections for glr.c. -m4_ifset([b4_global_tokens_and_yystype], -[b4_token_defines(b4_tokens)]) -[ -#ifndef YYSTYPE -# define YYSTYPE ]b4_namespace[::]b4_parser_class_name[::semantic_type -#endif -#ifndef YYLTYPE -# define YYLTYPE ]b4_namespace[::]b4_parser_class_name[::location_type -#endif - -} - -#endif /* ! defined PARSER_HEADER_H */] diff --git a/src/bin/bison/data/lalr1.cc b/src/bin/bison/data/lalr1.cc deleted file mode 100644 index abcdcd5d60..0000000000 --- a/src/bin/bison/data/lalr1.cc +++ /dev/null @@ -1,1157 +0,0 @@ -m4_divert(-1) - -# C++ skeleton for Bison - -# 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 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 - -m4_include(b4_pkgdatadir/[c++.m4]) - -# The header is mandatory. -b4_defines_if([], - [m4_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(0)dnl -b4_defines_if( -[@output @output_header_name@ -b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++], - [2002, 2003, 2004, 2005, 2006]) -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 - -#include -#include -#include "stack.hh" - -namespace ]b4_namespace[ -{ - class position; - class location; -} - -/* First part of user declarations. */ -]b4_pre_prologue[ - -]/* Line __line__ of lalr1.cc. */ -b4_syncline([@oline@], [@ofile@])[ - -]dnl Include location.hh here: it might depend on headers included above. -[#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 - -namespace ]b4_namespace[ -{ - - /// A Bison parser. - class ]b4_parser_class_name[ - { - public: - /// Symbol semantic values. -#ifndef YYSTYPE -]m4_ifdef([b4_stype], -[ union semantic_type -b4_stype -/* Line __line__ of lalr1.cc. */ -b4_syncline([@oline@], [@ofile@]) - ;], -[ typedef int semantic_type;])[ -#else - typedef YYSTYPE semantic_type; -#endif - /// Symbol locations. - typedef ]b4_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: - /// 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 look-ahead 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 /* ! YYDEBUG */ - - - /// 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_ (); -#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_; - - /* Debugging. */ - int yydebug_; - std::ostream* yycdebug_; - -]b4_parse_param_vars[ - }; -} - -]m4_ifset([b4_global_tokens_and_yystype], -[b4_token_defines(b4_tokens) - -#ifndef YYSTYPE - /* Redirection for backward compatibility. */ -# define YYSTYPE b4_namespace::b4_parser_class_name::semantic_type -#endif -])[ -#endif /* ! defined PARSER_HEADER_H */] -])dnl -@output @output_parser_name@ -b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++], - [2002, 2003, 2004, 2005, 2006]) -m4_if(b4_prefix, [yy], [], -[ -// Take the name prefix into account. -#define yylex b4_prefix[]lex]) -b4_defines_if([ -#include @output_header_name@])[ - -/* User implementation prologue. */ -]b4_post_prologue[ - -]/* Line __line__ of lalr1.cc. */ -b4_syncline([@oline@], [@ofile@])[ - -#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)) - -/* A pseudo ostream that takes yydebug_ into account. */ -# define YYCDEBUG \ - for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \ - (*yycdebug_) - -/* Enable debugging if requested. */ -#if YYDEBUG - -# 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 YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_REDUCE_PRINT(Rule) -# define YY_STACK_PRINT() - -#endif /* !YYDEBUG */ - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - -namespace ]b4_namespace[ -{ -#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[) - : yydebug_ (false), - yycdebug_ (&std::cerr)]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 /* ! YYDEBUG */ - - 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); - } - - 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; - } - - - int - ]b4_parser_class_name[::parse () - { - /// Look-ahead and look-ahead 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 look-ahead. - semantic_type yylval; - /// Location of the look-ahead. - location_type yylloc; - /// The locations where the error started and ended. - location 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_initial_action -m4_popdef([b4_dollar_dollar])dnl -m4_popdef([b4_at_dollar])dnl - /* Line __line__ of yacc.c. */ -b4_syncline([@oline@], [@ofile@])])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; - goto yybackup; - - /* Backup. */ - yybackup: - - /* Try to take a decision without look-ahead. */ - yyn = yypact_[yystate]; - if (yyn == yypact_ninf_) - goto yydefault; - - /* Read a look-ahead 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; - } - - /* Accept? */ - if (yyn == yyfinal_) - goto yyacceptlab; - - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the token being shifted unless it is eof. */ - if (yychar != yyeof_) - 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_actions - /* Line __line__ of lalr1.cc. */ -b4_syncline([@oline@], [@ofile@])[ - 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 look-ahead 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 look-ahead 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 (); - } - - if (yyn == yyfinal_) - goto yyacceptlab; - - yyerror_range[1] = yylloc; - // Using YYLLOC is tempting, but would change the location of - // the look-ahead. 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 != yyeof_ && 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 << "), "; - /* 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[; - -} // namespace ]b4_namespace[ - -]b4_epilogue -dnl -@output b4_dir_prefix[]stack.hh -b4_copyright([Stack handling for Bison parsers in C++], - [2002, 2003, 2004, 2005, 2006])[ - -#ifndef BISON_STACK_HH -# define BISON_STACK_HH - -#include - -namespace ]b4_namespace[ -{ - 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_; - }; -} - -#endif // not BISON_STACK_HH] -m4_divert(-1) diff --git a/src/bin/bison/data/location.cc b/src/bin/bison/data/location.cc deleted file mode 100644 index 869320e799..0000000000 --- a/src/bin/bison/data/location.cc +++ /dev/null @@ -1,253 +0,0 @@ -m4_divert(-1) - -# C++ skeleton for Bison - -# 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 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 - -# We do want M4 expansion after # for CPP macros. -m4_changecom() -m4_divert(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[::position class. - */ - -#ifndef BISON_POSITION_HH -# define BISON_POSITION_HH - -# include -# include - -namespace ]b4_namespace[ -{ - /// Abstract a position. - class position - { - public: -]m4_ifdef([b4_location_constructors], [ - /// Construct a position. - position () - : filename (0), line (1), column (0) - { - } - -])[ - /// Initialization. - inline void initialize (]b4_filename_type[* fn) - { - filename = fn; - line = 1; - column = 0; - } - - /** \name Line and Column related manipulators - ** \{ */ - public: - /// (line related) Advance to the COUNT next lines. - inline void lines (int count = 1) - { - column = 0; - line += count; - } - - /// (column related) Advance to the COUNT next columns. - inline void columns (int count = 1) - { - int leftmost = 0; - int current = column; - if (leftmost <= current + count) - column += count; - else - column = 0; - } - /** \} */ - - public: - /// File name to which this position refers. - ]b4_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; - } - - /** \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; - } - -} -#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[::location class. - */ - -#ifndef BISON_LOCATION_HH -# define BISON_LOCATION_HH - -# include -# include -# include "position.hh" - -namespace ]b4_namespace[ -{ - - /// Abstract a location. - class location - { - public: -]m4_ifdef([b4_location_constructors], [ - /// Construct a location. - location () - : begin (), end () - { - } - -])[ - /// Initialization. - inline void initialize (]b4_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; - } - - /** \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; - } - -} - -#endif // not BISON_LOCATION_HH] -m4_divert(-1) -m4_changecom([#]) diff --git a/src/bin/bison/data/m4sugar/m4sugar.m4 b/src/bin/bison/data/m4sugar/m4sugar.m4 deleted file mode 100644 index 225b7c7a54..0000000000 --- a/src/bin/bison/data/m4sugar/m4sugar.m4 +++ /dev/null @@ -1,1776 +0,0 @@ -divert(-1)# -*- Autoconf -*- -# This file is part of Autoconf. -# Base M4 layer. -# Requires GNU M4. -# -# Copyright (C) 1999, 2000, 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 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, 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 will certainly prefer to see `to'. -m4_define([m4_copy], -[m4_define([$2], m4_defn([$1]))]) - - -# m4_rename(SRC, DST) -# ------------------- -# Rename the macro SRC as DST. -m4_define([m4_rename], -[m4_copy([$1], [$2])m4_undefine([$1])]) - - -# m4_rename_m4(MACRO-NAME) -# ------------------------ -# Rename MACRO-NAME as m4_MACRO-NAME. -m4_define([m4_rename_m4], -[m4_rename([$1], [m4_$1])]) - - -# m4_copy_unm4(m4_MACRO-NAME) -# --------------------------- -# Copy m4_MACRO-NAME as 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'. -m4_rename_m4([builtin]) -m4_rename_m4([changecom]) -m4_rename_m4([changequote]) -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_rename_m4([ifdef]) -m4_rename([ifelse], [m4_if]) -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_rename([m4wrap], [m4_wrap]) -m4_rename_m4([maketemp]) -m4_rename([patsubst], [m4_bpatsubst]) -m4_undefine([popdef]) -m4_rename_m4([pushdef]) -m4_rename([regexp], [m4_bregexp]) -m4_rename_m4([shift]) -m4_undefine([sinclude]) -m4_rename_m4([substr]) -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". -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 -# quite nobody quotes 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) -# ---------------- -# As the builtin include, but warns against multiple inclusions. -m4_define([m4_include], -[m4_include_unique([$1])dnl -m4_builtin([include], [$1])]) - - -# m4_sinclude(FILE) -# ----------------- -# As 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 a variation of `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. -m4_define([m4_case], -[m4_if([$#], 0, [], - [$#], 1, [], - [$#], 2, [$2], - [$1], [$2], [$3], - [$0([$1], m4_shiftn(3, $@))])]) - - -# 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. -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_shiftn(3, $@))], - [$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_map(MACRO, LIST) -# ------------------- -# Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements -# of LIST (which can be lists themselves, for multiple arguments MACROs). -m4_define([m4_fst], [$1]) -m4_define([m4_map], -[m4_if([$2], [[]], [], - [_m4_map([$1], [$2])])]) -m4_define([_m4_map], -[m4_ifval([$2], - [$1(m4_fst($2))[]_m4_map([$1], m4_cdr($2))])]) - - -# m4_map_sep(MACRO, SEPARATOR, LIST) -# ---------------------------------- -# Invoke MACRO($1), SEPARATOR, MACRO($2), ..., MACRO($N) where $1, $2... $N -# are the elements of LIST (which can be lists themselves, for multiple -# arguments MACROs). -m4_define([m4_map_sep], -[m4_if([$3], [[]], [], - [$1(m4_fst($3))[]_m4_map([$2[]$1], m4_cdr($3))])]) - - -## ---------------------------------------- ## -## 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. -m4_define([m4_bpatsubsts], -[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], - [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])], - [$#], 2, [m4_builtin([patsubst], $@)], - [$0(m4_builtin([patsubst], [[$1]], [$2], [$3]), - m4_shiftn(3, $@))])]) - - - -# 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. -m4_define([m4_do], -[m4_if($#, 0, [], - $#, 1, [$1], - [$1[]m4_do(m4_shift($@))])]) - - -# 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. -m4_define([m4_default], -[m4_ifval([$1], [$1], [$2])]) - - -# m4_defn(NAME) -# ------------- -# Unlike to the original, don't tolerate popping something which is -# undefined. -m4_define([m4_defn], -[m4_ifndef([$1], - [m4_fatal([$0: undefined macro: $1])])dnl -m4_builtin([defn], $@)]) - - -# _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) -# --------------- -# Unlike to the original, don't tolerate popping something which is -# undefined. -m4_define([m4_popdef], -[m4_ifndef([$1], - [m4_fatal([$0: undefined macro: $1])])dnl -m4_builtin([popdef], $@)]) - - -# m4_quote(ARGS) -# -------------- -# Return ARGS as a single 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_define([m4_dquote], [[$@]]) - - -# m4_noquote(STRING) -# ------------------ -# Return the result of ignoring all quotes in STRING and invoking the -# macros it contains. Amongst other things useful for enabling macro -# invocations inside strings with [] blocks (for instance regexps and -# help-strings). -m4_define([m4_noquote], -[m4_changequote(-=<{,}>=-)$1-=<{}>=-m4_changequote([,])]) - - -# m4_shiftn(N, ...) -# ----------------- -# Returns ... shifted N times. Useful for recursive "varargs" constructs. -m4_define([m4_shiftn], -[m4_assert(($1 >= 0) && ($# > $1))dnl -_m4_shiftn($@)]) - -m4_define([_m4_shiftn], -[m4_if([$1], 0, - [m4_shift($@)], - [_m4_shiftn(m4_eval([$1]-1), m4_shift(m4_shift($@)))])]) - - -# m4_undefine(NAME) -# ----------------- -# Unlike to the original, don't tolerate undefining something which is -# undefined. -m4_define([m4_undefine], -[m4_ifndef([$1], - [m4_fatal([$0: undefined macro: $1])])dnl -m4_builtin([undefine], $@)]) - - -## -------------------------- ## -## 7. Implementing m4 loops. ## -## -------------------------- ## - - -# m4_for(VARIABLE, FIRST, LAST, [STEP = +/-1], EXPRESSION) -# -------------------------------------------------------- -# Expand EXPRESSION defining VARIABLE to FROM, FROM + 1, ..., TO. -# Both limits are included, and bounds are checked for consistency. -m4_define([m4_for], -[m4_case(m4_sign(m4_eval($3 - $2)), - 1, [m4_assert(m4_sign(m4_default($4, 1)) == 1)], - -1, [m4_assert(m4_sign(m4_default($4, -1)) == -1)])dnl -m4_pushdef([$1], [$2])dnl -m4_if(m4_eval([$3 > $2]), 1, - [_m4_for([$1], [$3], m4_default([$4], 1), [$5])], - [_m4_for([$1], [$3], m4_default([$4], -1), [$5])])dnl -m4_popdef([$1])]) - - -# _m4_for(VARIABLE, FIRST, LAST, STEP, EXPRESSION) -# ------------------------------------------------ -# Core of the loop, no consistency checks. -m4_define([_m4_for], -[$4[]dnl -m4_if($1, [$2], [], - [m4_define([$1], m4_eval($1+[$3]))_m4_for([$1], [$2], [$3], [$4])])]) - - -# Implementing `foreach' loops in m4 is much more tricky than it may -# seem. Actually, the example of a `foreach' loop in the m4 -# documentation is wrong: it does not quote the arguments properly, -# which leads to undesirable expansions. -# -# The example in the documentation is: -# -# | # 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], -# | (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], -# | [(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], -# | [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 quite satisfactory -# 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- -m4_define([m4_foreach], -[m4_pushdef([$1])_m4_foreach($@)m4_popdef([$1])]) - -m4_define([_m4_foreach], -[m4_ifval([$2], - [m4_define([$1], m4_car($2))$3[]dnl -_m4_foreach([$1], m4_cdr($2), [$3])])]) - - -# 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])]) - - - -## --------------------------- ## -## 8. 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) - - -# _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]))dnl -]) - - -# 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]))dnl -]) - - -# 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])dnl -m4_popdef([_m4_divert_diversion])dnl -m4_builtin([divert], - m4_ifdef([_m4_divert_diversion], - [_m4_divert(m4_defn([_m4_divert_diversion]))], - -1))dnl -]) - - -# 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])dnl -$2 -m4_divert_pop([$1])dnl -]) - - -# m4_divert_once(DIVERSION-NAME, CONTENT) -# --------------------------------------- -# Output once CONTENT into DIVERSION-NAME (which may be a number -# actually). 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. -m4_define([m4_undivert], -[m4_builtin([undivert], _m4_divert([$1]))]) - - -## -------------------------------------------- ## -## 8. 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 using 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 level 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, uses 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 macro are expanded. (The bug above can -# indeed be described as: a macro has been AC_PROVIDE'd, but it is -# emitted after: the lack of correlation between emission and expansion -# order is guilty). -# -# How to do that? You keeping 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. -m4_define([_m4_defun_pro], -[m4_ifndef([m4_expansion_stack], [_m4_defun_pro_outer[]])dnl -m4_expansion_stack_push(m4_defn([m4_location($1)])[: $1 is expanded from...])dnl -m4_pushdef([_m4_expanding($1)])dnl -]) - -m4_define([_m4_defun_pro_outer], -[m4_copy([_m4_divert_diversion], [_m4_divert_dump])dnl -m4_divert_push([GROW])dnl -]) - -# _m4_defun_epi(MACRO-NAME) -# ------------------------- -# The Epilogue for Autoconf macros. MACRO-NAME only helps tracing -# the PRO/EPI pairs. -m4_define([_m4_defun_epi], -[m4_popdef([_m4_expanding($1)])dnl -m4_expansion_stack_pop()dnl -m4_ifndef([m4_expansion_stack], [_m4_defun_epi_outer[]])dnl -m4_provide([$1])dnl -]) - -m4_define([_m4_defun_epi_outer], -[m4_undefine([_m4_divert_dump])dnl -m4_divert_pop([GROW])dnl -m4_undivert([GROW])dnl -]) - - -# 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 extended regular expression ERE -# should be seen in the output but if... -m4_define([m4_pattern_forbid], []) - - -# m4_pattern_allow(ERE) -# --------------------- -# ... but if that token matches the extended regular expression ERE. -# Both used via traces. -m4_define([m4_pattern_allow], []) - - -## ----------------------------- ## -## Dependencies between macros. ## -## ----------------------------- ## - - -# m4_before(THIS-MACRO-NAME, CALLED-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)'. -m4_define([m4_require], -[m4_ifdef([_m4_expanding($1)], - [m4_fatal([$0: circular dependency of $1])])dnl -m4_ifndef([_m4_divert_dump], - [m4_fatal([$0($1): cannot be used outside of an m4_defun'd macro])])dnl -m4_provide_if([$1], - [], - [_m4_require_call([$1], [$2])])dnl -]) - - -# _m4_require_call(BODY-TO-EXPAND) -# -------------------------------- -# If m4_require decides to expand the body, it calls this macro. -m4_define([_m4_require_call], -[m4_define([_m4_divert_grow], m4_decr(_m4_divert_grow))dnl -m4_divert_push(_m4_divert_grow)dnl -m4_default([$2], [$1]) -m4_provide_if([$1], - [], - [m4_warn([syntax], - [$1 is m4_require'd but not m4_defun'd])])dnl -m4_divert(m4_defn([_m4_divert_dump]))dnl -m4_undivert(_m4_divert_grow)dnl -m4_divert_pop(_m4_divert_grow)dnl -m4_define([_m4_divert_grow], m4_incr(_m4_divert_grow))dnl -]) - - -# _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])]) - - -## -------------------- ## -## 9. 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_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_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 lowercase and uppercase strings. -m4_define([m4_tolower], -[m4_translit([$1], m4_defn([m4_cr_LETTERS]), m4_defn([m4_cr_letters]))]) -m4_define([m4_toupper], -[m4_translit([$1], m4_defn([m4_cr_letters]), 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. -# -# 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 - -m4_define([m4_split], -[m4_ifval([$1], [_m4_split($@)])]) - -m4_define([_m4_split], -[m4_changequote(``, '')dnl -[dnl Can't use m4_default here instead of m4_if, because m4_default uses -dnl [ and ] as quotes. -m4_bpatsubst(````$1'''', - m4_if(``$2'',, ``[ ]+'', ``$2''), - ``], ['')]dnl -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 -m4_define([m4_flatten], -[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 -# -# Because we want to preserve active symbols, STRING must be double-quoted. -# -# Then notice the 2 last patterns: they are in charge of removing the -# leading/trailing spaces. Why not just `[^ ]'? Because they are -# applied to doubly quoted strings, i.e. more or less [[STRING]]. So -# if there is a leading space in STRING, then it is the *third* -# character, since there are two leading `['; equally for the last pattern. -m4_define([m4_strip], -[m4_bpatsubsts([[$1]], - [[ ]+], [ ], - [^\(..\) ], [\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. -m4_defun([m4_join], -[m4_case([$#], - [1], [], - [2], [[$2]], - [[$2][$1]$0([$1], m4_shiftn(2, $@))])]) - - - -# 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'. -# -# This macro is robust to active symbols. It can be used to grow -# strings. -# -# | m4_define(active, ACTIVE) -# | m4_append([sentence], [This is an]) -# | m4_append([sentence], [ active ]) -# | m4_append([sentence], [symbol.]) -# | 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) -# | m4_append([hooks], [m4_define([act1], [act2])]) -# | m4_append([hooks], [m4_define([act2], [active])]) -# | m4_undefine([active]) -# | act1 -# | hooks -# | act1 -# => act1 -# => -# => active -m4_define([m4_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])$3])[$2])]) - -# m4_prepend(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------- -# Same, but prepend. -m4_define([m4_prepend], -[m4_define([$1], - [$2]m4_ifdef([$1], [$3[]m4_defn([$1])]))]) - -# m4_append_uniq(MACRO-NAME, STRING, [SEPARATOR]) -# ----------------------------------------------- -# As `m4_append', but append only if not yet present. -m4_define([m4_append_uniq], -[m4_ifdef([$1], - [m4_bmatch([$3]m4_defn([$1])[$3], m4_re_escape([$3$2$3]), [], - [m4_append($@)])], - [m4_append($@)])]) - - -# 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. -# -# 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? -# -# more important: -# FIXME: handle quadrigraphs correctly, both in TEXT and in FIRST_PREFIX. -# -# This macro does not leave a trailing space behind the last word, -# what complicates it a bit. The algorithm is stupid 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. -m4_define([m4_text_wrap], -[m4_pushdef([m4_Prefix], [$2])dnl -m4_pushdef([m4_Prefix1], m4_default([$3], [m4_Prefix]))dnl -m4_pushdef([m4_Width], m4_default([$4], 79))dnl -m4_pushdef([m4_Cursor], m4_len(m4_Prefix1))dnl -m4_pushdef([m4_Separator], [])dnl -m4_Prefix1[]dnl -m4_if(m4_eval(m4_Cursor > m4_len(m4_Prefix)), - 1, [m4_define([m4_Cursor], m4_len(m4_Prefix)) -m4_Prefix])[]dnl -m4_foreach_w([m4_Word], [$1], -[m4_define([m4_Cursor], m4_eval(m4_Cursor + m4_len(m4_defn([m4_Word])) + 1))dnl -dnl New line if too long, else insert a space unless it is the first -dnl of the words. -m4_if(m4_eval(m4_Cursor > m4_Width), - 1, [m4_define([m4_Cursor], - m4_eval(m4_len(m4_Prefix) + m4_len(m4_defn([m4_Word])) + 1))] -m4_Prefix, - [m4_Separator])[]dnl -m4_defn([m4_Word])[]dnl -m4_define([m4_Separator], [ ])])dnl -m4_popdef([m4_Separator])dnl -m4_popdef([m4_Cursor])dnl -m4_popdef([m4_Width])dnl -m4_popdef([m4_Prefix1])dnl -m4_popdef([m4_Prefix])dnl -]) - - -# m4_text_box(MESSAGE, [FRAME-CHARACTER = `-']) -# --------------------------------------------- -m4_define([m4_text_box], -[@%:@@%:@ m4_bpatsubst([$1], [.], m4_if([$2], [], [[-]], [[$2]])) @%:@@%:@ -@%:@@%:@ $1 @%:@@%:@ -@%:@@%:@ m4_bpatsubst([$1], [.], m4_if([$2], [], [[-]], [[$2]])) @%:@@%:@[]dnl -]) - - -# m4_qlen(STRING) -# --------------- -# Expands to the length of STRING after autom4te converts all quadrigraphs. -m4_define([m4_qlen], -[m4_len(m4_bpatsubsts([[$1]], [@\(<:\|:>\|S|\|%:\)@], [P], [@&t@]))]) - - -# 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]))]) - - - -## ----------------------- ## -## 10. Number processing. ## -## ----------------------- ## - -# m4_sign(A) -# ---------- -# -# The sign of the integer A. -m4_define([m4_sign], -[m4_bmatch([$1], - [^-], -1, - [^0+], 0, - 1)]) - -# m4_cmp(A, B) -# ------------ -# -# Compare two integers. -# A < B -> -1 -# A = B -> 0 -# A > B -> 1 -m4_define([m4_cmp], -[m4_sign(m4_eval([$1 - $2]))]) - - -# m4_list_cmp(A, B) -# ----------------- -# -# Compare the two lists of integers 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([m4_list_cmp], -[m4_if([$1$2], [()()], 0, - [$1], [()], [$0((0), [$2])], - [$2], [()], [$0([$1], (0))], - [m4_case(m4_cmp(m4_car$1, m4_car$2), - -1, -1, - 1, 1, - 0, [$0((m4_shift$1), (m4_shift$2))])])]) - - - -## ------------------------ ## -## 11. Version processing. ## -## ------------------------ ## - - -# m4_version_unletter(VERSION) -# ---------------------------- -# Normalize beta version numbers with letters to numbers only for comparison. -# -# Nl -> (N+1).-1.(l#) -# -#i.e., 2.14a -> 2.15.-1.1, 2.14b -> 2.15.-1.2, etc. -# This macro is absolutely not robust to active macro, it expects -# reasonable version numbers and is valid up to `z', no double letters. -m4_define([m4_version_unletter], -[m4_translit(m4_bpatsubsts([$1], - [\([0-9]+\)\([abcdefghi]\)], - [m4_eval(\1 + 1).-1.\2], - [\([0-9]+\)\([jklmnopqrs]\)], - [m4_eval(\1 + 1).-1.1\2], - [\([0-9]+\)\([tuvwxyz]\)], - [m4_eval(\1 + 1).-1.2\2]), - [abcdefghijklmnopqrstuvwxyz], - [12345678901234567890123456])]) - - -# 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 > -m4_define([m4_version_compare], -[m4_list_cmp((m4_split(m4_version_unletter([$1]), [\.])), - (m4_split(m4_version_unletter([$2]), [\.])))]) - - -# m4_PACKAGE_NAME -# m4_PACKAGE_TARNAME -# m4_PACKAGE_VERSION -# m4_PACKAGE_STRING -# m4_PACKAGE_BUGREPORT -# -------------------- -#m4_include([m4sugar/version.m4]) # This is needed for Autoconf, but not Bison. - - -# m4_version_prereq(VERSION, [IF-OK], [IF-NOT = FAIL]) -# ---------------------------------------------------- -# Check this Autoconf version against VERSION. -m4_define([m4_version_prereq], -[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), -1, - [m4_default([$3], - [m4_fatal([Autoconf version $1 or higher is required], - 63)])], - [$2])[]dnl -]) - - - -## ------------------- ## -## 12. 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 that 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])])]) - - - -## ------------------------ ## -## 13. Setting M4sugar up. ## -## ------------------------ ## - - -# m4_init -# ------- -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$]) - -# Check the divert push/pop perfect balance. -m4_wrap([m4_ifdef([_m4_divert_diversion], - [m4_fatal([$0: unbalanced m4_divert_push:]_m4_divert_n_stack)])[]]) - -m4_divert_push([KILL]) -m4_wrap([m4_divert_pop([KILL])[]]) -]) diff --git a/src/bin/bison/data/yacc.c b/src/bin/bison/data/yacc.c deleted file mode 100644 index 1e8fa56952..0000000000 --- a/src/bin/bison/data/yacc.c +++ /dev/null @@ -1,1529 +0,0 @@ -m4_divert(-1) -*- C -*- - -# Yacc compatible skeleton for Bison - -# 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 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 - -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_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(0)dnl -@output @output_parser_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 -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 -b4_locations_if([#define yylloc b4_prefix[]lloc])])[ - -]b4_token_enums_defines(b4_tokens)[ - -/* Copy the first part of user declarations. */ -]b4_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 - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -]m4_ifdef([b4_stype], -[typedef union[]m4_bregexp(b4_stype, [^{], [ YYSTYPE]) -b4_stype -/* Line __line__ of yacc.c. */ -b4_syncline([@oline@], [@ofile@]) - YYSTYPE;], -[typedef int YYSTYPE;])[ -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 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 -])[ - -/* Copy the second part of user declarations. */ -]b4_post_prologue - -/* Line __line__ of yacc.c. */ -b4_syncline([@oline@], [@ofile@])[ - -#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 i], [i]])[ -{ - return i; -} -#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 && ]b4_c_modern[ -# 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 && ]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; - YYSTYPE yyvs; - ]b4_locations_if([ YYLTYPE yyls; -])dnl -[}; - -/* 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) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - 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 *bottom], [bottom]], - [[yytype_int16 *top], [top]])[ -{ - YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); - 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++) - { - fprintf (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[); - fprintf (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])[ - - -/* 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_parser_variables -# --------------------------- -# Declare the variables that are global, or local to YYPARSE if -# pure-parser. -m4_define([b4_declare_parser_variables], -[/* The look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs;b4_locations_if([ -/* Location data for the look-ahead symbol. */ -YYLTYPE yylloc;]) -]) -m4_divert_pop([KILL])dnl# ====================== End of M4 code. - -b4_pure_if([], - [b4_declare_parser_variables]) - - -/*----------. -| yyparse. | -`----------*/ - -#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_parser_variables])[ - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three 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 = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - -]b4_locations_if( -[[ /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2];]])[ - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)]b4_locations_if([, yylsp -= (N)])[) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; -]b4_locations_if([ YYLTYPE yyloc;])[ - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - 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 = 1; - yylloc.first_column = yylloc.last_column = 0; -#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_initial_action -m4_popdef([b4_dollar_dollar])dnl -m4_popdef([b4_at_dollar])dnl -/* Line __line__ of yacc.c. */ -b4_syncline([@oline@], [@ofile@]) -])dnl -m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval; -]])dnl -m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc; -]])dnl -[ 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); - YYSTACK_RELOCATE (yyvs); -]b4_locations_if([ YYSTACK_RELOCATE (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)); - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a look-ahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead 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; - } - - if (yyn == YYFINAL) - YYACCEPT; - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - 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_actions -/* Line __line__ of yacc.c. */ -b4_syncline([@oline@], [@ofile@])[ - 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 look-ahead 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 look-ahead 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); - } - - if (yyn == YYFINAL) - YYACCEPT; - - *++yyvsp = yylval; -]b4_locations_if([[ - yyerror_range[1] = yylloc; - /* Using YYLLOC is tempting, but would change the location of - the look-ahead. 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; - -#ifndef yyoverflow -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (]b4_yyerror_args[YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEOF && 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 -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - /* Make sure YYID is used. */ - return YYID (yyresult); -]} - - -b4_epilogue -b4_defines_if( -[@output @output_header_name@ -b4_copyright([Skeleton interface for Bison's Yacc-like parsers in C],dnl ' - [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006]) - -b4_token_enums_defines(b4_tokens) - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -m4_ifdef([b4_stype], -[typedef union[]m4_bregexp(b4_stype, [^{], [ YYSTYPE]) -b4_stype -/* Line __line__ of yacc.c. */ -b4_syncline([@oline@], [@ofile@]) - YYSTYPE;], -[typedef int YYSTYPE;]) -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 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 -])dnl b4_defines_if diff --git a/src/bin/bison/doc/Makefile.am b/src/bin/bison/doc/Makefile.am deleted file mode 100644 index 2466b26af8..0000000000 --- a/src/bin/bison/doc/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -## Process this file with automake to produce Makefile.in -*-Makefile-*- -## Copyright (C) 2001, 2002, 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 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 - -AM_MAKEINFOFLAGS = --no-split -info_TEXINFOS = bison.texinfo -man_MANS = bison.1 -bison_TEXINFOS = gpl.texi fdl.texi - -EXTRA_DIST = bison.1 refcard.tex - -CLEANFILES = refcard.dvi refcard.log refcard.ps bison.fns - -clean-local: - rm -rf *.t2d - -refcard.dvi: refcard.tex - tex refcard.tex - -refcard.ps: refcard.dvi diff --git a/src/bin/bison/doc/Makefile.in b/src/bin/bison/doc/Makefile.in deleted file mode 100644 index 6c87d7b8b3..0000000000 --- a/src/bin/bison/doc/Makefile.in +++ /dev/null @@ -1,597 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 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@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/stamp-vti \ - $(srcdir)/version.texi -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/bison-i18n.m4 \ - $(top_srcdir)/m4/c-working.m4 $(top_srcdir)/m4/cxx.m4 \ - $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ - $(top_srcdir)/m4/dos.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_gl.m4 \ - $(top_srcdir)/m4/gnulib.m4 $(top_srcdir)/m4/hard-locale.m4 \ - $(top_srcdir)/m4/hash.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/inttypes_h_gl.m4 \ - $(top_srcdir)/m4/lib-ld_gl.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix_gl.m4 $(top_srcdir)/m4/m4.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/obstack.m4 $(top_srcdir)/m4/onceonly.m4 \ - $(top_srcdir)/m4/po_gl.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \ - $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \ - $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.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/uintmax_t_gl.m4 \ - $(top_srcdir)/m4/ulonglong_gl.m4 \ - $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.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 = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -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)" -man1dir = $(mandir)/man1 -NROFF = nroff -MANS = $(man_MANS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOM4TE = @AUTOM4TE@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BISON_CXX_WORKS = @BISON_CXX_WORKS@ -BISON_CXX_WORKS_FALSE = @BISON_CXX_WORKS_FALSE@ -BISON_CXX_WORKS_TRUE = @BISON_CXX_WORKS_TRUE@ -BISON_LOCALEDIR = @BISON_LOCALEDIR@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -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@ -EXEEXT = @EXEEXT@ -GCC = @GCC@ -GETOPT_H = @GETOPT_H@ -GMSGFMT = @GMSGFMT@ -HAVE__BOOL = @HAVE__BOOL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -O0CFLAGS = @O0CFLAGS@ -O0CXXFLAGS = @O0CXXFLAGS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STDBOOL_H = @STDBOOL_H@ -STRIP = @STRIP@ -UNISTD_H = @UNISTD_H@ -USE_NLS = @USE_NLS@ -VALGRIND = @VALGRIND@ -VERSION = @VERSION@ -WARNING_CFLAGS = @WARNING_CFLAGS@ -WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ -WERROR_CFLAGS = @WERROR_CFLAGS@ -XGETTEXT = @XGETTEXT@ -YACC = @YACC@ -YACC_LIBRARY = @YACC_LIBRARY@ -YACC_SCRIPT = @YACC_SCRIPT@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -aclocaldir = @aclocaldir@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -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@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -AM_MAKEINFOFLAGS = --no-split -info_TEXINFOS = bison.texinfo -man_MANS = bison.1 -bison_TEXINFOS = gpl.texi fdl.texi -EXTRA_DIST = bison.1 refcard.tex -CLEANFILES = refcard.dvi refcard.log refcard.ps bison.fns -all: all-am - -.SUFFIXES: -.SUFFIXES: .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) --gnu doc/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu 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 - -.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-info-am: - @$(PRE_UNINSTALL) - @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)' --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 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 - -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; \ - for file in $$d/$$base*; do \ - relfile=`expr "$$file" : "$$d/\(.*\)"`; \ - test -f $(distdir)/$$relfile || \ - cp -p $$file $(distdir)/$$relfile; \ - 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)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - 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: - -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." -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) - -info: info-am - -info-am: $(INFO_DEPS) - -install-data-am: install-info-am install-man - -install-exec-am: - -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 - -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-info-am uninstall-man - -uninstall-man: uninstall-man1 - -.PHONY: all all-am check check-am clean clean-generic clean-local \ - dist-info distclean distclean-generic distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-man1 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-info-am uninstall-man \ - uninstall-man1 - - -clean-local: - rm -rf *.t2d - -refcard.dvi: refcard.tex - tex refcard.tex - -refcard.ps: refcard.dvi -# 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/bin/bison/doc/bison.1 b/src/bin/bison/doc/bison.1 deleted file mode 100644 index 5e1d962d8b..0000000000 --- a/src/bin/bison/doc/bison.1 +++ /dev/null @@ -1,369 +0,0 @@ -.TH BISON 1 local -.SH NAME -bison \- GNU Project parser generator (yacc replacement) -.SH SYNOPSIS -.B bison -[ -.BI \-b " file-prefix" -] [ -.BI \-\-file-prefix= file-prefix -] [ -.B \-d -] [ -.BI \-\-defines= defines-file -] [ -.B \-g -] [ -.BI \-\-graph= graph-file -] [ -.B \-k -] [ -.B \-\-token-table -] [ -.B \-l -] [ -.B \-\-no-lines -] [ -.B \-n -] [ -.B \-\-no-parser -] [ -.BI \-o " outfile" -] [ -.BI \-\-output-file= outfile -] [ -.BI \-p " prefix" -] [ -.BI \-\-name-prefix= prefix -] [ -.B \-t -] [ -.B \-\-debug -] [ -.B \-v -] [ -.B \-\-verbose -] [ -.B \-V -] [ -.B \-\-version -] [ -.B \-y -] [ -.B \-\-yacc -] [ -.B \-h -] [ -.B \-\-help -] [ -.B \-\-fixed-output-files -] -file -.br -.B yacc -[ -.I "similar options and operands" -] -.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 = . -.SS OPTIONS -.TP -.BI \-b " file-prefix" -.br -.ns -.TP -.BI \-\-file-prefix= file-prefix -Specify a prefix to use for all -.I bison -output file names. The names are -chosen as if the input file were named -\fIfile-prefix\fP\fB.c\fP. -.TP -.B \-d -.br -.ns -Write an extra output file containing macro definitions for the token -type names defined in the grammar and the semantic value type -.BR YYSTYPE , -as well as a few -.B extern -variable declarations. -.sp -If the parser output file is named -.IB name .c -then this file -is named -\fIname\fP\fB.h\fP. -.sp -This output file is essential if you wish to put the definition of -.B yylex -in a separate source file, because -.B yylex -needs to be able to refer to token type codes and the variable -.BR yylval . -.TP -.BI \-\-defines= defines-file -The behavior of -.B \-\-defines -is the same than -.B \-d -option. -The only difference is that it has an optional argument which is -the name of the output filename. -.TP -.BI \-g -.br -.ns -Output a VCG definition of the LALR(1) grammar automaton computed by -Bison. If the grammar file is -.BR foo.y -, the VCG output file will be -.BR foo.vcg . -.TP -.BI \-\-graph= graph-file -The behavior of -.BI \-\-graph -is the same than -.BI \-g -option. The only difference is that it has an optional argument which -is the name of the output graph filename. -.TP -.B \-k -.br -.ns -.TP -.B \-\-token-table -This switch causes the -.IB name .tab.c -output to include a list of -token names in order by their token numbers; this is defined in the array -.IR yytname . -Also generated -are #defines for -.IR YYNTOKENS , -.IR YYNNTS , -.IR YYNRULES , -and -.IR YYNSTATES . -.TP -.B \-l -.br -.ns -.TP -.B \-\-no-lines -Don't put any -.B #line -preprocessor commands in the parser file. -Ordinarily -.I 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 an independent source file in its own right. -.TP -.B \-n -.br -.ns -.TP -.B \-\-no-parser -Do not generate the parser code into the output; generate only -declarations. The generated -.IB name .tab.c -file will have only -constant declarations. In addition, a -.IB name .act -file is -generated containing a switch statement body containing all the -translated actions. -.TP -.BI \-o " outfile" -.br -.ns -.TP -.BI \-\-output-file= outfile -Specify the name -.I outfile -for the parser file. -.sp -The other output files' names are constructed from -.I outfile -as described under the -.B \-v -and -.B \-d -switches. -.TP -.BI \-p " prefix" -.br -.ns -.TP -.BI \-\-name-prefix= prefix -Rename the external symbols used in the parser so that they start with -.I prefix -instead of -.BR yy . -The precise list of symbols renamed is -.BR yyparse , -.BR yylex , -.BR yyerror , -.BR yylval , -.BR yychar , -and -.BR yydebug . -.sp -For example, if you use -.BR "\-p c" , -the names become -.BR cparse , -.BR clex , -and so on. -.TP -.B \-t -.br -.ns -.TP -.B \-\-debug -In the parser file, define the macro -.B YYDEBUG -to 1 if it is not already defined, -so that the debugging facilities are compiled. -.TP -.B \-v -.br -.ns -.TP -.B \-\-verbose -Write an extra output file containing verbose descriptions of the -parser states and what is done for each type of look-ahead token in -that state. -.sp -This file also describes all the conflicts, both those resolved by -operator precedence and the unresolved ones. -.sp -The file's name is made by removing -.B .tab.c -or -.B .c -from the parser output file name, and adding -.B .output -instead. -.sp -Therefore, if the input file is -.BR foo.y , -then the parser file is called -.B foo.tab.c -by default. As a consequence, the verbose -output file is called -.BR foo.output . -.TP -.B \-V -.br -.ns -.TP -.B \-\-version -Print the version number of -.I bison -and exit. -.TP -.B \-h -.br -.ns -.TP -.B \-\-help -Print a summary of the options to -.I bison -and exit. -.TP -.B \-y -.br -.ns -.TP -.B \-\-yacc -.br -.ns -.TP -.B \-\-fixed-output-files -Equivalent to -.BR "\-o y.tab.c" ; -the parser output file is called -.BR y.tab.c , -and the other outputs are called -.B y.output -and -.BR y.tab.h . -The purpose of this switch is to imitate -.IR yacc 's -output file name conventions. -Thus, the following shell script can substitute for -.I yacc -and is often installed as -.IR yacc : -.sp -.RS -.ft B -bison \-y "$@" -.ft R -.sp -.RE -.SH SEE ALSO -.IR yacc (1) -.br -The -.IR "Bison Reference Manual" , -included as the file -.B bison.texinfo -in the -.I bison -source distribution. -.SH DIAGNOSTICS -Self explanatory. diff --git a/src/bin/bison/doc/bison.info b/src/bin/bison/doc/bison.info deleted file mode 100644 index 7907515fcf..0000000000 --- a/src/bin/bison/doc/bison.info +++ /dev/null @@ -1,9009 +0,0 @@ -This is bison.info, produced by makeinfo version 4.8 from bison.texinfo. - - This manual is for GNU Bison (version 2.3, 30 May 2006), the GNU -parser generator. - - Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 1999, -2000, 2001, 2002, 2003, 2004, 2005, 2006 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 freedom to copy and - modify this GNU Manual, like GNU software. Copies published by - the Free Software Foundation raise funds for GNU development." - -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 is for GNU Bison (version 2.3, 30 May 2006), the GNU parser -generator. - - Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 1999, -2000, 2001, 2002, 2003, 2004, 2005, 2006 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 freedom to copy and - modify this GNU Manual, like GNU software. Copies published by - the Free Software Foundation raise funds for GNU development." - -* 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). -* C++ Language Interface:: Creating C++ parser objects. -* 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 - -* Decls: Rpcalc Decls. Prologue (declarations) for rpcalc. -* Rules: Rpcalc Rules. Grammar Rules for rpcalc, with explanation. -* Lexer: Rpcalc Lexer. The lexical analyzer. -* Main: Rpcalc Main. The controlling function. -* Error: Rpcalc Error. The error reporting function. -* Gen: Rpcalc Gen. Running Bison on the grammar file. -* Comp: Rpcalc Compile. Run the C compiler on the output code. - -Grammar Rules for `rpcalc' - -* Rpcalc Input:: -* Rpcalc Line:: -* Rpcalc Expr:: - -Location Tracking Calculator: `ltcalc' - -* Decls: Ltcalc Decls. Bison and C declarations for ltcalc. -* Rules: Ltcalc Rules. Grammar rules for ltcalc, with explanations. -* Lexer: Ltcalc Lexer. The lexical analyzer. - -Multi-Function Calculator: `mfcalc' - -* Decl: Mfcalc Decl. Bison declarations for multi-function calculator. -* Rules: Mfcalc Rules. Grammar rules for the calculator. -* Symtab: Mfcalc Symtab. 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. -* 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. -* Decl Summary:: Table of all Bison declarations. - -Parser C-Language Interface - -* Parser Function:: How to call `yyparse' 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 - -* Look-Ahead:: 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'. - -C++ Language Interface - -* C++ Parsers:: The interface to generate C++ parser classes -* A Complete C++ Example:: Demonstrating their use - -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 - -* 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 - -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 -* Other Languages:: Parsers in Java and others -* Beta Testing:: Experimenting development versions -* Mailing Lists:: Meeting other Bison users - -Copying This Manual - -* GNU Free Documentation License:: 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.3 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 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, 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. - -Preamble -======== - -The licenses for most software are designed to take away your freedom -to share and change it. By contrast, the GNU General Public License is -intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) 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 -this service 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 make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. 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. - - We protect your rights with two steps: (1) copyright the software, -and (2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. This License applies to any program or other work which contains a - notice placed by the copyright holder saying it may be distributed - under the terms of this General Public License. The "Program", - below, refers to any such program or work, and a "work based on - the Program" means either the Program or any derivative work under - copyright law: that is to say, a work containing the Program or a - portion of it, either verbatim or with modifications and/or - translated into another language. (Hereinafter, translation is - included without limitation in the term "modification".) Each - licensee is addressed as "you". - - Activities other than copying, distribution and modification are - not covered by this License; they are outside its scope. The act - of running the Program is not restricted, and the output from the - Program is covered only if its contents constitute a work based on - the Program (independent of having been made by running the - Program). Whether that is true depends on what the Program does. - - 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the - notices that refer to this License and to the absence of any - warranty; and give any other recipients of the Program a copy of - this License along with the Program. - - You may charge a fee for the physical act of transferring a copy, - and you may at your option offer warranty protection in exchange - for a fee. - - 2. You may modify your copy or copies of the Program or any portion - of it, thus forming a work based on the Program, and copy and - distribute such modifications or work under the terms of Section 1 - above, provided that you also meet all of these conditions: - - a. You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b. You must cause any work that you distribute or publish, that - in whole or in part contains or is derived from the Program - or any part thereof, to be licensed as a whole at no charge - to all third parties under the terms of this License. - - c. If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display - an announcement including an appropriate copyright notice and - a notice that there is no warranty (or else, saying that you - provide a warranty) and that users may redistribute the - program under these conditions, and telling the user how to - view a copy of this License. (Exception: if the Program - itself is interactive but does not normally print such an - announcement, your work based on the Program is not required - to print an announcement.) - - These requirements apply to the modified work as a whole. If - identifiable sections of that work are not derived from the - Program, and can be reasonably considered independent and separate - works in themselves, then this License, and its terms, do not - apply to those sections when you distribute them as separate - works. But when you distribute the same sections as part of a - whole which is a work based on the Program, the distribution of - the whole must be on the terms of this License, whose permissions - for other licensees extend to the entire whole, and thus to each - and every part regardless of who wrote it. - - Thus, it is not the intent of this section to claim rights or - contest your rights to work written entirely by you; rather, the - intent is to exercise the right to control the distribution of - derivative or collective works based on the Program. - - In addition, mere aggregation of another work not based on the - Program with the Program (or with a work based on the Program) on - a volume of a storage or distribution medium does not bring the - other work under the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, - under Section 2) in object code or executable form under the terms - of Sections 1 and 2 above provided that you also do one of the - following: - - a. Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of - Sections 1 and 2 above on a medium customarily used for - software interchange; or, - - b. Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a - medium customarily used for software interchange; or, - - c. Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with - such an offer, in accord with Subsection b above.) - - The source code for a work means the preferred form of the work for - making modifications to it. For an executable work, complete - source code means all the source code for all modules it contains, - plus any associated interface definition files, plus the scripts - used to control compilation and installation of the executable. - However, as a special exception, the source code distributed need - not include anything that is normally distributed (in either - source or binary form) with the major components (compiler, - kernel, and so on) of the operating system on which the executable - runs, unless that component itself accompanies the executable. - - If distribution of executable or object code is made by offering - access to copy from a designated place, then offering equivalent - access to copy the source code from the same place counts as - distribution of the source code, even though third parties are not - compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program - except as expressly provided under this License. Any attempt - otherwise to copy, modify, sublicense or distribute the Program 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. - - 5. You are not required to accept this License, since you have not - signed it. However, nothing else grants you permission to modify - or distribute the Program or its derivative works. These actions - are prohibited by law if you do not accept this License. - Therefore, by modifying or distributing the Program (or any work - based on the Program), you indicate your acceptance of this - License to do so, and all its terms and conditions for copying, - distributing or modifying the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the - Program), the recipient automatically receives a license from the - original licensor to copy, distribute or modify the Program - subject to these terms and conditions. You may not impose any - further restrictions on the recipients' exercise of the rights - granted herein. You are not responsible for enforcing compliance - by third parties to this License. - - 7. If, as a consequence of a court judgment or allegation of patent - infringement or for any other reason (not limited to patent - issues), 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 distribute so as to satisfy simultaneously - your obligations under this License and any other pertinent - obligations, then as a consequence you may not distribute the - Program at all. For example, if a patent license would not permit - royalty-free redistribution of the Program by all those who - receive copies directly or indirectly through you, then the only - way you could satisfy both it and this License would be to refrain - entirely from distribution of the Program. - - If any portion of this section is held invalid or unenforceable - under any particular circumstance, the balance of the section is - intended to apply and the section as a whole is intended to apply - in other circumstances. - - It is not the purpose of this section to induce you to infringe any - patents or other property right claims or to contest validity of - any such claims; this section has the sole purpose of protecting - the integrity of the free software distribution system, which is - implemented by public license practices. Many people have made - generous contributions to the wide range of software distributed - through that system in reliance on consistent application of that - system; it is up to the author/donor to decide if he or she is - willing to distribute software through any other system and a - licensee cannot impose that choice. - - This section is intended to make thoroughly clear what is believed - to be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in - certain countries either by patents or by copyrighted interfaces, - the original copyright holder who places the Program under this - License may add an explicit geographical distribution limitation - excluding those countries, so that distribution is permitted only - in or among countries not thus excluded. In such case, this - License incorporates the limitation as if written in the body of - this License. - - 9. The Free Software Foundation may publish revised and/or new - versions of the 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 a version number of this License which applies - to it and "any later version", you have the option of following - the terms and conditions either of that version or of any later - version published by the Free Software Foundation. If the Program - does not specify a version number of this License, you may choose - any version ever published by the Free Software Foundation. - - 10. If you wish to incorporate parts of the Program into other free - programs whose distribution conditions are different, write to the - author to ask for permission. For software which is copyrighted - by the Free Software Foundation, write to the Free Software - Foundation; we sometimes make exceptions for this. Our decision - will be guided by the two goals of preserving the free status of - all derivatives of our free software and of promoting the sharing - and reuse of software generally. - - NO WARRANTY - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN - WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY - MODIFY AND/OR REDISTRIBUTE 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. - - END OF TERMS AND CONDITIONS -Appendix: 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 -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. - Copyright (C) YYYY 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 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. - - Also add information on how to contact you by electronic and paper -mail. - - If the program is interactive, make it output a short notice like -this when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR - Gnomovision 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, the -commands you use may be called something other than `show w' and `show -c'; they could even be mouse-clicks or menu items--whatever suits your -program. - - You should also get your employer (if you work as a programmer) or -your school, if any, to sign a "copyright disclaimer" for the program, -if necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - SIGNATURE OF TY COON, 1 April 1989 - Ty Coon, President of Vice - - This 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 Library General Public License instead of this License. - - -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 look-ahead. 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 "look-ahead") 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 look-ahead 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 look-ahead, 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 look-ahead 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 -look-ahead 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 look-ahead 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 -look-ahead 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 Look-Ahead Tokens: Look-Ahead. - - 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: - -* Decls: Rpcalc Decls. Prologue (declarations) for rpcalc. -* Rules: Rpcalc Rules. Grammar Rules for rpcalc, with explanation. -* Lexer: Rpcalc Lexer. The lexical analyzer. -* Main: Rpcalc Main. The controlling function. -* Error: Rpcalc Error. The error reporting function. -* Gen: Rpcalc Gen. Running Bison on the grammar file. -* Comp: Rpcalc Compile. Run the C compiler on the output code. - - -File: bison.info, Node: Rpcalc Decls, 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 Decls, 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 -Decls.) - - 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 Gen, 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 Gen, 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 Gen, 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: - -* Decls: Ltcalc Decls. Bison and C declarations for ltcalc. -* Rules: Ltcalc Rules. Grammar rules for ltcalc, with explanations. -* Lexer: Ltcalc Lexer. The lexical analyzer. - - -File: bison.info, Node: Ltcalc Decls, 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'. - - -File: bison.info, Node: Ltcalc Rules, Next: Ltcalc Lexer, Prev: Ltcalc Decls, 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 %preg 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: - -* Decl: Mfcalc Decl. Bison declarations for multi-function calculator. -* Rules: Mfcalc Rules. Grammar rules for the calculator. -* Symtab: Mfcalc Symtab. Symbol table management subroutines. - - -File: bison.info, Node: Mfcalc Decl, 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 Symtab, Prev: Mfcalc Decl, 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 Symtab, 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. -* 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: Bison Declarations, 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 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. - - %{ - #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) - %} - - ... - - -File: bison.info, Node: Bison Declarations, Next: Grammar Rules, Prev: Prologue, Up: Grammar Outline - -3.1.2 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.3 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.4 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's default is to use type `int' for all semantic values. 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, with the - `%union' Bison declaration (*note The Collection of Value Types: - Union Decl.). - - * 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 look-ahead -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 for a 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 "look-ahead" token at this time, since the parser is still deciding -what to do about it. *Note Look-Ahead Tokens: Look-Ahead.) - - 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 -`YYSTYPE' (*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; - - -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 look-ahead 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. -* 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 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::). - - -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 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. - - -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. - - -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 look-ahead -- 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. The additional parser - parameters are also available (*note The Parser Function - `yyparse': Parser Function.). - - For instance: - - %union - { - char *string; - } - %token STRING - %type string - %destructor { free ($$); } STRING string - -guarantees that when a `STRING' or a `string' is discarded, its -associated memory will be freed. - - - "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 look-ahead 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 size 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: Decl Summary, 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 `%pure-parser' says that you want the parser to be -reentrant. It looks like this: - - %pure-parser - - 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' also becomes local in `yyparse' (*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: Decl Summary, Prev: Pure Decl, Up: Declarations - -3.7.11 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: %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: %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'. - - Unless `YYSTYPE' is already defined as a macro, the output header - declares `YYSTYPE'. 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 - (*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 - `YYSTYPE' 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. - - -- 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: %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'. For example, if you use `%name-prefix="c_"', the names - become `c_parse', `c_lex', and so on. In C++ parsers, it is only - the surrounding namespace which is named PREFIX instead of `yy'. - *Note Multiple Parsers in the Same Program: Multiple Parsers. - - -- Directive: %no-parser - Do not include any C code in the parser file; generate tables - only. The parser file contains just `#define' directives and - static variable declarations. - - This option also tells Bison to write the C code for the grammar - actions into a file named `FILE.act', in the form of a - brace-surrounded body fit for a `switch' statement. - - -- 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 - Request a pure (reentrant) parser program (*note A Pure - (Reentrant) Parser: Pure Decl.). - - -- Directive: %require "VERSION" - Require version VERSION or higher of Bison. *Note Require a - Version of Bison: Require Decl. - - -- 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 look-ahead 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. - - -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'. 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. -* 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: Lexical, 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: Lexical, Next: Error Reporting, Prev: Parser Function, Up: Interface - -4.2 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.2.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.2.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.2.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.2.4 Calling Conventions for Pure Parsers ------------------------------------------- - -When you use the Bison declaration `%pure-parser' 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 `%pure-parser' is added: - - int yylex (YYSTYPE *lvalp, int *nastiness); - int yyparse (int *nastiness, int *randomness); - -and finally, if both `%pure-parser' 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.3 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 %pure-parser' 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 `%pure-parser' -are pure. I.e.: - - /* Location tracking. */ - %locations - /* Pure yylex. */ - %pure-parser - %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.4 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 look-ahead token. It is - also disallowed in GLR parsers. It installs a look-ahead 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 - look-ahead 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 look-ahead token. - - -- Macro: YYEOF - Value stored in `yychar' when the look-ahead 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 look-ahead token, or `YYEOF' when - the look-ahead is the end of the input stream, or `YYEMPTY' when - no look-ahead 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 Look-Ahead Tokens: - Look-Ahead. - - -- Macro: yyclearin; - Discard the current look-ahead 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 look-ahead 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 look-ahead 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.5 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: - -* Look-Ahead:: 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: Look-Ahead, Next: Shift/Reduce, Up: Algorithm - -5.1 Look-Ahead 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 "look-ahead 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 look-ahead token remains off to the side. When no -more reductions should take place, the look-ahead token is shifted onto -the stack. This does not mean that all possible reductions have been -done; depending on the token type of the look-ahead token, some rules -may choose to delay their application. - - Here is a simple case where look-ahead 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 look-ahead 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: Look-Ahead, 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 look-ahead 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 look-ahead -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 look-ahead -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 look-ahead 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 look-ahead token is read, the current parser state -together with the type of look-ahead token are looked up in a table. -This table entry can say, "Shift the look-ahead 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 -look-ahead 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 look-ahead: 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 look-ahead 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 look-ahead. 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 -look-ahead, 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 look-ahead 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 look-ahead 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 look-ahead 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 VCG 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 useless nonterminal and 1 useless rule - calc.y:11.1-7: warning: useless nonterminal: useless - calc.y:11.10-12: warning: useless rule: 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 "not used" below): - - Useless nonterminals: - useless - - Terminals which are not used: - STR - - Useless rules: - #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 look-ahead is a `NUM', then this token is shifted on -the parse stack, and the control flow jumps to state 1. Any other -look-ahead triggers a syntax error." - - Even though the only active rule in state 0 seems to be rule 0, the -report lists `NUM' as a look-ahead 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 look-ahead 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 look-ahead 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 look-ahead `/': -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 -look-ahead is required to select the action. State 8 is one such -state: if the look-ahead 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 look-ahead -token is `*', since we specified that `*' has higher precedence than -`+'. More generally, some items are eligible only with some set of -possible look-ahead tokens. When run with `--report=look-ahead', Bison -specifies these look-ahead 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 arguments. If you define `YYDEBUG' to a nonzero -value but do not define `YYFPRINTF', `' is automatically -included and `YYPRINTF' 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 Decl.): - - %{ - 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: C++ Language Interface, 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. - -`-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'. 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. - - -Tuning the parser: - -`-S FILE' -`--skeleton=FILE' - Specify the skeleton to use. You probably don't need this option - unless you are developing Bison. - -`-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. - -`--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. - -`-n' -`--no-parser' - Pretend that `%no-parser' was specified. *Note Decl Summary::. - -`-k' -`--token-table' - Pretend that `%token-table' was specified. *Note Decl Summary::. - -Adjust the output: - -`-d' -`--defines' - 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::. - -`--defines=DEFINES-FILE' - Same as above, but save in the file DEFINES-FILE. - -`-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. - - `look-ahead' - Implies `state' and augments the description of the automaton - with each rule's look-ahead 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. - -`-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' - Output a VCG definition of the LALR(1) grammar automaton computed - by Bison. If the grammar file is `foo.y', the VCG output file will - be `foo.vcg'. - -`--graph=GRAPH-FILE' - The behavior of -GRAPH is the same than `-g'. The only difference - is that it has an optional argument which is the name of the - output graph file. - - -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=DEFINES-FILE' `-d' -`--file-prefix=PREFIX' `-b FILE-PREFIX' -`--graph=GRAPH-FILE' `-d' -`--help' `-h' -`--name-prefix=PREFIX' `-p NAME-PREFIX' -`--no-lines' `-l' -`--no-parser' `-n' -`--output=OUTFILE' `-o OUTFILE' -`--print-localedir' -`--token-table' `-k' -`--verbose' `-v' -`--version' `-V' -`--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: C++ Language Interface, Next: FAQ, Prev: Invocation, Up: Top - -10 C++ Language Interface -************************* - -* Menu: - -* C++ Parsers:: The interface to generate C++ parser classes -* A Complete C++ Example:: Demonstrating their use - - -File: bison.info, Node: C++ Parsers, Next: A Complete C++ Example, Up: C++ Language Interface - -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 - - -File: bison.info, Node: C++ Bison Interface, Next: C++ Semantic Values, Up: C++ Parsers - -10.1.1 C++ Bison Interface --------------------------- - -The C++ parser LALR(1) skeleton is named `lalr1.cc'. To select it, you -may either pass the option `--skeleton=lalr1.cc' to Bison, or include -the directive `%skeleton "lalr1.cc"' in the grammar preamble. When -run, `bison' will create several entities in the `yy' namespace. Use -the `%name-prefix' 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, 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 -`%pure-parser' 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++ Parsers, Up: C++ Language Interface - -10.2 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.2.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.2.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. - - // Announce to Flex the prototype we want for lexing function, ... - # 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. -members. - - // Handling the scanner. - void scan_begin (); - void scan_end (); - bool trace_scanning; - -Similarly for the parser itself. - - // Handling the parser. - void 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 () - { - } - - void - calcxx_driver::parse (const std::string &f) - { - file = f; - scan_begin (); - yy::calcxx_parser parser (*this); - parser.set_debug_level (trace_parsing); - parser.parse (); - scan_end (); - } - - 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.2.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.1a" - %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. - - %{ - # 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 `%{' and `%}' after the introduction of the `%union' -is output in the `*.cc' file; it needs detailed knowledge about the -driver. - - %{ - # 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 "expression" - -To enable memory deallocation during error recovery, use `%destructor'. - - %printer { debug_stream () << *$$; } "identifier" - %destructor { delete $$; } "identifier" - - %printer { debug_stream () << $$; } "number" "expression" - -The grammar itself is straightforward. - - %% - %start unit; - unit: assignments exp { driver.result = $2; }; - - assignments: assignments assignment {} - | /* Nothing. */ {}; - - assignment: "identifier" ":=" exp { driver.variables[*$1] = $3; }; - - %left '+' '-'; - %left '*' '/'; - exp: exp '+' exp { $$ = $1 + $3; } - | exp '-' exp { $$ = $1 - $3; } - | exp '*' exp { $$ = $1 * $3; } - | exp '/' exp { $$ = $1 / $3; } - | "identifier" { $$ = driver.variables[*$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.2.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 (!(yyin = fopen (file.c_str (), "r"))) - error (std::string ("cannot open ") + file); - } - - void - calcxx_driver::scan_end () - { - fclose (yyin); - } - - -File: bison.info, Node: Calc++ Top Level, Prev: Calc++ Scanner, Up: A Complete C++ Example - -10.2.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 - { - driver.parse (*argv); - std::cout << driver.result << std::endl; - } - } - - -File: bison.info, Node: FAQ, Next: Table of Symbols, Prev: C++ Language Interface, 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 -* Other Languages:: Parsers in Java and others -* 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 I needed a `%pure-parser'. - - 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: Other 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: Other Languages, Next: Beta Testing, Prev: Bug Reports, Up: FAQ - -11.10 Other Languages -===================== - - Will Bison ever have C++ support? How about Java or INSERT YOUR - FAVORITE LANGUAGE HERE? - - C++ 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: Other 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. - - -- 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: %debug - Equip the parser for debugging. *Note Decl Summary::. - - -- Directive: %defines - Bison declaration to create a header file meant for the scanner. - *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 look-ahead - token. Actions corresponding to `error' are then executed, and - the look-ahead 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: %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 - Bison declaration to request a pure (reentrant) parser. *Note A - Pure (Reentrant) Parser: Pure Decl. - - -- 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: %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. - - -- 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. - - -- Macro: YYBACKUP - Macro to discard a value from the parser stack and fake a - look-ahead token. *Note Special Features for Use in Actions: - Action Features. - - -- Variable: yychar - External integer variable that contains the integer value of the - look-ahead 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 - look-ahead 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::. - - -- 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 - look-ahead 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 look-ahead 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'.) *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. - - -- 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::. - -Look-ahead token - A token already read but not yet shifted. *Note Look-Ahead - Tokens: Look-Ahead. - -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 - look-ahead 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 -****************************** - -* Menu: - -* GNU Free Documentation License:: License for copying this manual. - - -File: bison.info, Node: GNU Free Documentation License, Up: Copying This Manual - -C.1 GNU Free Documentation License -================================== - - 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. - -C.1.1 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) -* $: Action Features. (line 14) -* $$ <1>: Table of Symbols. (line 15) -* $$ <2>: Action Features. (line 10) -* $$: Actions. (line 6) -* $<: Action Features. (line 18) -* $accept: Table of Symbols. (line 47) -* $end: Table of Symbols. (line 69) -* $N: Actions. (line 6) -* $undefined: Table of Symbols. (line 168) -* %: Table of Symbols. (line 28) -* %%: Table of Symbols. (line 23) -* %debug <1>: Table of Symbols. (line 52) -* %debug <2>: Tracing. (line 23) -* %debug: Decl Summary. (line 46) -* %defines <1>: Table of Symbols. (line 55) -* %defines: Decl Summary. (line 51) -* %destructor <1>: Table of Symbols. (line 59) -* %destructor <2>: Decl Summary. (line 79) -* %destructor <3>: Destructor Decl. (line 6) -* %destructor: Mid-Rule Actions. (line 59) -* %dprec <1>: Table of Symbols. (line 64) -* %dprec: Merging GLR Parses. (line 6) -* %error-verbose <1>: Table of Symbols. (line 83) -* %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 87) -* %file-prefix=": Decl Summary. (line 84) -* %glr-parser <1>: Table of Symbols. (line 91) -* %glr-parser <2>: Simple GLR Parsers. (line 6) -* %glr-parser: GLR Parsers. (line 6) -* %initial-action <1>: Table of Symbols. (line 95) -* %initial-action: Initial Action Decl. (line 6) -* %left <1>: Table of Symbols. (line 99) -* %left <2>: Using Precedence. (line 6) -* %left: Decl Summary. (line 21) -* %lex-param <1>: Table of Symbols. (line 103) -* %lex-param: Pure Calling. (line 31) -* %locations: Decl Summary. (line 88) -* %merge <1>: Table of Symbols. (line 108) -* %merge: Merging GLR Parses. (line 6) -* %name-prefix=" <1>: Table of Symbols. (line 115) -* %name-prefix=": Decl Summary. (line 95) -* %no-lines <1>: Table of Symbols. (line 119) -* %no-lines: Decl Summary. (line 114) -* %no-parser: Decl Summary. (line 105) -* %nonassoc <1>: Table of Symbols. (line 123) -* %nonassoc <2>: Using Precedence. (line 6) -* %nonassoc: Decl Summary. (line 25) -* %output=" <1>: Table of Symbols. (line 127) -* %output=": Decl Summary. (line 122) -* %parse-param <1>: Table of Symbols. (line 131) -* %parse-param: Parser Function. (line 36) -* %prec <1>: Table of Symbols. (line 136) -* %prec: Contextual Precedence. - (line 6) -* %pure-parser <1>: Table of Symbols. (line 140) -* %pure-parser <2>: Decl Summary. (line 125) -* %pure-parser: Pure Decl. (line 6) -* %require <1>: Table of Symbols. (line 144) -* %require <2>: Decl Summary. (line 129) -* %require: Require Decl. (line 6) -* %right <1>: Table of Symbols. (line 148) -* %right <2>: Using Precedence. (line 6) -* %right: Decl Summary. (line 17) -* %start <1>: Table of Symbols. (line 152) -* %start <2>: Decl Summary. (line 34) -* %start: Start Decl. (line 6) -* %token <1>: Table of Symbols. (line 156) -* %token <2>: Decl Summary. (line 13) -* %token: Token Decl. (line 6) -* %token-table <1>: Table of Symbols. (line 160) -* %token-table: Decl Summary. (line 133) -* %type <1>: Table of Symbols. (line 164) -* %type <2>: Decl Summary. (line 30) -* %type: Type Decl. (line 6) -* %union <1>: Table of Symbols. (line 173) -* %union <2>: Decl Summary. (line 9) -* %union: Union Decl. (line 6) -* %verbose: Decl Summary. (line 166) -* %yacc: Decl Summary. (line 172) -* /*: Table of Symbols. (line 33) -* :: Table of Symbols. (line 36) -* ;: Table of Symbols. (line 40) -* @$ <1>: Table of Symbols. (line 7) -* @$ <2>: Action Features. (line 99) -* @$: Actions and Locations. - (line 6) -* @N <1>: Table of Symbols. (line 11) -* @N <2>: Action Features. (line 105) -* @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: 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 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 42) -* discarded symbols, mid-rule actions: Mid-Rule Actions. (line 59) -* else, dangling: Shift/Reduce. (line 6) -* end on location: C++ Location Values. (line 45) -* epilogue: Epilogue. (line 6) -* error <1>: Table of Symbols. (line 73) -* 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) -* FDL, GNU Free Documentation License: GNU Free Documentation License. - (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) -* 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 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) -* look-ahead token: Look-Ahead. (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: 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) -* 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: Prologue. (line 6) -* pure parser: Pure Decl. (line 6) -* questions: FAQ. (line 6) -* 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) -* 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 Gen. (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) -* 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 Symtab. (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) -* 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 177) -* YYABORT: Parser Function. (line 29) -* YYABORT;: Action Features. (line 28) -* YYACCEPT <1>: Table of Symbols. (line 183) -* YYACCEPT: Parser Function. (line 26) -* YYACCEPT;: Action Features. (line 32) -* YYBACKUP <1>: Table of Symbols. (line 188) -* YYBACKUP: Action Features. (line 36) -* yychar <1>: Table of Symbols. (line 193) -* yychar <2>: Look-Ahead. (line 47) -* yychar <3>: Action Features. (line 69) -* yychar: GLR Semantic Actions. - (line 10) -* yyclearin <1>: Table of Symbols. (line 199) -* yyclearin <2>: Error Recovery. (line 97) -* yyclearin: GLR Semantic Actions. - (line 18) -* yyclearin;: Action Features. (line 77) -* yydebug: Table of Symbols. (line 207) -* YYDEBUG <1>: Table of Symbols. (line 203) -* 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 212) -* yyerrok: Error Recovery. (line 92) -* yyerrok;: Action Features. (line 82) -* yyerror: Table of Symbols. (line 222) -* YYERROR <1>: Table of Symbols. (line 216) -* YYERROR: Action Features. (line 56) -* yyerror: Error Reporting. (line 6) -* YYERROR: GLR Semantic Actions. - (line 28) -* YYERROR;: Action Features. (line 56) -* YYERROR_VERBOSE: Table of Symbols. (line 226) -* YYINITDEPTH <1>: Table of Symbols. (line 233) -* YYINITDEPTH: Memory Management. (line 32) -* yylex <1>: Table of Symbols. (line 237) -* yylex: Lexical. (line 6) -* yylex on parser: C++ Scanner Interface. - (line 12) -* YYLEX_PARAM: Table of Symbols. (line 242) -* yylloc <1>: Table of Symbols. (line 248) -* yylloc <2>: Look-Ahead. (line 47) -* yylloc <3>: Action Features. (line 87) -* 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 258) -* YYLTYPE: Token Locations. (line 19) -* yylval <1>: Table of Symbols. (line 262) -* yylval <2>: Look-Ahead. (line 47) -* yylval <3>: Action Features. (line 93) -* yylval <4>: Token Values. (line 6) -* yylval <5>: Actions. (line 74) -* yylval: GLR Semantic Actions. - (line 10) -* YYMAXDEPTH <1>: Table of Symbols. (line 270) -* YYMAXDEPTH: Memory Management. (line 14) -* yynerrs <1>: Table of Symbols. (line 274) -* yynerrs: Error Reporting. (line 92) -* yyparse <1>: Table of Symbols. (line 280) -* yyparse: Parser Function. (line 6) -* YYPARSE_PARAM: Table of Symbols. (line 284) -* YYPRINT: Tracing. (line 71) -* YYRECOVERING <1>: Table of Symbols. (line 290) -* YYRECOVERING <2>: Error Recovery. (line 109) -* YYRECOVERING: Action Features. (line 64) -* YYSTACK_USE_ALLOCA: Table of Symbols. (line 295) -* YYSTYPE: Table of Symbols. (line 311) -* | <1>: Table of Symbols. (line 43) -* |: Rules. (line 49) - - - -Tag Table: -Node: Top1110 -Node: Introduction12389 -Node: Conditions13650 -Node: Copying15541 -Node: Concepts34719 -Node: Language and Grammar35873 -Node: Grammar in Bison41766 -Node: Semantic Values43695 -Node: Semantic Actions45801 -Node: GLR Parsers46988 -Node: Simple GLR Parsers49739 -Node: Merging GLR Parses56394 -Node: GLR Semantic Actions60963 -Node: Compiler Requirements62857 -Node: Locations Overview63593 -Node: Bison Parser65046 -Node: Stages67986 -Node: Grammar Layout69274 -Node: Examples70606 -Node: RPN Calc71780 -Node: Rpcalc Decls72759 -Node: Rpcalc Rules74680 -Node: Rpcalc Input76489 -Node: Rpcalc Line77964 -Node: Rpcalc Expr79092 -Node: Rpcalc Lexer81059 -Node: Rpcalc Main83646 -Node: Rpcalc Error84053 -Node: Rpcalc Gen85081 -Node: Rpcalc Compile86211 -Node: Infix Calc87085 -Node: Simple Error Recovery89848 -Node: Location Tracking Calc91743 -Node: Ltcalc Decls92430 -Node: Ltcalc Rules93383 -Node: Ltcalc Lexer95392 -Node: Multi-function Calc97715 -Node: Mfcalc Decl99288 -Node: Mfcalc Rules101327 -Node: Mfcalc Symtab102708 -Node: Exercises108878 -Node: Grammar File109392 -Node: Grammar Outline110241 -Node: Prologue111001 -Node: Bison Declarations112427 -Node: Grammar Rules112842 -Node: Epilogue113313 -Node: Symbols114329 -Node: Rules121032 -Node: Recursion123511 -Node: Semantics125229 -Node: Value Type126328 -Node: Multiple Types127101 -Node: Actions128131 -Node: Action Types131547 -Node: Mid-Rule Actions132859 -Node: Locations139308 -Node: Location Type139959 -Node: Actions and Locations140646 -Node: Location Default Action143108 -Node: Declarations146828 -Node: Require Decl148307 -Node: Token Decl148626 -Node: Precedence Decl150734 -Node: Union Decl152294 -Node: Type Decl153609 -Node: Initial Action Decl154535 -Node: Destructor Decl155307 -Node: Expect Decl157582 -Node: Start Decl159575 -Node: Pure Decl159963 -Node: Decl Summary161649 -Node: Multiple Parsers168975 -Node: Interface170484 -Node: Parser Function171457 -Node: Lexical173460 -Node: Calling Convention174871 -Node: Token Values177831 -Node: Token Locations178995 -Node: Pure Calling179889 -Node: Error Reporting181758 -Node: Action Features185876 -Node: Internationalization190197 -Node: Algorithm192738 -Node: Look-Ahead195105 -Node: Shift/Reduce197323 -Node: Precedence200220 -Node: Why Precedence200876 -Node: Using Precedence202750 -Node: Precedence Examples203727 -Node: How Precedence204437 -Node: Contextual Precedence205596 -Node: Parser States207392 -Node: Reduce/Reduce208640 -Node: Mystery Conflicts212181 -Node: Generalized LR Parsing215890 -Node: Memory Management220511 -Node: Error Recovery222724 -Node: Context Dependency228030 -Node: Semantic Tokens228879 -Node: Lexical Tie-ins231949 -Node: Tie-in Recovery233526 -Node: Debugging235703 -Node: Understanding236369 -Node: Tracing247515 -Node: Invocation251599 -Node: Bison Options253005 -Node: Option Cross Key257597 -Node: Yacc Library258419 -Node: C++ Language Interface259244 -Node: C++ Parsers259532 -Node: C++ Bison Interface259990 -Node: C++ Semantic Values261283 -Ref: C++ Semantic Values-Footnote-1262225 -Node: C++ Location Values262378 -Node: C++ Parser Interface264753 -Node: C++ Scanner Interface266473 -Node: A Complete C++ Example267140 -Node: Calc++ --- C++ Calculator268079 -Node: Calc++ Parsing Driver268589 -Node: Calc++ Parser272324 -Node: Calc++ Scanner276092 -Node: Calc++ Top Level279417 -Node: FAQ280084 -Node: Memory Exhausted281033 -Node: How Can I Reset the Parser281343 -Node: Strings are Destroyed283619 -Node: Implementing Gotos/Loops285208 -Node: Multiple start-symbols286491 -Node: Secure? Conform?288036 -Node: I can't build Bison288484 -Node: Where can I find help?289202 -Node: Bug Reports289995 -Node: Other Languages291457 -Node: Beta Testing291808 -Node: Mailing Lists292683 -Node: Table of Symbols292894 -Node: Glossary305135 -Node: Copying This Manual312036 -Node: GNU Free Documentation License312267 -Node: Index334676 - -End Tag Table diff --git a/src/bin/bison/doc/bison.texinfo b/src/bin/bison/doc/bison.texinfo deleted file mode 100644 index 6c67b59392..0000000000 --- a/src/bin/bison/doc/bison.texinfo +++ /dev/null @@ -1,8715 +0,0 @@ -\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 is for @acronym{GNU} Bison (version @value{VERSION}, -@value{UPDATED}), the @acronym{GNU} parser generator. - -Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, -1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 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 @acronym{FSF}'s Back-Cover Text is: ``You have freedom to copy -and modify this @acronym{GNU} Manual, like @acronym{GNU} software. -Copies published by the Free Software Foundation raise funds for -@acronym{GNU} development.'' -@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). -* C++ Language Interface:: Creating C++ parser objects. -* 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 - -* Decls: Rpcalc Decls. Prologue (declarations) for rpcalc. -* Rules: Rpcalc Rules. Grammar Rules for rpcalc, with explanation. -* Lexer: Rpcalc Lexer. The lexical analyzer. -* Main: Rpcalc Main. The controlling function. -* Error: Rpcalc Error. The error reporting function. -* Gen: Rpcalc Gen. Running Bison on the grammar file. -* Comp: 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} - -* Decls: Ltcalc Decls. Bison and C declarations for ltcalc. -* Rules: Ltcalc Rules. Grammar rules for ltcalc, with explanations. -* Lexer: Ltcalc Lexer. The lexical analyzer. - -Multi-Function Calculator: @code{mfcalc} - -* Decl: Mfcalc Decl. Bison declarations for multi-function calculator. -* Rules: Mfcalc Rules. Grammar rules for the calculator. -* Symtab: Mfcalc Symtab. 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. -* 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. -* Decl Summary:: Table of all Bison declarations. - -Parser C-Language Interface - -* Parser Function:: How to call @code{yyparse} 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 - -* Look-Ahead:: 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}. - -C++ Language Interface - -* C++ Parsers:: The interface to generate C++ parser classes -* A Complete C++ Example:: Demonstrating their use - -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 - -* 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 - -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 -* Other Languages:: Parsers in Java and others -* Beta Testing:: Experimenting development versions -* Mailing Lists:: Meeting other Bison users - -Copying This Manual - -* GNU Free Documentation License:: 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. - -@include gpl.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 look-ahead. 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{look-ahead}) 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 -look-ahead 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 look-ahead, -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 look-ahead 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 -look-ahead 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 look-ahead 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 -look-ahead 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{Look-Ahead, ,Look-Ahead 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 -* Decls: Rpcalc Decls. Prologue (declarations) for rpcalc. -* Rules: Rpcalc Rules. Grammar Rules for rpcalc, with explanation. -* Lexer: Rpcalc Lexer. The lexical analyzer. -* Main: Rpcalc Main. The controlling function. -* Error: Rpcalc Error. The error reporting function. -* Gen: Rpcalc Gen. Running Bison on the grammar file. -* Comp: Rpcalc Compile. Run the C compiler on the output code. -@end menu - -@node Rpcalc Decls -@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 Decls, -,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 Gen -@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 -* Decls: Ltcalc Decls. Bison and C declarations for ltcalc. -* Rules: Ltcalc Rules. Grammar rules for ltcalc, with explanations. -* Lexer: Ltcalc Lexer. The lexical analyzer. -@end menu - -@node Ltcalc Decls -@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}. - -@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 %preg 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 -* Decl: Mfcalc Decl. Bison declarations for multi-function calculator. -* Rules: Mfcalc Rules. Grammar rules for the calculator. -* Symtab: Mfcalc Symtab. Symbol table management subroutines. -@end menu - -@node Mfcalc Decl -@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 Symtab -@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. -* 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 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 -%@{ - #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 - -@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's default is to use type @code{int} for all semantic values. 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, with the -@code{%union} Bison declaration (@pxref{Union Decl, ,The Collection of -Value Types}). - -@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 look-ahead 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 for a -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{look-ahead} token at this time, since the parser is still -deciding what to do about it. @xref{Look-Ahead, ,Look-Ahead 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 @code{YYSTYPE} (@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 - -@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 look-ahead 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. -* 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 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}). - -@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 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 - -@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. - -@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 look-ahead --- 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 - -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. The additional parser parameters are also -available (@pxref{Parser Function, , The Parser Function -@code{yyparse}}). -@end deffn - -For instance: - -@smallexample -%union -@{ - char *string; -@} -%token STRING -%type string -%destructor @{ free ($$); @} STRING string -@end smallexample - -@noindent -guarantees that when a @code{STRING} or a @code{string} is discarded, -its associated memory will be freed. - -@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 look-ahead 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 size 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 %pure-parser - -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{%pure-parser} says that you want the parser to be -reentrant. It looks like this: - -@example -%pure-parser -@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} also -becomes local in @code{yyparse} (@pxref{Error Reporting, ,The Error -Reporting Function @code{yyerror}}). The convention for calling -@code{yyparse} itself is unchanged. - -Whether the parser is pure has nothing to do with the grammar rules. -You can generate either a pure parser or a nonreentrant parser from any -valid grammar. - -@node Decl Summary -@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} %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} %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}. - -Unless @code{YYSTYPE} is already defined as a macro, the output header -declares @code{YYSTYPE}. 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 -(@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 -@code{YYSTYPE} 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}. -@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} %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}. For example, if you use -@samp{%name-prefix="c_"}, the names become @code{c_parse}, @code{c_lex}, -and so on. In C++ parsers, it is only the surrounding namespace which is -named @var{prefix} instead of @samp{yy}. -@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-parser -Do not include any C code in the parser file; generate tables only. The -parser file contains just @code{#define} directives and static variable -declarations. - -This option also tells Bison to write the C code for the grammar actions -into a file named @file{@var{file}.act}, in the form of a -brace-surrounded body fit for a @code{switch} statement. -@end deffn - -@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 -Request a pure (reentrant) parser program (@pxref{Pure Decl, ,A Pure -(Reentrant) Parser}). -@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} %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 look-ahead 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}. 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. -* 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 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{%pure-parser} 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{%pure-parser} is added: - -@example -int yylex (YYSTYPE *lvalp, int *nastiness); -int yyparse (int *nastiness, int *randomness); -@end example - -@noindent -and finally, if both @code{%pure-parser} 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 %pure-parser} 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{%pure-parser} are pure. I.e.: - -@example -/* Location tracking. */ -%locations -/* Pure yylex. */ -%pure-parser -%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 look-ahead token. -It is also disallowed in @acronym{GLR} parsers. -It installs a look-ahead 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 look-ahead 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 look-ahead token. -@end deffn - -@deffn {Macro} YYEOF -@vindex YYEOF -Value stored in @code{yychar} when the look-ahead 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 look-ahead token, or @code{YYEOF} when the -look-ahead is the end of the input stream, or @code{YYEMPTY} when no look-ahead -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{Look-Ahead, ,Look-Ahead Tokens}. -@end deffn - -@deffn {Macro} yyclearin; -Discard the current look-ahead 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 look-ahead 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 look-ahead 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 -* Look-Ahead:: 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 Look-Ahead -@section Look-Ahead Tokens -@cindex look-ahead 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{look-ahead 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 look-ahead token remains off to the side. When no more reductions -should take place, the look-ahead token is shifted onto the stack. This -does not mean that all possible reductions have been done; depending on the -token type of the look-ahead token, some rules may choose to delay their -application. - -Here is a simple case where look-ahead 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 look-ahead 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 look-ahead 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 look-ahead 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 look-ahead 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 look-ahead 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 look-ahead token is read, the current parser state together -with the type of look-ahead token are looked up in a table. This table -entry can say, ``Shift the look-ahead 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 look-ahead 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 look-ahead: 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 look-ahead 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 look-ahead. -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 -look-ahead, 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 -look-ahead 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 look-ahead 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 look-ahead 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 @acronym{VCG} -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 useless nonterminal and 1 useless rule -calc.y:11.1-7: warning: useless nonterminal: useless -calc.y:11.10-12: warning: useless rule: 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 ``not used'' -below): - -@example -Useless nonterminals: - useless - -Terminals which are not used: - STR - -Useless rules: -#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 look-ahead is a @code{NUM}, then this token is shifted on -the parse stack, and the control flow jumps to state 1. Any other -look-ahead 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 look-ahead 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 look-ahead 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 look-ahead 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 look-ahead @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 look-ahead is required to select the action. State 8 is -one such state: if the look-ahead 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 -look-ahead 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 look-ahead tokens. When run with -@option{--report=look-ahead}, Bison specifies these look-ahead 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 -arguments. If you define @code{YYDEBUG} to a nonzero value but do not -define @code{YYFPRINTF}, @code{} is automatically included -and @code{YYPRINTF} 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 Decl, ,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 -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}. 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. - -@end table - -@noindent -Tuning the parser: - -@table @option -@item -S @var{file} -@itemx --skeleton=@var{file} -Specify the skeleton to use. You probably don't need this option unless -you are developing Bison. - -@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 --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 -n -@itemx --no-parser -Pretend that @code{%no-parser} was specified. @xref{Decl Summary}. - -@item -k -@itemx --token-table -Pretend that @code{%token-table} was specified. @xref{Decl Summary}. -@end table - -@noindent -Adjust the output: - -@table @option -@item -d -@itemx --defines -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 --defines=@var{defines-file} -Same as above, but save in the file @var{defines-file}. - -@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 look-ahead -Implies @code{state} and augments the description of the automaton with -each rule's look-ahead 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 -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 -Output a @acronym{VCG} definition of the @acronym{LALR}(1) grammar -automaton computed by Bison. If the grammar file is @file{foo.y}, the -@acronym{VCG} output file will -be @file{foo.vcg}. - -@item --graph=@var{graph-file} -The behavior of @var{--graph} is the same than @samp{-g}. The only -difference is that it has an optional argument which is the name of -the output graph file. -@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 -@item @option{--debug} @tab @option{-t} -@item @option{--defines=@var{defines-file}} @tab @option{-d} -@item @option{--file-prefix=@var{prefix}} @tab @option{-b @var{file-prefix}} -@item @option{--graph=@var{graph-file}} @tab @option{-d} -@item @option{--help} @tab @option{-h} -@item @option{--name-prefix=@var{prefix}} @tab @option{-p @var{name-prefix}} -@item @option{--no-lines} @tab @option{-l} -@item @option{--no-parser} @tab @option{-n} -@item @option{--output=@var{outfile}} @tab @option{-o @var{outfile}} -@item @option{--print-localedir} @tab -@item @option{--token-table} @tab @option{-k} -@item @option{--verbose} @tab @option{-v} -@item @option{--version} @tab @option{-V} -@item @option{--yacc} @tab @option{-y} -@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 C++ Language Interface -@chapter C++ Language Interface - -@menu -* C++ Parsers:: The interface to generate C++ parser classes -* A Complete C++ Example:: Demonstrating their use -@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 -@end menu - -@node C++ Bison Interface -@subsection C++ Bison Interface -@c - %skeleton "lalr1.cc" -@c - Always pure -@c - initial action - -The C++ parser @acronym{LALR}(1) skeleton is named @file{lalr1.cc}. To -select it, you may either pass the option @option{--skeleton=lalr1.cc} -to Bison, or include the directive @samp{%skeleton "lalr1.cc"} in the -grammar preamble. When run, @command{bison} will create several -entities in the @samp{yy} namespace. Use the @samp{%name-prefix} -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 - YSTYPE -@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{%pure-parser} 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 -@section 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 -@subsection 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 -@subsection 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 -// Announce to Flex the prototype we want for lexing function, ... -# 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. -members. - -@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 - // Handling the parser. - void 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 () -@{ -@} - -void -calcxx_driver::parse (const std::string &f) -@{ - file = f; - scan_begin (); - yy::calcxx_parser parser (*this); - parser.set_debug_level (trace_parsing); - parser.parse (); - scan_end (); -@} - -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 -@subsection 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 "2.1a" -%defines -%define "parser_class_name" "calcxx_parser" -@end example - -@noindent -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. - -@comment file: calc++-parser.yy -@example -%@{ -# 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 -The code between @samp{%@{} and @samp{%@}} after the introduction of the -@samp{%union} is output in the @file{*.cc} file; it needs detailed -knowledge about the driver. - -@comment file: calc++-parser.yy -@example -%@{ -# 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 "expression" -@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 () << $$; @} "number" "expression" -@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; @}; - -%left '+' '-'; -%left '*' '/'; -exp: exp '+' exp @{ $$ = $1 + $3; @} - | exp '-' exp @{ $$ = $1 - $3; @} - | exp '*' exp @{ $$ = $1 * $3; @} - | exp '/' exp @{ $$ = $1 / $3; @} - | "identifier" @{ $$ = driver.variables[*$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 -@subsection 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 (!(yyin = fopen (file.c_str (), "r"))) - error (std::string ("cannot open ") + file); -@} - -void -calcxx_driver::scan_end () -@{ - fclose (yyin); -@} -@end example - -@node Calc++ Top Level -@subsection 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 - @{ - driver.parse (*argv); - std::cout << driver.result << std::endl; - @} -@} -@end example - -@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 -* Other Languages:: Parsers in Java and others -* 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 I needed a @code{%pure-parser}. -@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 Other Languages -@section Other Languages - -@display -Will Bison ever have C++ support? How about Java or @var{insert your -favorite language here}? -@end display - -C++ 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 {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} %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} %defines -Bison declaration to create a header file meant for the scanner. -@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 look-ahead token. Actions -corresponding to @code{error} are then executed, and the look-ahead -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} %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 -Bison declaration to request a pure (reentrant) parser. -@xref{Pure Decl, ,A Pure (Reentrant) Parser}. -@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} %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}}. -@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}}. -@end deffn - -@deffn {Macro} YYBACKUP -Macro to discard a value from the parser stack and fake a look-ahead -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 -look-ahead 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 -look-ahead 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}. -@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 look-ahead 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 look-ahead 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}.) -@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 {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 Look-ahead token -A token already read but not yet shifted. @xref{Look-Ahead, ,Look-Ahead -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 -look-ahead 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 - -@menu -* GNU Free Documentation License:: License for copying this manual. -@end menu - -@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 Gen Comp Expr ltcalc mfcalc Decl Symtab 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 preg 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 typefull 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 VCG notype -@c LocalWords: hexflag STR exdent itemset asis DYYDEBUG YYFPRINTF args -@c LocalWords: YYPRINTF infile ypp yxx outfile itemx vcg tex leaderfill -@c LocalWords: hbox hss hfill tt ly yyin fopen fclose ofirst gcc ll -@c LocalWords: yyrestart nbar yytext fst snd osplit ntwo strdup AST -@c LocalWords: YYSTACK DVI fdl printindex diff --git a/src/bin/bison/doc/fdl.texi b/src/bin/bison/doc/fdl.texi deleted file mode 100644 index fe78df8d53..0000000000 --- a/src/bin/bison/doc/fdl.texi +++ /dev/null @@ -1,452 +0,0 @@ - -@node GNU Free Documentation License -@appendixsec GNU Free Documentation License - -@cindex FDL, GNU Free Documentation License -@center Version 1.2, November 2002 - -@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 -@appendixsubsec 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...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/src/bin/bison/doc/gpl.texi b/src/bin/bison/doc/gpl.texi deleted file mode 100644 index 9903fc8872..0000000000 --- a/src/bin/bison/doc/gpl.texi +++ /dev/null @@ -1,392 +0,0 @@ -@node Copying -@unnumbered GNU GENERAL PUBLIC LICENSE -@center Version 2, June 1991 - -@c This file is intended to be included in another file. - -@display -Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, 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 - -@unnumberedsec Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software---to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) 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 -this service 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 make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. 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. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - -@iftex -@unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -@end iftex -@ifinfo -@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -@end ifinfo - -@enumerate 0 -@item -This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The ``Program'', below, -refers to any such program or work, and a ``work based on the Program'' -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term ``modification''.) Each licensee is addressed as ``you''. - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - -@item -You may copy and distribute 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 and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -@item -You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - -@enumerate a -@item -You must cause the modified files to carry prominent notices -stating that you changed the files and the date of any change. - -@item -You must cause any work that you distribute or publish, that in -whole or in part contains or is derived from the Program or any -part thereof, to be licensed as a whole at no charge to all third -parties under the terms of this License. - -@item -If the modified program normally reads commands interactively -when run, you must cause it, when started running for such -interactive use in the most ordinary way, to print or display an -announcement including an appropriate copyright notice and a -notice that there is no warranty (or else, saying that you provide -a warranty) and that users may redistribute the program under -these conditions, and telling the user how to view a copy of this -License. (Exception: if the Program itself is interactive but -does not normally print such an announcement, your work based on -the Program is not required to print an announcement.) -@end enumerate - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - -@item -You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - -@enumerate a -@item -Accompany it with the complete corresponding machine-readable -source code, which must be distributed under the terms of Sections -1 and 2 above on a medium customarily used for software interchange; or, - -@item -Accompany it with a written offer, valid for at least three -years, to give any third party, for a charge no more than your -cost of physically performing source distribution, a complete -machine-readable copy of the corresponding source code, to be -distributed under the terms of Sections 1 and 2 above on a medium -customarily used for software interchange; or, - -@item -Accompany it with the information you received as to the offer -to distribute corresponding source code. (This alternative is -allowed only for noncommercial distribution and only if you -received the program in object code or executable form with such -an offer, in accord with Subsection b above.) -@end enumerate - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - -@item -You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program 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 -You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - -@item -Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - -@item -If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -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 -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - -@item -If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - -@item -The Free Software Foundation may publish revised and/or new versions -of the 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 a version number of this License which applies to it and ``any -later version'', you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - -@item -If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - -@iftex -@heading NO WARRANTY -@end iftex -@ifinfo -@center NO WARRANTY -@end ifinfo - -@item -BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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 -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE 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. -@end enumerate - -@iftex -@heading END OF TERMS AND CONDITIONS -@end iftex -@ifinfo -@center END OF TERMS AND CONDITIONS -@end ifinfo - -@page -@unnumberedsec Appendix: 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 -convey the exclusion of warranty; and each file should have at least -the ``copyright'' line and a pointer to where the full notice is found. - -@smallexample -@var{one line to give the program's name and a brief idea of what it does.} -Copyright (C) @var{yyyy} @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 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. -@end smallexample - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - -@smallexample -Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author} -Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. -This is free software, and you are welcome to redistribute it -under certain conditions; type `show c' for details. -@end smallexample - -The hypothetical commands @samp{show w} and @samp{show c} should show -the appropriate parts of the General Public License. Of course, the -commands you use may be called something other than @samp{show w} and -@samp{show c}; they could even be mouse-clicks or menu items---whatever -suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a ``copyright disclaimer'' for the program, if -necessary. Here is a sample; alter the names: - -@example -Yoyodyne, Inc., hereby disclaims all copyright interest in the program -`Gnomovision' (which makes passes at compilers) written by James Hacker. - -@var{signature of Ty Coon}, 1 April 1989 -Ty Coon, President of Vice -@end example - -This 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 Library General -Public License instead of this License. diff --git a/src/bin/bison/doc/refcard.tex b/src/bin/bison/doc/refcard.tex deleted file mode 100644 index 3f2ec9b309..0000000000 --- a/src/bin/bison/doc/refcard.tex +++ /dev/null @@ -1,512 +0,0 @@ -% 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. -% -% Bison is free software; you can redistribute them and/or modify them -% 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 either Flex or Bison; see the file COPYING. If not, write -% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -% Boston, MA 02110-1301, USA. -% -% 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 look ahead 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 look-ahead token.} {YYEMPTY} -\key{Clear previous look ahead 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/src/bin/bison/doc/stamp-vti b/src/bin/bison/doc/stamp-vti deleted file mode 100644 index e3b7603fcc..0000000000 --- a/src/bin/bison/doc/stamp-vti +++ /dev/null @@ -1,4 +0,0 @@ -@set UPDATED 30 May 2006 -@set UPDATED-MONTH May 2006 -@set EDITION 2.3 -@set VERSION 2.3 diff --git a/src/bin/bison/doc/version.texi b/src/bin/bison/doc/version.texi deleted file mode 100644 index e3b7603fcc..0000000000 --- a/src/bin/bison/doc/version.texi +++ /dev/null @@ -1,4 +0,0 @@ -@set UPDATED 30 May 2006 -@set UPDATED-MONTH May 2006 -@set EDITION 2.3 -@set VERSION 2.3 diff --git a/src/bin/bison/lib/Jamfile b/src/bin/bison/lib/Jamfile deleted file mode 100644 index e6086e9826..0000000000 --- a/src/bin/bison/lib/Jamfile +++ /dev/null @@ -1,46 +0,0 @@ -SubDir HAIKU_TOP src bin bison lib ; - -SubDirCcFlags -DHAVE_CONFIG_H ; - -SubDirSysHdrs $(SUBDIR) ; -SubDirSysHdrs [ FDirName $(SUBDIR) $(DOTDOT) ] ; - -StaticLibrary libbison.a : - abitset.c -# alloca.c - argmatch.c - basename.c - bitset.c - bitset_stats.c - bitsetv-print.c - bitsetv.c - dirname.c - dup-safer.c - ebitset.c - error.c - exitfail.c - fd-safer.c - fopen-safer.c - get-errno.c - getopt.c - getopt1.c - hard-locale.c - hash.c - lbitset.c - malloc.c - mbswidth.c - obstack.c - quote.c - quotearg.c - stpcpy.c - stripslash.c - strndup.c - strnlen.c - strverscmp.c - subpipe.c - timevar.c - vbitset.c - xmalloc.c - xalloc-die.c - xstrndup.c -; diff --git a/src/bin/bison/lib/Makefile.am b/src/bin/bison/lib/Makefile.am deleted file mode 100644 index f4d783e264..0000000000 --- a/src/bin/bison/lib/Makefile.am +++ /dev/null @@ -1,53 +0,0 @@ -## 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 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 - -AM_CFLAGS = $(WARNING_CFLAGS) - -BUILT_SOURCES = -EXTRA_DIST = -MOSTLYCLEANFILES = - -lib_LIBRARIES = $(YACC_LIBRARY) -EXTRA_LIBRARIES = liby.a -noinst_LIBRARIES = libbison.a - -liby_a_SOURCES = main.c yyerror.c - -libbison_a_SOURCES = $(lib_SOURCES) -lib_SOURCES = \ - get-errno.h get-errno.c \ - subpipe.h subpipe.c \ - $(bitsets_sources) $(additional_bitsets_sources) $(timevars_sources) - -# 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 - -libbison_a_LIBADD = $(LIBOBJS) $(ALLOCA) -libbison_a_DEPENDENCIES = $(libbison_a_LIBADD) - -include gnulib.mk diff --git a/src/bin/bison/lib/Makefile.in b/src/bin/bison/lib/Makefile.in deleted file mode 100644 index d3613e96bc..0000000000 --- a/src/bin/bison/lib/Makefile.in +++ /dev/null @@ -1,623 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 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@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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 = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/gnulib.mk dirname.c dirname.h dup-safer.c error.c \ - error.h exitfail.c exitfail.h fd-safer.c fopen-safer.c \ - getopt.c getopt1.c hard-locale.c hard-locale.h hash.c hash.h \ - malloc.c obstack.c obstack.h pipe-safer.c quote.c quote.h \ - quotearg.c quotearg.h stdio--.h stdio-safer.h stpcpy.c \ - strdup.c strdup.h strerror.c strndup.c strndup.h strnlen.c \ - strnlen.h strtol.c strtoul.c strverscmp.c strverscmp.h \ - unistd--.h unistd-safer.h unlocked-io.h xalloc.h xmalloc.c -subdir = lib -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/bison-i18n.m4 \ - $(top_srcdir)/m4/c-working.m4 $(top_srcdir)/m4/cxx.m4 \ - $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ - $(top_srcdir)/m4/dos.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_gl.m4 \ - $(top_srcdir)/m4/gnulib.m4 $(top_srcdir)/m4/hard-locale.m4 \ - $(top_srcdir)/m4/hash.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/inttypes_h_gl.m4 \ - $(top_srcdir)/m4/lib-ld_gl.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix_gl.m4 $(top_srcdir)/m4/m4.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/obstack.m4 $(top_srcdir)/m4/onceonly.m4 \ - $(top_srcdir)/m4/po_gl.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \ - $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \ - $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.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/uintmax_t_gl.m4 \ - $(top_srcdir)/m4/ulonglong_gl.m4 \ - $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.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 = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/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 = @LIBOBJS@ -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__objects_4 = get-errno.$(OBJEXT) subpipe.$(OBJEXT) $(am__objects_1) \ - $(am__objects_2) $(am__objects_3) argmatch.$(OBJEXT) \ - basename.$(OBJEXT) stripslash.$(OBJEXT) mbswidth.$(OBJEXT) \ - xalloc-die.$(OBJEXT) xstrndup.$(OBJEXT) -am_libbison_a_OBJECTS = $(am__objects_4) -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) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -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) $(liby_a_SOURCES) -DIST_SOURCES = $(libbison_a_SOURCES) $(liby_a_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOM4TE = @AUTOM4TE@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BISON_CXX_WORKS = @BISON_CXX_WORKS@ -BISON_CXX_WORKS_FALSE = @BISON_CXX_WORKS_FALSE@ -BISON_CXX_WORKS_TRUE = @BISON_CXX_WORKS_TRUE@ -BISON_LOCALEDIR = @BISON_LOCALEDIR@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -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@ -EXEEXT = @EXEEXT@ -GCC = @GCC@ -GETOPT_H = @GETOPT_H@ -GMSGFMT = @GMSGFMT@ -HAVE__BOOL = @HAVE__BOOL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -O0CFLAGS = @O0CFLAGS@ -O0CXXFLAGS = @O0CXXFLAGS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STDBOOL_H = @STDBOOL_H@ -STRIP = @STRIP@ -UNISTD_H = @UNISTD_H@ -USE_NLS = @USE_NLS@ -VALGRIND = @VALGRIND@ -VERSION = @VERSION@ -WARNING_CFLAGS = @WARNING_CFLAGS@ -WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ -WERROR_CFLAGS = @WERROR_CFLAGS@ -XGETTEXT = @XGETTEXT@ -YACC = @YACC@ -YACC_LIBRARY = @YACC_LIBRARY@ -YACC_SCRIPT = @YACC_SCRIPT@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -aclocaldir = @aclocaldir@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -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@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -AM_CFLAGS = $(WARNING_CFLAGS) -BUILT_SOURCES = $(GETOPT_H) $(STDBOOL_H) $(UNISTD_H) -EXTRA_DIST = getopt_.h getopt_int.h stdbool_.h -MOSTLYCLEANFILES = getopt.h getopt.h-t stdbool.h stdbool.h-t unistd.h -lib_LIBRARIES = $(YACC_LIBRARY) -EXTRA_LIBRARIES = liby.a -noinst_LIBRARIES = libbison.a -liby_a_SOURCES = main.c yyerror.c -libbison_a_SOURCES = $(lib_SOURCES) - -# This file is generated automatically by "bootstrap". - -# 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". -# (commented out by bootstrap) AM_CPPFLAGS += -I$(top_builddir)/intl -lib_SOURCES = get-errno.h get-errno.c subpipe.h subpipe.c \ - $(bitsets_sources) $(additional_bitsets_sources) \ - $(timevars_sources) argmatch.h argmatch.c basename.c \ - stripslash.c exit.h gettext.h mbswidth.h mbswidth.c stpcpy.h \ - verify.h xalloc-die.c xstrndup.h xstrndup.c - -# 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 - -libbison_a_LIBADD = $(LIBOBJS) $(ALLOCA) -libbison_a_DEPENDENCIES = $(libbison_a_LIBADD) -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .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) --gnu lib/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu 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 -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) -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 - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@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)/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)/getopt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt1.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/hard-locale.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/hash.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/malloc.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)/strdup.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strerror.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)/xmalloc.Po@am__quote@ -@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)/ebitset.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-errno.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lbitset.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbswidth.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stripslash.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)/vbitset.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xalloc-die.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@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@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@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@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) '$<'` -uninstall-info-am: - -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; } \ - END { 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; } \ - END { 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=; \ - 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; } \ - END { 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)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - 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 $(LIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(libdir)"; 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." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -clean: clean-am - -clean-am: clean-generic clean-libLIBRARIES clean-noinstLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf $(DEPDIR) ./$(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-exec-am: install-libLIBRARIES - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf $(DEPDIR) ./$(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-info-am uninstall-libLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLIBRARIES clean-noinstLIBRARIES 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-exec install-exec-am \ - install-info install-info-am install-libLIBRARIES install-man \ - 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 uninstall-info-am \ - uninstall-libLIBRARIES - - -# We need the following in order to create when the system -# doesn't have one that works with the given compiler. -getopt.h: getopt_.h - cp $(srcdir)/getopt_.h $@-t - mv $@-t $@ - -# We need the following in order to create when the system -# doesn't have one that works. -stdbool.h: stdbool_.h - sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.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: - echo '/* Empty placeholder for $@. */' >$@ -# 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/bin/bison/lib/abitset.c b/src/bin/bison/lib/abitset.c deleted file mode 100644 index 17c0a4af5a..0000000000 --- a/src/bin/bison/lib/abitset.c +++ /dev/null @@ -1,828 +0,0 @@ -/* 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#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/src/bin/bison/lib/abitset.h b/src/bin/bison/lib/abitset.h deleted file mode 100644 index a22c9191ce..0000000000 --- a/src/bin/bison/lib/abitset.h +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 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. */ - -#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/src/bin/bison/lib/argmatch.c b/src/bin/bison/lib/argmatch.c deleted file mode 100644 index 36d5845acb..0000000000 --- a/src/bin/bison/lib/argmatch.c +++ /dev/null @@ -1,281 +0,0 @@ -/* argmatch.c -- find a match for a string in an array - - Copyright (C) 1990, 1998, 1999, 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 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. */ - -/* Written by David MacKenzie - Modified by Akim Demaille */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -/* Specification. */ -#include "argmatch.h" - -#include -#include -#include -#include - -#include "gettext.h" -#define _(msgid) gettext (msgid) - -#include "error.h" -#include "exit.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/src/bin/bison/lib/argmatch.h b/src/bin/bison/lib/argmatch.h deleted file mode 100644 index f2dfe59bda..0000000000 --- a/src/bin/bison/lib/argmatch.h +++ /dev/null @@ -1,103 +0,0 @@ -/* 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 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. */ - -/* 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/src/bin/bison/lib/basename.c b/src/bin/bison/lib/basename.c deleted file mode 100644 index 5cc97cd4a4..0000000000 --- a/src/bin/bison/lib/basename.c +++ /dev/null @@ -1,79 +0,0 @@ -/* basename.c -- return the last element in a file name - - Copyright (C) 1990, 1998, 1999, 2000, 2001, 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "dirname.h" -#include - -/* 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 address of the last file name component of NAME. If - NAME has no file name components because it is all slashes, return - NAME if it is empty, the address of its last slash otherwise. */ - -char * -base_name (char const *name) -{ - char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); - char const *p; - - for (p = base; *p; p++) - { - if (ISSLASH (*p)) - { - /* Treat multiple adjacent slashes like a single slash. */ - do p++; - while (ISSLASH (*p)); - - /* If the file name ends in slash, use the trailing slash as - the basename if no non-slashes have been found. */ - if (! *p) - { - if (ISSLASH (*base)) - base = p - 1; - break; - } - - /* *P is a non-slash preceded by a slash. */ - base = p; - } - } - - return (char *) base; -} - -/* Return the length of of the basename NAME. Typically NAME is the - value returned by base_name. Act like strlen (NAME), except omit - redundant trailing slashes. */ - -size_t -base_len (char const *name) -{ - size_t len; - - for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--) - continue; - - return len; -} diff --git a/src/bin/bison/lib/bbitset.h b/src/bin/bison/lib/bbitset.h deleted file mode 100644 index 956fc5c6db..0000000000 --- a/src/bin/bison/lib/bbitset.h +++ /dev/null @@ -1,302 +0,0 @@ -/* 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 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. */ - -#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/src/bin/bison/lib/bitset.c b/src/bin/bison/lib/bitset.c deleted file mode 100644 index 2924567e9f..0000000000 --- a/src/bin/bison/lib/bitset.c +++ /dev/null @@ -1,505 +0,0 @@ -/* 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include "bitset.h" -#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/src/bin/bison/lib/bitset.h b/src/bin/bison/lib/bitset.h deleted file mode 100644 index 45c8818cc9..0000000000 --- a/src/bin/bison/lib/bitset.h +++ /dev/null @@ -1,392 +0,0 @@ -/* 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 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. */ - -#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/src/bin/bison/lib/bitset_stats.c b/src/bin/bison/lib/bitset_stats.c deleted file mode 100644 index 7b7fb341d9..0000000000 --- a/src/bin/bison/lib/bitset_stats.c +++ /dev/null @@ -1,730 +0,0 @@ -/* 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 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. */ - -/* 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "bbitset.h" -#include "abitset.h" -#include "ebitset.h" -#include "lbitset.h" -#include "vbitset.h" -#include "bitset_stats.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/src/bin/bison/lib/bitset_stats.h b/src/bin/bison/lib/bitset_stats.h deleted file mode 100644 index 6378c5cac1..0000000000 --- a/src/bin/bison/lib/bitset_stats.h +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 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. */ - -#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/src/bin/bison/lib/bitsetv-print.c b/src/bin/bison/lib/bitsetv-print.c deleted file mode 100644 index 00838713e4..0000000000 --- a/src/bin/bison/lib/bitsetv-print.c +++ /dev/null @@ -1,71 +0,0 @@ -/* 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include "bitsetv-print.h" - -/*--------------------------------------------------------. -| 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/src/bin/bison/lib/bitsetv-print.h b/src/bin/bison/lib/bitsetv-print.h deleted file mode 100644 index e54be683b9..0000000000 --- a/src/bin/bison/lib/bitsetv-print.h +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 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. */ - -#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/src/bin/bison/lib/bitsetv.c b/src/bin/bison/lib/bitsetv.c deleted file mode 100644 index ae79853c8b..0000000000 --- a/src/bin/bison/lib/bitsetv.c +++ /dev/null @@ -1,169 +0,0 @@ -/* 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include "bitsetv.h" - - -/* 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/src/bin/bison/lib/bitsetv.h b/src/bin/bison/lib/bitsetv.h deleted file mode 100644 index 652f9e39de..0000000000 --- a/src/bin/bison/lib/bitsetv.h +++ /dev/null @@ -1,59 +0,0 @@ -/* 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 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. */ - -#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/src/bin/bison/lib/dirname.c b/src/bin/bison/lib/dirname.c deleted file mode 100644 index e2b9d648c3..0000000000 --- a/src/bin/bison/lib/dirname.c +++ /dev/null @@ -1,121 +0,0 @@ -/* dirname.c -- return all but the last element in a file name - - Copyright (C) 1990, 1998, 2000, 2001, 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "dirname.h" - -#include -#include "xalloc.h" - -/* Return the length of `dirname (FILE)', or zero if FILE is - in the working directory. 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; - - /* Strip the basename and any redundant slashes before it. */ - for (length = base_name (file) - file; prefix_length < length; length--) - if (! ISSLASH (file[length - 1])) - return length; - - /* But don't strip the only slash from "/". */ - return prefix_length + ISSLASH (file[prefix_length]); -} - -/* Return the leading directories part of FILE, - allocated with xmalloc. - Works properly even if there are trailing slashes - (by effectively ignoring them). */ - -char * -dir_name (char const *file) -{ - size_t length = dir_len (file); - bool append_dot = (length == FILE_SYSTEM_PREFIX_LEN (file)); - char *dir = xmalloc (length + append_dot + 1); - memcpy (dir, file, length); - if (append_dot) - dir[length++] = '.'; - dir[length] = 0; - return dir; -} - -#ifdef TEST_DIRNAME -/* - -Run the test like this (expect no output): - gcc -DHAVE_CONFIG_H -DTEST_DIRNAME -I.. -O -Wall \ - basename.c dirname.c xmalloc.c error.c - sed -n '/^BEGIN-DATA$/,/^END-DATA$/p' dirname.c|grep -v DATA|./a.out - -If it's been built on a DOS or Windows platforms, run another test like -this (again, expect no output): - sed -n '/^BEGIN-DOS-DATA$/,/^END-DOS-DATA$/p' dirname.c|grep -v DATA|./a.out - -BEGIN-DATA -foo//// . -bar/foo//// bar -foo/ . -/ / -. . -a . -END-DATA - -BEGIN-DOS-DATA -c:///// c:/ -c:/ c:/ -c:/. c:/ -c:foo c:. -c:foo/bar c:foo -END-DOS-DATA - -*/ - -# define MAX_BUFF_LEN 1024 -# include - -char *program_name; - -int -main (int argc, char *argv[]) -{ - char buff[MAX_BUFF_LEN + 1]; - - program_name = argv[0]; - - buff[MAX_BUFF_LEN] = 0; - while (fgets (buff, MAX_BUFF_LEN, stdin) && buff[0]) - { - char file[MAX_BUFF_LEN]; - char expected_result[MAX_BUFF_LEN]; - char const *result; - sscanf (buff, "%s %s", file, expected_result); - result = dir_name (file); - if (strcmp (result, expected_result)) - printf ("%s: got %s, expected %s\n", file, result, expected_result); - } - return 0; -} -#endif diff --git a/src/bin/bison/lib/dirname.h b/src/bin/bison/lib/dirname.h deleted file mode 100644 index 1688ae8104..0000000000 --- a/src/bin/bison/lib/dirname.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Take file names apart into directory and base names. - - Copyright (C) 1998, 2001, 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 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. */ - -#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 -# define FILE_SYSTEM_PREFIX_LEN(File_name) 0 -# endif - -# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) -# 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); - -bool strip_trailing_slashes (char *file); - -#endif /* not DIRNAME_H_ */ diff --git a/src/bin/bison/lib/dup-safer.c b/src/bin/bison/lib/dup-safer.c deleted file mode 100644 index 8cbee7007b..0000000000 --- a/src/bin/bison/lib/dup-safer.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Invoke dup, but avoid some glitches. - Copyright (C) 2001, 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 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. */ - -/* Written by Paul Eggert. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#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) -{ -#ifdef F_DUPFD - 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/src/bin/bison/lib/ebitset.c b/src/bin/bison/lib/ebitset.c deleted file mode 100644 index cedf0e2823..0000000000 --- a/src/bin/bison/lib/ebitset.c +++ /dev/null @@ -1,1366 +0,0 @@ -/* 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#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/src/bin/bison/lib/ebitset.h b/src/bin/bison/lib/ebitset.h deleted file mode 100644 index dc602734a0..0000000000 --- a/src/bin/bison/lib/ebitset.h +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 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. */ - -#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/src/bin/bison/lib/error.c b/src/bin/bison/lib/error.c deleted file mode 100644 index 45698be8da..0000000000 --- a/src/bin/bison/lib/error.c +++ /dev/null @@ -1,304 +0,0 @@ -/* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-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 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. */ - -/* Written by David MacKenzie . */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "error.h" - -#include -#include -#include -#include - -#if !_LIBC && ENABLE_NLS -# include "gettext.h" -#endif - -#ifdef _LIBC -# 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 - -/* 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 - -# ifndef SIZE_MAX -# define SIZE_MAX ((size_t) -1) -# 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 -#endif /* not _LIBC */ - -static void -print_errno_message (int errnum) -{ - char const *s = NULL; - -#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; -# endif -#endif - -#if !_LIBC - if (! s && ! (s = strerror (errnum))) - s = _("Unknown system error"); -#endif - -#if _LIBC - if (_IO_fwide (stderr, 0) > 0) - { - __fwprintf (stderr, L": %s", s); - return; - } -#endif - - fprintf (stderr, ": %s", s); -} - -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; - const wchar_t *wmessage = L"out of memory"; - wchar_t *wbuf = (len < ALLOCA_LIMIT - ? alloca (len * sizeof *wbuf) - : len <= SIZE_MAX / sizeof *wbuf - ? malloc (len * sizeof *wbuf) - : NULL); - - if (wbuf) - { - size_t res; - mbstate_t st; - const char *tmp = message; - memset (&st, '\0', sizeof (st)); - res = mbsrtowcs (wbuf, &tmp, len, &st); - wmessage = res == (size_t) -1 ? L"???" : wbuf; - } - - __vfwprintf (stderr, wmessage, args); - if (! (len < ALLOCA_LIMIT)) - free (wbuf); - } - else -#endif - vfprintf (stderr, message, args); - va_end (args); - - ++error_message_count; - if (errnum) - print_errno_message (errnum); -#if _LIBC - if (_IO_fwide (stderr, 0) > 0) - putwc (L'\n', stderr); - else -#endif - putc ('\n', stderr); - 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 - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s: ", program_name); - else -#endif - fprintf (stderr, "%s: ", program_name); - } - - 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 - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s: ", program_name); - else -#endif - fprintf (stderr, "%s:", program_name); - } - - if (file_name != NULL) - { -#if _LIBC - if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s:%d: ", file_name, line_number); - else -#endif - fprintf (stderr, "%s:%d: ", file_name, line_number); - } - - 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/src/bin/bison/lib/error.h b/src/bin/bison/lib/error.h deleted file mode 100644 index e5220a2f13..0000000000 --- a/src/bin/bison/lib/error.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Declaration for error-reporting function - Copyright (C) 1995, 1996, 1997, 2003 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 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. */ - -#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/src/bin/bison/lib/exit.h b/src/bin/bison/lib/exit.h deleted file mode 100644 index 9dbfb7ce85..0000000000 --- a/src/bin/bison/lib/exit.h +++ /dev/null @@ -1,32 +0,0 @@ -/* exit() function. - Copyright (C) 1995, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _EXIT_H -#define _EXIT_H - -/* Get exit() declaration. */ -#include - -/* Some systems do not define EXIT_*, even with STDC_HEADERS. */ -#ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -#endif -#ifndef EXIT_FAILURE -# define EXIT_FAILURE 1 -#endif - -#endif /* _EXIT_H */ diff --git a/src/bin/bison/lib/exitfail.c b/src/bin/bison/lib/exitfail.c deleted file mode 100644 index 27d38c32a4..0000000000 --- a/src/bin/bison/lib/exitfail.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Failure exit status - - 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 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; see the file COPYING. - If not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "exitfail.h" -#include "exit.h" - -int volatile exit_failure = EXIT_FAILURE; diff --git a/src/bin/bison/lib/exitfail.h b/src/bin/bison/lib/exitfail.h deleted file mode 100644 index e46cf9c166..0000000000 --- a/src/bin/bison/lib/exitfail.h +++ /dev/null @@ -1,20 +0,0 @@ -/* 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 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; see the file COPYING. - If not, write to the Free Software Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -extern int volatile exit_failure; diff --git a/src/bin/bison/lib/fd-safer.c b/src/bin/bison/lib/fd-safer.c deleted file mode 100644 index 5933bcbd12..0000000000 --- a/src/bin/bison/lib/fd-safer.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Return a safer copy of a file descriptor. - - 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 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. */ - -/* Written by Paul Eggert. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#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/src/bin/bison/lib/fopen-safer.c b/src/bin/bison/lib/fopen-safer.c deleted file mode 100644 index 4f2ffa1b85..0000000000 --- a/src/bin/bison/lib/fopen-safer.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Invoke fopen, but avoid some glitches. - Copyright (C) 2001, 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 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. */ - -/* Written by Paul Eggert. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#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/src/bin/bison/lib/get-errno.c b/src/bin/bison/lib/get-errno.c deleted file mode 100644 index 8e8ef58209..0000000000 --- a/src/bin/bison/lib/get-errno.c +++ /dev/null @@ -1,45 +0,0 @@ -/* 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 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. */ - -/* Written by Paul Eggert. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include "get-errno.h" - -/* 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/src/bin/bison/lib/get-errno.h b/src/bin/bison/lib/get-errno.h deleted file mode 100644 index d39a8dd664..0000000000 --- a/src/bin/bison/lib/get-errno.h +++ /dev/null @@ -1,20 +0,0 @@ -/* 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 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. */ - -extern int get_errno (void); -extern void set_errno (int); diff --git a/src/bin/bison/lib/getopt.c b/src/bin/bison/lib/getopt.c deleted file mode 100644 index 83bd6db430..0000000000 --- a/src/bin/bison/lib/getopt.c +++ /dev/null @@ -1,1191 +0,0 @@ -/* 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 - 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "getopt.h" - -#include -#include -#include -#include - -#ifdef VMS -# include -#endif - -#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/src/bin/bison/lib/getopt.h b/src/bin/bison/lib/getopt.h deleted file mode 100644 index 3c406e53dc..0000000000 --- a/src/bin/bison/lib/getopt.h +++ /dev/null @@ -1,225 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005 - 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 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. */ - -#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 '\0'. This behavior is specific to the GNU - `getopt'. */ - -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/src/bin/bison/lib/getopt1.c b/src/bin/bison/lib/getopt1.c deleted file mode 100644 index 25d792650f..0000000000 --- a/src/bin/bison/lib/getopt1.c +++ /dev/null @@ -1,174 +0,0 @@ -/* 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 - 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef _LIBC -# include -#else -# 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/src/bin/bison/lib/getopt_int.h b/src/bin/bison/lib/getopt_int.h deleted file mode 100644 index 401579fd28..0000000000 --- a/src/bin/bison/lib/getopt_int.h +++ /dev/null @@ -1,131 +0,0 @@ -/* 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 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. */ - -#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/src/bin/bison/lib/gettext.h b/src/bin/bison/lib/gettext.h deleted file mode 100644 index 285cb314ce..0000000000 --- a/src/bin/bison/lib/gettext.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Convenience header for conditional use of GNU . - Copyright (C) 1995-1998, 2000-2002, 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 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. */ - -#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 - -#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) ((const char *) (Msgid)) -# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) -# define ngettext(Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -# define dngettext(Domainname, Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -# define textdomain(Domainname) ((const char *) (Domainname)) -# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) -# define bind_textdomain_codeset(Domainname, Codeset) ((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 - -#endif /* _LIBGETTEXT_H */ diff --git a/src/bin/bison/lib/gnulib.mk b/src/bin/bison/lib/gnulib.mk deleted file mode 100644 index 3e7b28d4ec..0000000000 --- a/src/bin/bison/lib/gnulib.mk +++ /dev/null @@ -1,78 +0,0 @@ -# This file is generated automatically by "bootstrap". -lib_SOURCES += argmatch.h argmatch.c - -lib_SOURCES += basename.c stripslash.c - - -lib_SOURCES += exit.h - - - -BUILT_SOURCES += $(GETOPT_H) -EXTRA_DIST += getopt_.h getopt_int.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_.h - cp $(srcdir)/getopt_.h $@-t - mv $@-t $@ -MOSTLYCLEANFILES += getopt.h getopt.h-t - -# 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". -# (commented out by bootstrap) AM_CPPFLAGS += -I$(top_builddir)/intl - -lib_SOURCES += gettext.h - - - - - -lib_SOURCES += mbswidth.h mbswidth.c - - - - -BUILT_SOURCES += $(STDBOOL_H) -EXTRA_DIST += stdbool_.h - -# We need the following in order to create when the system -# doesn't have one that works. -stdbool.h: stdbool_.h - sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t - mv $@-t $@ -MOSTLYCLEANFILES += stdbool.h stdbool.h-t - - -lib_SOURCES += stpcpy.h - - - - - - - - -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: - echo '/* Empty placeholder for $@. */' >$@ -MOSTLYCLEANFILES += unistd.h - - - -lib_SOURCES += verify.h - - -lib_SOURCES += xalloc-die.c - -lib_SOURCES += xstrndup.h xstrndup.c - diff --git a/src/bin/bison/lib/hard-locale.c b/src/bin/bison/lib/hard-locale.c deleted file mode 100644 index 98530fcd5e..0000000000 --- a/src/bin/bison/lib/hard-locale.c +++ /dev/null @@ -1,75 +0,0 @@ -/* hard-locale.c -- Determine whether a locale is hard. - - Copyright (C) 1997, 1998, 1999, 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "hard-locale.h" - -#include -#include -#include - -#include "strdup.h" - -#ifdef __GLIBC__ -# define GLIBC_VERSION __GLIBC__ -#else -# define GLIBC_VERSION 0 -#endif - -/* Return true if the current CATEGORY locale is hard, i.e. if you - can't get away with assuming traditional C or POSIX behavior. */ -bool -hard_locale (int category) -{ - bool hard = true; - char const *p = setlocale (category, NULL); - - if (p) - { - if (2 <= GLIBC_VERSION) - { - if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0) - hard = false; - } - else - { - char *locale = strdup (p); - if (locale) - { - /* Temporarily set the locale to the "C" and "POSIX" locales - to find their names, so that we can determine whether one - or the other is the caller's locale. */ - if (((p = setlocale (category, "C")) - && strcmp (p, locale) == 0) - || ((p = setlocale (category, "POSIX")) - && strcmp (p, locale) == 0)) - hard = false; - - /* Restore the caller's locale. */ - setlocale (category, locale); - free (locale); - } - } - } - - return hard; -} diff --git a/src/bin/bison/lib/hard-locale.h b/src/bin/bison/lib/hard-locale.h deleted file mode 100644 index c5cedc0259..0000000000 --- a/src/bin/bison/lib/hard-locale.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Determine whether a locale is hard. - - Copyright (C) 1999, 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 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. */ - -#ifndef HARD_LOCALE_H_ -# define HARD_LOCALE_H_ 1 - -# include - -bool hard_locale (int); - -#endif /* HARD_LOCALE_H_ */ diff --git a/src/bin/bison/lib/hash.c b/src/bin/bison/lib/hash.c deleted file mode 100644 index f85bd519bf..0000000000 --- a/src/bin/bison/lib/hash.c +++ /dev/null @@ -1,1050 +0,0 @@ -/* hash - hashing table processing. - - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 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 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. */ - -/* 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! */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#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); - 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/src/bin/bison/lib/hash.h b/src/bin/bison/lib/hash.h deleted file mode 100644 index ab63a863fd..0000000000 --- a/src/bin/bison/lib/hash.h +++ /dev/null @@ -1,88 +0,0 @@ -/* 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 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. */ - -/* 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/src/bin/bison/lib/lbitset.c b/src/bin/bison/lib/lbitset.c deleted file mode 100644 index 7d47a052a8..0000000000 --- a/src/bin/bison/lib/lbitset.c +++ /dev/null @@ -1,1405 +0,0 @@ -/* 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#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/src/bin/bison/lib/lbitset.h b/src/bin/bison/lib/lbitset.h deleted file mode 100644 index aaad8345ef..0000000000 --- a/src/bin/bison/lib/lbitset.h +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 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. */ - -#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/src/bin/bison/lib/libiberty.h b/src/bin/bison/lib/libiberty.h deleted file mode 100644 index e8629e40a4..0000000000 --- a/src/bin/bison/lib/libiberty.h +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 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. */ - - -/* 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/src/bin/bison/lib/main.c b/src/bin/bison/lib/main.c deleted file mode 100644 index 98dedf979c..0000000000 --- a/src/bin/bison/lib/main.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Yacc library main function. - - Copyright (C) 2002 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 - -#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/src/bin/bison/lib/malloc.c b/src/bin/bison/lib/malloc.c deleted file mode 100644 index 58fa611682..0000000000 --- a/src/bin/bison/lib/malloc.c +++ /dev/null @@ -1,36 +0,0 @@ -/* malloc() function that is glibc compatible. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* written by Jim Meyering */ - -#ifdef HAVE_CONFIG_H -# include -#endif -#undef malloc - -#include - -/* 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) -{ - if (n == 0) - n = 1; - return malloc (n); -} diff --git a/src/bin/bison/lib/mbswidth.c b/src/bin/bison/lib/mbswidth.c deleted file mode 100644 index c9e78d6502..0000000000 --- a/src/bin/bison/lib/mbswidth.c +++ /dev/null @@ -1,221 +0,0 @@ -/* Determine the number of screen columns needed for a string. - Copyright (C) 2000-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 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. */ - -/* Written by Bruno Haible . */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -/* Specification. */ -#include "mbswidth.h" - -/* Get MB_CUR_MAX. */ -#include - -#include - -/* Get isprint(). */ -#include - -/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). */ -#if HAVE_WCHAR_H -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.1 has a bug: and must be included before - . */ -# include -# include -# include -#endif - -/* Get iswprint(), iswcntrl(). */ -#if HAVE_WCTYPE_H -# include -#endif -#if !defined iswprint && !HAVE_ISWPRINT -# define iswprint(wc) 1 -#endif -#if !defined iswcntrl && !HAVE_ISWCNTRL -# define iswcntrl(wc) 0 -#endif - -#ifndef mbsinit -# if !HAVE_MBSINIT -# define mbsinit(ps) 1 -# endif -#endif - -#ifndef HAVE_DECL_WCWIDTH -"this configure-time declaration test was not run" -#endif -#if !HAVE_DECL_WCWIDTH -int wcwidth (); -#endif - -#ifndef wcwidth -# if !HAVE_WCWIDTH -/* wcwidth doesn't exist, so assume all printable characters have - width 1. */ -# define wcwidth(wc) ((wc) == 0 ? 0 : iswprint (wc) ? 1 : -1) -# endif -#endif - -/* Get ISPRINT. */ -#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) -# define IN_CTYPE_DOMAIN(c) 1 -#else -# define IN_CTYPE_DOMAIN(c) isascii(c) -#endif -/* Undefine to protect against the definition in wctype.h of Solaris 2.6. */ -#undef ISPRINT -#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c)) -#undef ISCNTRL -#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c)) - -/* 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/src/bin/bison/lib/mbswidth.h b/src/bin/bison/lib/mbswidth.h deleted file mode 100644 index 1935e0a2dc..0000000000 --- a/src/bin/bison/lib/mbswidth.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Determine the number of screen columns needed for a string. - Copyright (C) 2000-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 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. */ - -#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/src/bin/bison/lib/obstack.c b/src/bin/bison/lib/obstack.c deleted file mode 100644 index 6df0611d26..0000000000 --- a/src/bin/bison/lib/obstack.c +++ /dev/null @@ -1,440 +0,0 @@ -/* 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 Free Software Foundation, - Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef _LIBC -# include -# include -#else -# 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 - - -# if HAVE_INTTYPES_H -# include -# endif -# if HAVE_STDINT_H || defined _LIBC -# include -# endif - -/* 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/src/bin/bison/lib/obstack.h b/src/bin/bison/lib/obstack.h deleted file mode 100644 index 95dd438ff7..0000000000 --- a/src/bin/bison/lib/obstack.h +++ /dev/null @@ -1,508 +0,0 @@ -/* obstack.h - object stack macros - Copyright (C) 1988-1994,1996-1999,2003,2004,2005 - 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 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. */ - -/* 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 *); - -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/src/bin/bison/lib/pipe-safer.c b/src/bin/bison/lib/pipe-safer.c deleted file mode 100644 index fb02d72177..0000000000 --- a/src/bin/bison/lib/pipe-safer.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Invoke pipe, but avoid some 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 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. */ - -/* Written by Jim Meyering. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "unistd-safer.h" - -#include - -/* Like pipe, but ensure that neither of the file descriptors is - STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. */ - -int -pipe_safer (int fd[2]) -{ - int fail = pipe (fd); - if (fail) - return fail; - - { - int i; - for (i = 0; i < 2; i++) - { - int f = fd_safer (fd[i]); - if (f < 0) - return -1; - fd[i] = f; - } - } - - return 0; -} diff --git a/src/bin/bison/lib/quote.c b/src/bin/bison/lib/quote.c deleted file mode 100644 index 16cc939c16..0000000000 --- a/src/bin/bison/lib/quote.c +++ /dev/null @@ -1,41 +0,0 @@ -/* quote.c - quote arguments for output - 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 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. */ - -/* Written by Paul Eggert */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#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/src/bin/bison/lib/quote.h b/src/bin/bison/lib/quote.h deleted file mode 100644 index 5400eadb65..0000000000 --- a/src/bin/bison/lib/quote.h +++ /dev/null @@ -1,22 +0,0 @@ -/* 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 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. */ - - -char const *quote_n (int n, char const *name); -char const *quote (char const *name); diff --git a/src/bin/bison/lib/quotearg.c b/src/bin/bison/lib/quotearg.c deleted file mode 100644 index 113239fb14..0000000000 --- a/src/bin/bison/lib/quotearg.c +++ /dev/null @@ -1,690 +0,0 @@ -/* quotearg.c - quote arguments for output - - Copyright (C) 1998, 1999, 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 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. */ - -/* Written by Paul Eggert */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "quotearg.h" - -#include "xalloc.h" - -#include -#include -#include -#include -#include -#include - -#include "gettext.h" -#define _(msgid) gettext (msgid) -#define N_(msgid) msgid - -#if HAVE_WCHAR_H - -/* BSD/OS 4.1 wchar.h requires FILE and struct tm to be declared. */ -# include -# include - -# include -#endif - -#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 -# 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 iswprint -# if HAVE_WCTYPE_H -# include -# endif -# if !defined iswprint && !HAVE_ISWPRINT -# define iswprint(wc) 1 -# endif -#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; - - /* 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", - "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, - 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 = xmalloc (sizeof *p); - *p = *(o ? o : &default_quoting_options); - 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; -} - -/* 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 and the - non-quoting-style part of O 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 uses QUOTING_STYLE instead of the quoting - style specified by O, and O may not be null. */ - -static size_t -quotearg_buffer_restyled (char *buffer, size_t buffersize, - char const *arg, size_t argsize, - enum quoting_style quoting_style, - struct quoting_options const *o) -{ - 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; - -#define STORE(c) \ - do \ - { \ - if (len < buffersize) \ - buffer[len] = (c); \ - len++; \ - } \ - while (0) - - switch (quoting_style) - { - case c_quoting_style: - STORE ('"'); - backslash_escapes = true; - quote_string = "\""; - quote_string_len = 1; - break; - - case escape_quoting_style: - backslash_escapes = true; - 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); - 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_always_quoting_style: - STORE ('\''); - quote_string = "'"; - quote_string_len = 1; - break; - - default: - break; - } - - 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) - STORE ('\\'); - - c = arg[i]; - switch (c) - { - case '\0': - if (backslash_escapes) - { - STORE ('\\'); - STORE ('0'); - STORE ('0'); - c = '0'; - } - break; - - case '?': - switch (quoting_style) - { - case shell_quoting_style: - goto use_shell_always_quoting_style; - - case c_quoting_style: - if (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. */ - c = arg[i + 2]; - i += 2; - 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; goto c_and_shell_escape; - - c_and_shell_escape: - if (quoting_style == shell_quoting_style) - goto use_shell_always_quoting_style; - 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_quoting_style) - goto use_shell_always_quoting_style; - break; - - case '\'': - switch (quoting_style) - { - case shell_quoting_style: - goto use_shell_always_quoting_style; - - case shell_always_quoting_style: - STORE ('\''); - STORE ('\\'); - STORE ('\''); - break; - - default: - break; - } - 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 && quoting_style == shell_quoting_style) - { - size_t j; - for (j = 1; j < bytes; j++) - switch (arg[i + m + j]) - { - case '[': case '\\': case '^': - case '`': case '|': - goto use_shell_always_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) - { - 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 - && o->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS)))) - goto store_c; - - store_escape: - STORE ('\\'); - - store_c: - STORE (c); - } - - if (i == 0 && quoting_style == shell_quoting_style) - goto use_shell_always_quoting_style; - - if (quote_string) - for (; *quote_string; quote_string++) - STORE (*quote_string); - - if (len < buffersize) - buffer[len] = '\0'; - return len; - - use_shell_always_quoting_style: - return quotearg_buffer_restyled (buffer, buffersize, arg, argsize, - shell_always_quoting_style, o); -} - -/* 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); - errno = e; - return r; -} - -/* Like quotearg_buffer (..., ARG, ARGSIZE, O), except return newly - allocated storage containing the quoted string. */ -char * -quotearg_alloc (char const *arg, size_t argsize, - struct quoting_options const *o) -{ - int e = errno; - size_t bufsize = quotearg_buffer (0, 0, arg, argsize, o) + 1; - char *buf = xmalloc (bufsize); - quotearg_buffer (buf, bufsize, arg, argsize, o); - errno = e; - return buf; -} - -/* 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; - - /* 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; - unsigned int n0 = n; - struct slotvec - { - size_t size; - char *val; - }; - static struct slotvec slotvec0 = {sizeof slot0, slot0}; - static struct slotvec *slotvec = &slotvec0; - - 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; - - if (xalloc_oversized (n1, sizeof *slotvec)) - xalloc_die (); - - if (slotvec == &slotvec0) - { - slotvec = xmalloc (sizeof *slotvec); - *slotvec = slotvec0; - } - slotvec = xrealloc (slotvec, n1 * sizeof *slotvec); - memset (slotvec + nslots, 0, (n1 - nslots) * sizeof *slotvec); - nslots = n1; - } - - { - size_t size = slotvec[n].size; - char *val = slotvec[n].val; - size_t qsize = quotearg_buffer (val, size, arg, argsize, options); - - if (size <= qsize) - { - slotvec[n].size = size = qsize + 1; - if (val != slot0) - free (val); - slotvec[n].val = val = xmalloc (size); - quotearg_buffer (val, size, arg, argsize, options); - } - - 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 (char const *arg) -{ - return quotearg_n (0, arg); -} - -/* 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; - memset (o.quote_these_too, 0, sizeof o.quote_these_too); - return o; -} - -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_char (char const *arg, char ch) -{ - struct quoting_options options; - options = default_quoting_options; - set_char_quoting (&options, ch, 1); - return quotearg_n_options (0, arg, SIZE_MAX, &options); -} - -char * -quotearg_colon (char const *arg) -{ - return quotearg_char (arg, ':'); -} diff --git a/src/bin/bison/lib/quotearg.h b/src/bin/bison/lib/quotearg.h deleted file mode 100644 index 24f26f7d41..0000000000 --- a/src/bin/bison/lib/quotearg.h +++ /dev/null @@ -1,137 +0,0 @@ -/* quotearg.h - quote arguments for output - - Copyright (C) 1998, 1999, 2000, 2001, 2002, 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 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. */ - -/* Written by Paul Eggert */ - -#ifndef QUOTEARG_H_ -# define QUOTEARG_H_ 1 - -# include - -/* Basic quoting styles. */ -enum quoting_style - { - /* Output names as-is (ls --quoting-style=literal). */ - literal_quoting_style, - - /* Quote names for the shell if they contain shell metacharacters - or would cause ambiguous output (ls --quoting-style=shell). */ - shell_quoting_style, - - /* Quote names for the shell, even if they would normally not - require quoting (ls --quoting-style=shell-always). */ - shell_always_quoting_style, - - /* Quote names as for a C language string (ls --quoting-style=c). */ - c_quoting_style, - - /* Like c_quoting_style except omit the surrounding double-quote - characters (ls --quoting-style=escape). */ - escape_quoting_style, - - /* Like clocale_quoting_style, but quote `like this' instead of - "like this" in the default C locale (ls --quoting-style=locale). */ - locale_quoting_style, - - /* Like c_quoting_style except use quotation marks appropriate for - the locale (ls --quoting-style=clocale). */ - clocale_quoting_style - }; - -/* 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); - -/* 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. */ -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. */ -char *quotearg_alloc (char const *arg, size_t argsize, - 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. */ -char *quotearg_n (int n, char const *arg); - -/* Equivalent to quotearg_n (0, ARG). */ -char *quotearg (char const *arg); - -/* 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); - -/* Like quotearg (ARG), except also quote any instances of CH. */ -char *quotearg_char (char const *arg, char ch); - -/* Equivalent to quotearg_char (ARG, ':'). */ -char *quotearg_colon (char const *arg); - -#endif /* !QUOTEARG_H_ */ diff --git a/src/bin/bison/lib/stdbool_.h b/src/bin/bison/lib/stdbool_.h deleted file mode 100644 index efa80ba921..0000000000 --- a/src/bin/bison/lib/stdbool_.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (C) 2001, 2002, 2003, 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 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. */ - -#ifndef _STDBOOL_H -#define _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. - - - 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. */ -#ifdef __BEOS__ -# 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__ - /* 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". - The only benefit of the enum type, debuggability, is not important - with these compilers. So use 'signed char' and no typedef. */ -# define _Bool signed char -enum { false = 0, true = 1 }; -# 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 /* _STDBOOL_H */ diff --git a/src/bin/bison/lib/stdio--.h b/src/bin/bison/lib/stdio--.h deleted file mode 100644 index b2765fd524..0000000000 --- a/src/bin/bison/lib/stdio--.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Like stdio.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 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. */ - -/* Written by Paul Eggert. */ - -#include -#include "stdio-safer.h" - -#undef fopen -#define fopen fopen_safer diff --git a/src/bin/bison/lib/stdio-safer.h b/src/bin/bison/lib/stdio-safer.h deleted file mode 100644 index 0b9a9ab80c..0000000000 --- a/src/bin/bison/lib/stdio-safer.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Invoke stdio functions, but avoid some glitches. - - Copyright (C) 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 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. */ - -/* Written by Paul Eggert. */ - -#include - -FILE *fopen_safer (char const *, char const *); diff --git a/src/bin/bison/lib/stpcpy.c b/src/bin/bison/lib/stpcpy.c deleted file mode 100644 index acda21a26f..0000000000 --- a/src/bin/bison/lib/stpcpy.c +++ /dev/null @@ -1,50 +0,0 @@ -/* stpcpy.c -- copy a string and return pointer to end of new string - Copyright (C) 1992, 1995, 1997, 1998 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#undef __stpcpy -#undef stpcpy - -#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/src/bin/bison/lib/stpcpy.h b/src/bin/bison/lib/stpcpy.h deleted file mode 100644 index 53c4ce00ab..0000000000 --- a/src/bin/bison/lib/stpcpy.h +++ /dev/null @@ -1,41 +0,0 @@ -/* String copying. - Copyright (C) 1995, 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 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. */ - -#ifndef _STPCPY_H -#define _STPCPY_H - -#if HAVE_STPCPY - -/* Get stpcpy() declaration. */ -#include - -#else - -#ifdef __cplusplus -extern "C" { -#endif - -/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ -extern char *stpcpy (char *dst, const char *src); - -#ifdef __cplusplus -} -#endif - -#endif - -#endif /* _STPCPY_H */ diff --git a/src/bin/bison/lib/strdup.c b/src/bin/bison/lib/strdup.c deleted file mode 100644 index d6d0116204..0000000000 --- a/src/bin/bison/lib/strdup.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifndef _LIBC -/* Get specification. */ -# include "strdup.h" -#endif - -#include -#include - -#undef __strdup -#undef strdup - -#ifndef weak_alias -# define __strdup strdup -#endif - -/* Duplicate S, returning an identical malloc'd string. */ -char * -__strdup (const char *s) -{ - size_t len = strlen (s) + 1; - void *new = malloc (len); - - if (new == NULL) - return NULL; - - return (char *) memcpy (new, s, len); -} -#ifdef libc_hidden_def -libc_hidden_def (__strdup) -#endif -#ifdef weak_alias -weak_alias (__strdup, strdup) -#endif diff --git a/src/bin/bison/lib/strdup.h b/src/bin/bison/lib/strdup.h deleted file mode 100644 index a0d5fb929c..0000000000 --- a/src/bin/bison/lib/strdup.h +++ /dev/null @@ -1,29 +0,0 @@ -/* strdup.h -- duplicate a string - Copyright (C) 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 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. */ - -#ifndef STRDUP_H_ -#define STRDUP_H_ - -/* Get strdup declaration, if available. */ -#include - -#if defined HAVE_DECL_STRDUP && !HAVE_DECL_STRDUP && !defined strdup -/* Duplicate S, returning an identical malloc'd string. */ -extern char *strdup (const char *s); -#endif - -#endif /* STRDUP_H_ */ diff --git a/src/bin/bison/lib/strerror.c b/src/bin/bison/lib/strerror.c deleted file mode 100644 index 623821d2e3..0000000000 --- a/src/bin/bison/lib/strerror.c +++ /dev/null @@ -1,49 +0,0 @@ -/* strerror.c --- ANSI C compatible system error routine - - Copyright (C) 1986, 1988, 1989, 1991, 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -/* Don't include , since it may or may not declare - sys_errlist and its declarations may collide with ours. Just - declare the stuff that we need directly. Standard hosted C89 - implementations define strerror and they don't need this strerror - function, so take some liberties with the standard to cater to - ancient or limited freestanding implementations. */ -int sprintf (char *, char const *, ...); -extern int sys_nerr; -extern char *sys_errlist[]; - -char * -strerror (int n) -{ - static char const fmt[] = "Unknown error (%d)"; - static char mesg[sizeof fmt + sizeof n * CHAR_BIT / 3]; - - if (n < 0 || n >= sys_nerr) - { - sprintf (mesg, fmt, n); - return mesg; - } - else - return sys_errlist[n]; -} diff --git a/src/bin/bison/lib/stripslash.c b/src/bin/bison/lib/stripslash.c deleted file mode 100644 index 9b55da48ed..0000000000 --- a/src/bin/bison/lib/stripslash.c +++ /dev/null @@ -1,40 +0,0 @@ -/* stripslash.c -- remove redundant trailing slashes from a file name - - Copyright (C) 1990, 2001, 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#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 - the Unix rename and rmdir system calls return an "Invalid argument" error - when given a file that ends in "/" (except for the root directory). */ - -bool -strip_trailing_slashes (char *file) -{ - char *base = base_name (file); - char *base_lim = base + base_len (base); - bool had_slash = (*base_lim != '\0'); - *base_lim = '\0'; - return had_slash; -} diff --git a/src/bin/bison/lib/strndup.c b/src/bin/bison/lib/strndup.c deleted file mode 100644 index 2626373f26..0000000000 --- a/src/bin/bison/lib/strndup.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2005, 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif -#if !_LIBC -# include "strndup.h" -#endif - -#include -#include - -#if !_LIBC -# include "strnlen.h" -# ifndef __strnlen -# define __strnlen strnlen -# endif -#endif - -#undef __strndup -#if _LIBC -# undef strndup -#endif - -#ifndef weak_alias -# define __strndup strndup -#endif - -char * -__strndup (s, n) - const char *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); -} -#ifdef libc_hidden_def -libc_hidden_def (__strndup) -#endif -#ifdef weak_alias -weak_alias (__strndup, strndup) -#endif diff --git a/src/bin/bison/lib/strndup.h b/src/bin/bison/lib/strndup.h deleted file mode 100644 index 8eae493adc..0000000000 --- a/src/bin/bison/lib/strndup.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Duplicate a size-bounded string. - 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 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. */ - -#if HAVE_STRNDUP - -/* Get strndup() declaration. */ -#include - -#else - -#include - -/* Return a newly allocated copy of at most N bytes of STRING. */ -extern char *strndup (const char *string, size_t n); - -#endif diff --git a/src/bin/bison/lib/strnlen.c b/src/bin/bison/lib/strnlen.c deleted file mode 100644 index 09ba788ab0..0000000000 --- a/src/bin/bison/lib/strnlen.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Find the length of STRING, but scan at most MAXLEN characters. - Copyright (C) 2005, 2006 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "strnlen.h" - -/* 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/src/bin/bison/lib/strnlen.h b/src/bin/bison/lib/strnlen.h deleted file mode 100644 index ba74dba7b2..0000000000 --- a/src/bin/bison/lib/strnlen.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Find the length of STRING, but scan at most MAXLEN characters. - Copyright (C) 2005 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 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. */ - -#ifndef STRNLEN_H -#define STRNLEN_H - -/* Get strnlen declaration, if available. */ -#include - -#if defined HAVE_DECL_STRNLEN && !HAVE_DECL_STRNLEN -/* 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. */ -extern size_t strnlen(const char *string, size_t maxlen); -#endif - -#endif /* STRNLEN_H */ diff --git a/src/bin/bison/lib/strtol.c b/src/bin/bison/lib/strtol.c deleted file mode 100644 index 9bfbe3c1af..0000000000 --- a/src/bin/bison/lib/strtol.c +++ /dev/null @@ -1,447 +0,0 @@ -/* Convert string representation of a number into an integer value. - - Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005 - Free Software Foundation, Inc. - - NOTE: The canonical source of this file is maintained with the GNU C - Library. Bugs can be reported to bug-glibc@gnu.org. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef _LIBC -# define USE_NUMBER_GROUPING -#endif - -#include -#include -#ifndef errno -extern int errno; -#endif -#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 - -#if defined _LIBC || defined HAVE_WCHAR_H -# include -#endif - -#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 -# if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII) -# define IN_CTYPE_DOMAIN(c) 1 -# else -# define IN_CTYPE_DOMAIN(c) isascii(c) -# endif -# 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) (IN_CTYPE_DOMAIN (Ch) && isspace (Ch)) -# define ISALPHA(Ch) (IN_CTYPE_DOMAIN (Ch) && isalpha (Ch)) -# define TOUPPER(Ch) (IN_CTYPE_DOMAIN (Ch) ? toupper (Ch) : (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/src/bin/bison/lib/strtoul.c b/src/bin/bison/lib/strtoul.c deleted file mode 100644 index 79ceed2f31..0000000000 --- a/src/bin/bison/lib/strtoul.c +++ /dev/null @@ -1,20 +0,0 @@ -/* 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 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. */ - -#define UNSIGNED 1 - -#include "strtol.c" diff --git a/src/bin/bison/lib/strverscmp.c b/src/bin/bison/lib/strverscmp.c deleted file mode 100644 index 6276bca0fa..0000000000 --- a/src/bin/bison/lib/strverscmp.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Compare strings while treating digits characters numerically. - Copyright (C) 1997, 2000, 2002, 2004 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 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. */ - -#ifdef HAVE_CONFIG_H -# 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. - - It's guaranteed to evaluate its argument exactly once. - - It's typically faster. - POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - ISDIGIT_LOCALE 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/src/bin/bison/lib/strverscmp.h b/src/bin/bison/lib/strverscmp.h deleted file mode 100644 index 7edeac5e4c..0000000000 --- a/src/bin/bison/lib/strverscmp.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Compare strings while treating digits characters numerically. - - Copyright (C) 1997, 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 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. */ - -#ifndef STRVERSCMP_H_ -# define STRVERSCMP_H_ - -int strverscmp (const char *, const char *); - -#endif /* not STRVERSCMP_H_ */ diff --git a/src/bin/bison/lib/subpipe.c b/src/bin/bison/lib/subpipe.c deleted file mode 100644 index 646aa8ec22..0000000000 --- a/src/bin/bison/lib/subpipe.c +++ /dev/null @@ -1,186 +0,0 @@ -/* 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 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. */ - -/* Written by Paul Eggert - and Florian Krohm . */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "subpipe.h" - -#include - -#include -#if ! defined SIGCHLD && defined SIGCLD -# define SIGCHLD SIGCLD -#endif - -#include - -#if HAVE_UNISTD_H -# include -#endif -#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 (child_fd) != 0 - || (child_fd[0] = fd_safer (child_fd[0])) < 0 - || (fd[0] = fd_safer (child_fd[1])) < 0 - || pipe (pipe_fd) != 0 - || (fd[1] = fd_safer (pipe_fd[0])) < 0 - || (child_fd[1] = fd_safer (pipe_fd[1])) < 0) - error (EXIT_FAILURE, errno, - "pipe"); - - 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/src/bin/bison/lib/subpipe.h b/src/bin/bison/lib/subpipe.h deleted file mode 100644 index 1083d32e24..0000000000 --- a/src/bin/bison/lib/subpipe.h +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 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. */ - -/* 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/src/bin/bison/lib/timevar.c b/src/bin/bison/lib/timevar.c deleted file mode 100644 index d9b533ce8c..0000000000 --- a/src/bin/bison/lib/timevar.c +++ /dev/null @@ -1,565 +0,0 @@ -/* 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#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/src/bin/bison/lib/timevar.def b/src/bin/bison/lib/timevar.def deleted file mode 100644 index 04ac392be4..0000000000 --- a/src/bin/bison/lib/timevar.def +++ /dev/null @@ -1,56 +0,0 @@ -/* This file contains the definitions for timing variables used to -*- C -*- - measure run-time performance of the compiler. - Copyright (C) 2002 Free Software Foundation, Inc. - Contributed by Akim Demaille . - - 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, 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* 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_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/src/bin/bison/lib/timevar.h b/src/bin/bison/lib/timevar.h deleted file mode 100644 index bbeb40214d..0000000000 --- a/src/bin/bison/lib/timevar.h +++ /dev/null @@ -1,90 +0,0 @@ -/* 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 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. */ - -#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/src/bin/bison/lib/unistd--.h b/src/bin/bison/lib/unistd--.h deleted file mode 100644 index 1fe6ce8b27..0000000000 --- a/src/bin/bison/lib/unistd--.h +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 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. */ - -/* Written by Paul Eggert. */ - -#include -#include "unistd-safer.h" - -#undef dup -#define dup dup_safer - -#undef pipe -#define pipe pipe_safer diff --git a/src/bin/bison/lib/unistd-safer.h b/src/bin/bison/lib/unistd-safer.h deleted file mode 100644 index f95999d391..0000000000 --- a/src/bin/bison/lib/unistd-safer.h +++ /dev/null @@ -1,23 +0,0 @@ -/* 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 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. */ - -/* Written by Paul Eggert. */ - -int dup_safer (int); -int fd_safer (int); -int pipe_safer (int[2]); diff --git a/src/bin/bison/lib/unlocked-io.h b/src/bin/bison/lib/unlocked-io.h deleted file mode 100644 index d00930361c..0000000000 --- a/src/bin/bison/lib/unlocked-io.h +++ /dev/null @@ -1,137 +0,0 @@ -/* 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 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. */ - -/* 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/src/bin/bison/lib/vbitset.c b/src/bin/bison/lib/vbitset.c deleted file mode 100644 index d0fe30f641..0000000000 --- a/src/bin/bison/lib/vbitset.c +++ /dev/null @@ -1,1140 +0,0 @@ -/* 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#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/src/bin/bison/lib/vbitset.h b/src/bin/bison/lib/vbitset.h deleted file mode 100644 index bab011c478..0000000000 --- a/src/bin/bison/lib/vbitset.h +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 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. */ - -#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/src/bin/bison/lib/verify.h b/src/bin/bison/lib/verify.h deleted file mode 100644 index d603b17379..0000000000 --- a/src/bin/bison/lib/verify.h +++ /dev/null @@ -1,141 +0,0 @@ -/* 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 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. */ - -/* 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/src/bin/bison/lib/xalloc-die.c b/src/bin/bison/lib/xalloc-die.c deleted file mode 100644 index 9b4a76c6ba..0000000000 --- a/src/bin/bison/lib/xalloc-die.c +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#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/src/bin/bison/lib/xalloc.h b/src/bin/bison/lib/xalloc.h deleted file mode 100644 index f80977e309..0000000000 --- a/src/bin/bison/lib/xalloc.h +++ /dev/null @@ -1,79 +0,0 @@ -/* xalloc.h -- malloc with out-of-memory checking - - Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 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 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. */ - -#ifndef XALLOC_H_ -# define XALLOC_H_ - -# include - - -# ifdef __cplusplus -extern "C" { -# endif - - -# ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ -# define __attribute__(x) -# endif -# endif - -# ifndef ATTRIBUTE_NORETURN -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) -# 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); -void *xnmalloc (size_t n, size_t s); -void *xzalloc (size_t s); -void *xcalloc (size_t n, size_t s); -void *xrealloc (void *p, size_t s); -void *xnrealloc (void *p, size_t n, size_t s); -void *x2realloc (void *p, size_t *pn); -void *x2nrealloc (void *p, size_t *pn, size_t s); -void *xmemdup (void const *p, size_t s); -char *xstrdup (char const *str); - -/* 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)) - -# ifdef __cplusplus -} -# endif - - -#endif /* !XALLOC_H_ */ diff --git a/src/bin/bison/lib/xmalloc.c b/src/bin/bison/lib/xmalloc.c deleted file mode 100644 index 687633c250..0000000000 --- a/src/bin/bison/lib/xmalloc.c +++ /dev/null @@ -1,241 +0,0 @@ -/* 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 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "xalloc.h" - -#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 an array of N objects, each with S bytes of memory, - dynamically, with error checking. S must be nonzero. */ - -static inline void * -xnmalloc_inline (size_t n, size_t s) -{ - void *p; - if (xalloc_oversized (n, s) || (! (p = malloc (n * s)) && n != 0)) - xalloc_die (); - return p; -} - -void * -xnmalloc (size_t n, size_t s) -{ - return xnmalloc_inline (n, s); -} - -/* Allocate N bytes of memory dynamically, with error checking. */ - -void * -xmalloc (size_t n) -{ - return xnmalloc_inline (n, 1); -} - -/* 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_inline (void *p, size_t n, size_t s) -{ - if (xalloc_oversized (n, s) || (! (p = realloc (p, n * s)) && n != 0)) - xalloc_die (); - return p; -} - -void * -xnrealloc (void *p, size_t n, size_t s) -{ - return xnrealloc_inline (p, n, s); -} - -/* Change the size of an allocated block of memory P to N bytes, - with error checking. */ - -void * -xrealloc (void *p, size_t n) -{ - return xnrealloc_inline (p, n, 1); -} - - -/* 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 doubled so that - repeated reallocations have O(N log N) overall cost rather than - O(N**2) cost, but the specification for this function does not - guarantee that sizes are doubled. - - 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_inline (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 - { - if (SIZE_MAX / 2 / s < n) - xalloc_die (); - n *= 2; - } - - *pn = n; - return xrealloc (p, n * s); -} - -void * -x2nrealloc (void *p, size_t *pn, size_t s) -{ - return x2nrealloc_inline (p, pn, s); -} - -/* 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_inline (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/src/bin/bison/lib/xstrndup.c b/src/bin/bison/lib/xstrndup.c deleted file mode 100644 index a62d4bd695..0000000000 --- a/src/bin/bison/lib/xstrndup.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -/* Specification. */ -#include "xstrndup.h" - -#include "strndup.h" -#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/src/bin/bison/lib/xstrndup.h b/src/bin/bison/lib/xstrndup.h deleted file mode 100644 index 88354cfd43..0000000000 --- a/src/bin/bison/lib/xstrndup.h +++ /dev/null @@ -1,24 +0,0 @@ -/* 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 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. */ - -#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/src/bin/bison/lib/yyerror.c b/src/bin/bison/lib/yyerror.c deleted file mode 100644 index b4ce4ba954..0000000000 --- a/src/bin/bison/lib/yyerror.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Yacc library error-printing function. - - Copyright (C) 2002 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 - -int yyerror (char const *); - -int -yyerror (char const *message) -{ - return fprintf (stderr, "%s\n", message); -} diff --git a/src/bin/bison/src/Jamfile b/src/bin/bison/src/Jamfile deleted file mode 100644 index 70c8b68901..0000000000 --- a/src/bin/bison/src/Jamfile +++ /dev/null @@ -1,45 +0,0 @@ -SubDir HAIKU_TOP src bin bison src ; - -SubDirCcFlags -DHAVE_CONFIG_H -DPKGDATADIR=\'\"/etc\"\' -DLOCALEDIR=\'\"/etc/locale\"\' ; - -SubDirSysHdrs [ FDirName $(SUBDIR) $(DOTDOT) lib ] ; -SubDirSysHdrs [ FDirName $(SUBDIR) $(DOTDOT) ] ; - -BinCommand bison : - LR0.c - assoc.c - closure.c - complain.c - conflicts.c - derives.c - files.c - getargs.c - gram.c - lalr.c - location.c - main.c - muscle_tab.c - nullable.c - output.c -# parse-gram.y - parse-gram.c - print.c - print_graph.c - reader.c - reduce.c - relation.c - scan-gram.l - scan-skel.l - state.c - symlist.c - symtab.c - tables.c - uniqstr.c - vcg.c - : libbison.a - : bison.rdef -; - -# Don't search scan-gram.c and scan-skel.c in the source directory. -# We want to use the one generated from scan-gram.l and scan-skel.l. -SEARCH on [ FGristFiles scan-gram.c scan-skel.c ] = ; diff --git a/src/bin/bison/src/LR0.c b/src/bin/bison/src/LR0.c deleted file mode 100644 index 259b8912fa..0000000000 --- a/src/bin/bison/src/LR0.c +++ /dev/null @@ -1,377 +0,0 @@ -/* Generate the nondeterministic finite state machine for Bison. - - Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2004, 2005 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. */ - - -/* 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. | -`---------------------------------------------------------------*/ - -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 < nritemset; ++i) - if (ritem[itemset[i]] >= 0) - { - 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 < nritemset; ++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. */ - assert (!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 ruleset and itemset for the transitions out of this - state. ruleset gets a 1 bit for each rule that could reduce - now. 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/bin/bison/src/LR0.h b/src/bin/bison/src/LR0.h deleted file mode 100644 index 60045389ce..0000000000 --- a/src/bin/bison/src/LR0.h +++ /dev/null @@ -1,28 +0,0 @@ -/* 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. - - 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 LR0_H_ -# define LR0_H_ - -# include "state.h" - -void generate_states (void); - -#endif /* !LR0_H_ */ diff --git a/src/bin/bison/src/Makefile.am b/src/bin/bison/src/Makefile.am deleted file mode 100644 index c973e9e75c..0000000000 --- a/src/bin/bison/src/Makefile.am +++ /dev/null @@ -1,110 +0,0 @@ -## 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 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 - -DEFS += -DPKGDATADIR=\"$(pkgdatadir)\" -DLOCALEDIR=\"$(datadir)/locale\" - -AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS) -AM_CPPFLAGS = -I$(top_srcdir)/lib -I../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 - -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 \ - 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 \ - reader.c reader.h \ - reduce.c reduce.h \ - relation.c relation.h \ - scan-gram-c.c \ - scan-skel-c.c scan-skel.h \ - state.c state.h \ - symlist.c symlist.h \ - symtab.c symtab.h \ - system.h \ - tables.h tables.c \ - uniqstr.c uniqstr.h \ - vcg.c vcg.h \ - vcg_defaults.h - -EXTRA_bison_SOURCES = scan-skel.l scan-gram.l - -BUILT_SOURCES = scan-skel.c scan-gram.c parse-gram.c parse-gram.h - -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/bin/bison/src/Makefile.in b/src/bin/bison/src/Makefile.in deleted file mode 100644 index 7de908128a..0000000000 --- a/src/bin/bison/src/Makefile.in +++ /dev/null @@ -1,655 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 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@ - - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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-gram.c scan-skel.c -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/bison-i18n.m4 \ - $(top_srcdir)/m4/c-working.m4 $(top_srcdir)/m4/cxx.m4 \ - $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ - $(top_srcdir)/m4/dos.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_gl.m4 \ - $(top_srcdir)/m4/gnulib.m4 $(top_srcdir)/m4/hard-locale.m4 \ - $(top_srcdir)/m4/hash.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/inttypes_h_gl.m4 \ - $(top_srcdir)/m4/lib-ld_gl.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix_gl.m4 $(top_srcdir)/m4/m4.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/obstack.m4 $(top_srcdir)/m4/onceonly.m4 \ - $(top_srcdir)/m4/po_gl.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \ - $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \ - $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.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/uintmax_t_gl.m4 \ - $(top_srcdir)/m4/ulonglong_gl.m4 \ - $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.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 = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/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) \ - reader.$(OBJEXT) reduce.$(OBJEXT) relation.$(OBJEXT) \ - scan-gram-c.$(OBJEXT) scan-skel-c.$(OBJEXT) state.$(OBJEXT) \ - symlist.$(OBJEXT) symtab.$(OBJEXT) tables.$(OBJEXT) \ - uniqstr.$(OBJEXT) vcg.$(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. -I$(srcdir) -I$(top_builddir) -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@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOM4TE = @AUTOM4TE@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BISON_CXX_WORKS = @BISON_CXX_WORKS@ -BISON_CXX_WORKS_FALSE = @BISON_CXX_WORKS_FALSE@ -BISON_CXX_WORKS_TRUE = @BISON_CXX_WORKS_TRUE@ -BISON_LOCALEDIR = @BISON_LOCALEDIR@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DPKGDATADIR=\"$(pkgdatadir)\" \ - -DLOCALEDIR=\"$(datadir)/locale\" -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -GCC = @GCC@ -GETOPT_H = @GETOPT_H@ -GMSGFMT = @GMSGFMT@ -HAVE__BOOL = @HAVE__BOOL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -O0CFLAGS = @O0CFLAGS@ -O0CXXFLAGS = @O0CXXFLAGS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STDBOOL_H = @STDBOOL_H@ -STRIP = @STRIP@ -UNISTD_H = @UNISTD_H@ -USE_NLS = @USE_NLS@ -VALGRIND = @VALGRIND@ -VERSION = @VERSION@ -WARNING_CFLAGS = @WARNING_CFLAGS@ -WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ -WERROR_CFLAGS = @WERROR_CFLAGS@ -XGETTEXT = @XGETTEXT@ - -# Use our own Bison to build the parser. Of course, you ought to -# keep a sane version of Bison nearby... -YACC = ../tests/bison -y -YACC_LIBRARY = @YACC_LIBRARY@ -YACC_SCRIPT = @YACC_SCRIPT@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -aclocaldir = @aclocaldir@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -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@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS) -AM_CPPFLAGS = -I$(top_srcdir)/lib -I../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 \ - 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 \ - reader.c reader.h \ - reduce.c reduce.h \ - relation.c relation.h \ - scan-gram-c.c \ - scan-skel-c.c scan-skel.h \ - state.c state.h \ - symlist.c symlist.h \ - symtab.c symtab.h \ - system.h \ - tables.h tables.c \ - uniqstr.c uniqstr.h \ - vcg.c vcg.h \ - vcg_defaults.h - -EXTRA_bison_SOURCES = scan-skel.l scan-gram.l -BUILT_SOURCES = scan-skel.c scan-gram.c parse-gram.c parse-gram.h -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) --gnu src/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu 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) -bison$(EXEEXT): $(bison_OBJECTS) $(bison_DEPENDENCIES) - @rm -f bison$(EXEEXT) - $(LINK) $(bison_LDFLAGS) $(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 - -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)/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.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-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@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcg.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@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@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@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: - $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) - -.y.c: - $(YACCCOMPILE) $< - if test -f y.tab.h; then \ - to=`echo "$*_H" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ - sed -e "/^#/!b" -e "s/Y_TAB_H/$$to/g" -e "s|y\.tab\.h|$*.h|" \ - y.tab.h >$*.ht; \ - rm -f y.tab.h; \ - if cmp -s $*.ht $*.h; then \ - rm -f $*.ht ;\ - else \ - mv $*.ht $*.h; \ - fi; \ - fi - if test -f y.output; then \ - mv y.output $*.output; \ - fi - sed '/^#/ s|y\.tab\.c|$@|' y.tab.c >$@t && mv $@t $@ - rm -f y.tab.c -uninstall-info-am: - -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; } \ - END { 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; } \ - END { 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=; \ - 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; } \ - END { 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)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - 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-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-exec-am: install-binPROGRAMS install-binSCRIPTS - -install-info: install-info-am - -install-man: - -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: uninstall-binPROGRAMS uninstall-binSCRIPTS \ - uninstall-info-am - -.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-exec \ - install-exec-am install-info install-info-am install-man \ - 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 uninstall-binPROGRAMS \ - uninstall-binSCRIPTS uninstall-info-am - - -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/bin/bison/src/assoc.c b/src/bin/bison/src/assoc.c deleted file mode 100644 index 6f9a3b5612..0000000000 --- a/src/bin/bison/src/assoc.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Associativity information. - Copyright (C) 2002, 2005, 2006 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 "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/bin/bison/src/assoc.h b/src/bin/bison/src/assoc.h deleted file mode 100644 index 778a451c90..0000000000 --- a/src/bin/bison/src/assoc.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Associativity information. - Copyright (C) 2002, 2006 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 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/bin/bison/src/bison.rdef b/src/bin/bison/src/bison.rdef deleted file mode 100644 index 154f348335..0000000000 --- a/src/bin/bison/src/bison.rdef +++ /dev/null @@ -1,11 +0,0 @@ -resource app_version -{ - major = 2, - middle = 3, - minor = 0, - variety = 5, - internal = 0, - short_info = "2.3", - long_info = "2.3 ©2006 The Free Software Foundation" -}; - diff --git a/src/bin/bison/src/closure.c b/src/bin/bison/src/closure.c deleted file mode 100644 index 001b8316a7..0000000000 --- a/src/bin/bison/src/closure.c +++ /dev/null @@ -1,249 +0,0 @@ -/* Closures for Bison - - Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004, 2005 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 - -#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 nritemset; - -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]])); - - nritemset = 0; - c = 0; - BITSET_FOR_EACH (iter, ruleset, ruleno, 0) - { - item_number itemno = rules[ruleno].rhs - ritem; - while (c < n && core[c] < itemno) - { - itemset[nritemset] = core[c]; - nritemset++; - c++; - } - itemset[nritemset] = itemno; - nritemset++; - }; - - while (c < n) - { - itemset[nritemset] = core[c]; - nritemset++; - c++; - } - - if (trace_flag & trace_sets) - print_closure ("output", itemset, nritemset); -} - - -void -free_closure (void) -{ - free (itemset); - bitset_free (ruleset); - bitsetv_free (fderives); -} diff --git a/src/bin/bison/src/closure.h b/src/bin/bison/src/closure.h deleted file mode 100644 index a2582e8946..0000000000 --- a/src/bin/bison/src/closure.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Subroutines for bison - - Copyright (C) 1984, 1989, 2000, 2001, 2002 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 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 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 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 nritemset; - -#endif /* !CLOSURE_H_ */ diff --git a/src/bin/bison/src/complain.c b/src/bin/bison/src/complain.c deleted file mode 100644 index 927dbb6305..0000000000 --- a/src/bin/bison/src/complain.c +++ /dev/null @@ -1,147 +0,0 @@ -/* Declaration for error-reporting function for Bison. - - Copyright (C) 2000, 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 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. */ - -/* Based on error.c and error.h, - written by David MacKenzie . */ - -#include -#include "system.h" - -#include - -#include "complain.h" -#include "files.h" - -/* The calling program should define program_name and set it to the - name of the executing program. */ -extern char *program_name; - -/* This variable is set each time `warn' is called. */ -bool warning_issued; - -/* This variable is set each time `complain' is called. */ -bool complaint_issued; - - -/*--------------------------------. -| Report a warning, and proceed. | -`--------------------------------*/ - -void -warn_at (location loc, const char *message, ...) -{ - va_list args; - - location_print (stderr, loc); - fputs (": ", stderr); - fputs (_("warning: "), stderr); - - va_start (args, message); - vfprintf (stderr, message, args); - va_end (args); - - warning_issued = true; - putc ('\n', stderr); -} - -void -warn (const char *message, ...) -{ - va_list args; - - fprintf (stderr, "%s: %s", current_file ? current_file : program_name, _("warning: ")); - - va_start (args, message); - vfprintf (stderr, message, args); - va_end (args); - - warning_issued = true; - putc ('\n', stderr); -} - -/*-----------------------------------------------------------. -| An error has occurred, but we can proceed, and die later. | -`-----------------------------------------------------------*/ - -void -complain_at (location loc, const char *message, ...) -{ - va_list args; - - location_print (stderr, loc); - fputs (": ", stderr); - - va_start (args, message); - vfprintf (stderr, message, args); - va_end (args); - - complaint_issued = true; - putc ('\n', stderr); -} - -void -complain (const char *message, ...) -{ - va_list args; - - fprintf (stderr, "%s: ", current_file ? current_file : program_name); - - va_start (args, message); - vfprintf (stderr, message, args); - va_end (args); - - complaint_issued = true; - putc ('\n', stderr); -} - -/*-------------------------------------------------. -| A severe error has occurred, we cannot proceed. | -`-------------------------------------------------*/ - -void -fatal_at (location loc, const char *message, ...) -{ - va_list args; - - location_print (stderr, loc); - fputs (": ", stderr); - fputs (_("fatal error: "), stderr); - - va_start (args, message); - vfprintf (stderr, message, args); - va_end (args); - putc ('\n', stderr); - exit (EXIT_FAILURE); -} - -void -fatal (const char *message, ...) -{ - va_list args; - - fprintf (stderr, "%s: ", current_file ? current_file : program_name); - - fputs (_("fatal error: "), stderr); - - va_start (args, message); - vfprintf (stderr, message, args); - va_end (args); - putc ('\n', stderr); - exit (EXIT_FAILURE); -} diff --git a/src/bin/bison/src/complain.h b/src/bin/bison/src/complain.h deleted file mode 100644 index 9ae334a4b3..0000000000 --- a/src/bin/bison/src/complain.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Declaration for error-reporting function for Bison. - Copyright (C) 2000, 2001, 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 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. */ - -#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))); - -/* Something bad happened, but let's 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))); - -/* Something bad happened, and let's die now. */ - -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))); - -/* This variable is set each time `warn' is called. */ -extern bool warning_issued; - -/* This variable is set each time `complain' is called. */ -extern bool complaint_issued; - -# ifdef __cplusplus -} -# endif - -#endif /* !COMPLAIN_H_ */ diff --git a/src/bin/bison/src/conflicts.c b/src/bin/bison/src/conflicts.c deleted file mode 100644 index 13121f6e29..0000000000 --- a/src/bin/bison/src/conflicts.c +++ /dev/null @@ -1,535 +0,0 @@ -/* Find and resolve or report look-ahead conflicts for bison, - - Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - 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 "LR0.h" -#include "complain.h" -#include "conflicts.h" -#include "files.h" -#include "getargs.h" -#include "gram.h" -#include "lalr.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 bitset shift_set; -static bitset look_ahead_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"); - } -} - - -/*------------------------------------------------------------------. -| 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. | -`------------------------------------------------------------------*/ - -static void -flush_shift (state *s, int token) -{ - transitions *trans = s->transitions; - int i; - - bitset_reset (look_ahead_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 for the | -| specified look-ahead. Used when we resolve a shift-reduce conflict | -| in favor of the shift. | -`--------------------------------------------------------------------*/ - -static void -flush_reduce (bitset look_ahead_tokens, int token) -{ - bitset_reset (look_ahead_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 look-ahead bitset to consider. | -| | -| ERRORS can be used to store discovered explicit errors. | -`------------------------------------------------------------------*/ - -static void -resolve_sr_conflict (state *s, int ruleno, symbol **errors) -{ - 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 look_ahead_tokens = reds->look_ahead_tokens[ruleno]; - int nerrs = 0; - - for (i = 0; i < ntokens; i++) - if (bitset_test (look_ahead_tokens, i) - && bitset_test (look_ahead_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 (look_ahead_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 (look_ahead_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 (look_ahead_tokens, i); - /* Record an explicit error for this token. */ - errors[nerrs++] = symbols[i]; - break; - } - } - - 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); - } -} - - -/*-------------------------------------------------------------------. -| 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 | -| look-ahead 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; - - if (s->consistent) - return; - - bitset_zero (look_ahead_set); - - FOR_EACH_SHIFT (trans, i) - bitset_set (look_ahead_set, TRANSITION_SYMBOL (trans, i)); - - /* Loop over all rules which require look-ahead 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->look_ahead_tokens[i], look_ahead_set)) - resolve_sr_conflict (s, i, errors); - - /* Loop over all rules which require look-ahead in this state. Check - for conflicts not resolved above. */ - for (i = 0; i < reds->num; ++i) - { - if (!bitset_disjoint_p (reds->look_ahead_tokens[i], look_ahead_set)) - conflicts[s->number] = 1; - - bitset_or (look_ahead_set, look_ahead_set, reds->look_ahead_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 look-ahead 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); - look_ahead_set = bitset_create (ntokens, BITSET_FIXED); - obstack_init (&solved_conflicts_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); -} - - -/*---------------------------------------------. -| 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 (look_ahead_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 (look_ahead_set, look_ahead_set, reds->look_ahead_tokens[i]); - - bitset_and (look_ahead_set, look_ahead_set, shift_set); - - src_count = bitset_count (look_ahead_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->look_ahead_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 look-ahead 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 (look_ahead_set); - obstack_free (&solved_conflicts_obstack, NULL); -} diff --git a/src/bin/bison/src/conflicts.h b/src/bin/bison/src/conflicts.h deleted file mode 100644 index 4389e5ecca..0000000000 --- a/src/bin/bison/src/conflicts.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Find and resolve or report look-ahead conflicts for bison, - Copyright (C) 2000, 2001, 2002, 2004 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 CONFLICTS_H_ -# define CONFLICTS_H_ -# include "state.h" - -void conflicts_solve (void); -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/bin/bison/src/derives.c b/src/bin/bison/src/derives.c deleted file mode 100644 index 2e4ff31ba6..0000000000 --- a/src/bin/bison/src/derives.c +++ /dev/null @@ -1,121 +0,0 @@ -/* 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. - - 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 "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/bin/bison/src/derives.h b/src/bin/bison/src/derives.h deleted file mode 100644 index 9a45dc9cd5..0000000000 --- a/src/bin/bison/src/derives.h +++ /dev/null @@ -1,37 +0,0 @@ -/* 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. - - 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 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/bin/bison/src/files.c b/src/bin/bison/src/files.c deleted file mode 100644 index f3bb0f9c5a..0000000000 --- a/src/bin/bison/src/files.c +++ /dev/null @@ -1,340 +0,0 @@ -/* Open and close files for Bison. - - Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005 - 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 - -#include "complain.h" -#include "dirname.h" -#include "files.h" -#include "getargs.h" -#include "gram.h" -#include "stdio-safer.h" - -struct obstack pre_prologue_obstack; -struct obstack post_prologue_obstack; - -/* 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 const *spec_verbose_file = NULL; /* for --verbose. */ -char const *spec_graph_file = NULL; /* for -g. */ -char const *spec_defines_file = NULL; /* for --defines. */ -char const *parser_file_name; - -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/'. */ - -static char const *all_but_ext; -static char const *all_but_tab_ext; -char const *dir_prefix; - -/* C source file extension (the parser source). */ -static char const *src_extension = NULL; -/* Header file extension (if option ``-d'' is specified). */ -static char const *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. | -`------------------------------------------------------------------*/ - -/* Replace all characters FROM by TO in the string IN. - and returns a new allocated string. */ -static char * -tr (const char *in, char from, char to) -{ - char *temp; - char *out = xmalloc (strlen (in) + 1); - - for (temp = out; *in; in++, out++) - if (*in == from) - *out = to; - else - *out = *in; - *out = 0; - return (temp); -} - -/* Compute extensions from the grammar file extension. */ -static void -compute_exts_from_gf (const char *ext) -{ - src_extension = tr (ext, 'y', 'c'); - src_extension = tr (src_extension, 'Y', 'C'); - header_extension = tr (ext, 'y', 'h'); - header_extension = 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 = tr (ext, 'c', 'h'); - header_extension = 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 = base_name (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 (grammar_file, base - grammar_file); - all_but_tab_ext = xstrdup (spec_file_prefix); - } - else if (yacc_flag) - { - /* If --yacc, then the output is `y.tab.c'. */ - dir_prefix = ""; - all_but_tab_ext = "y"; - } - else - { - /* Otherwise, ALL_BUT_TAB_EXT is computed from the input - grammar: `foo/bar.yy' => `bar'. */ - dir_prefix = ""; - all_but_tab_ext = - xstrndup (base, (strlen (base) - (ext ? strlen (ext) : 0))); - } - - all_but_ext = concat2 (all_but_tab_ext, 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) -{ - char const *name[4]; - int i; - int j; - int names = 0; - - compute_file_name_parts (); - - /* If not yet done. */ - if (!src_extension) - src_extension = ".c"; - if (!header_extension) - header_extension = ".h"; - - name[names++] = parser_file_name = - spec_outfile ? spec_outfile : concat2 (all_but_ext, src_extension); - - if (defines_flag) - { - if (! spec_defines_file) - spec_defines_file = concat2 (all_but_ext, header_extension); - name[names++] = spec_defines_file; - } - - if (graph_flag) - { - if (! spec_graph_file) - spec_graph_file = concat2 (all_but_tab_ext, ".vcg"); - name[names++] = spec_graph_file; - } - - if (report_flag) - { - spec_verbose_file = concat2 (all_but_tab_ext, OUTPUT_EXT); - name[names++] = spec_verbose_file; - } - - for (j = 0; j < names; j++) - for (i = 0; i < j; i++) - if (strcmp (name[i], name[j]) == 0) - warn (_("conflicting outputs to file %s"), quote (name[i])); -} diff --git a/src/bin/bison/src/files.h b/src/bin/bison/src/files.h deleted file mode 100644 index ba9fec2f2e..0000000000 --- a/src/bin/bison/src/files.h +++ /dev/null @@ -1,68 +0,0 @@ -/* File names and variables for bison, - Copyright (C) 1984, 1989, 2000, 2001, 2002 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 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 const *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 const *spec_verbose_file; - -/* File name specified for the output VCG graph. */ -extern char const *spec_graph_file; - -/* File name specified with --defines. */ -extern char const *spec_defines_file; - -/* Directory prefix of output file names. */ -extern char const *dir_prefix; - - -/* If semantic parser, output a .h file that defines YYSTYPE... */ -extern struct obstack pre_prologue_obstack; -extern struct obstack post_prologue_obstack; - -/* 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; - -void compute_output_file_names (void); - -FILE *xfopen (const char *name, const char *mode); -void xfclose (FILE *ptr); - -#endif /* !FILES_H_ */ diff --git a/src/bin/bison/src/getargs.c b/src/bin/bison/src/getargs.c deleted file mode 100644 index 13b0d3215c..0000000000 --- a/src/bin/bison/src/getargs.c +++ /dev/null @@ -1,460 +0,0 @@ -/* Parse command line arguments 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. - - 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 - -/* 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 locations_flag; -bool no_lines_flag; -bool no_parser_flag; -bool token_table_flag; -bool yacc_flag; /* for -y */ - -bool error_verbose = false; - -bool nondeterministic_parser = false; -bool glr_parser = false; -bool pure_parser = false; - -int report_flag = report_none; -int trace_flag = trace_none; - -const char *skeleton = NULL; -const char *include = NULL; - -extern char *program_name; - - -/*---------------------. -| --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 report", - "scan - grammar scanner traces", - "parse - grammar parser traces", - "automaton - contruction of the automaton", - "bitsets - use of bitsets", - "grammar - reading, reducing of 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); - -static void -trace_argmatch (char *args) -{ - if (args) - { - args = strtok (args, ","); - do - { - int trace = XARGMATCH ("--trace", args, - trace_args, trace_types); - if (trace == trace_none) - trace_flag = trace_none; - else - trace_flag |= trace; - } - while ((args = strtok (NULL, ","))); - } - else - trace_flag = trace_all; -} - - -/*----------------------. -| --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", - "look-ahead", "lookahead", "lookaheads", - "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_look_ahead_tokens, - report_states | report_look_ahead_tokens, - report_states | report_look_ahead_tokens, - report_states | report_solved_conflicts, - report_all -}; - -ARGMATCH_VERIFY (report_args, report_types); - -static void -report_argmatch (char *args) -{ - args = strtok (args, ","); - do - { - int report = XARGMATCH ("--report", args, - report_args, report_types); - if (report == report_none) - report_flag = report_none; - else - report_flag |= report; - } - while ((args = strtok (NULL, ","))); -} - - -/*-------------------------------------------. -| 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 - { - /* Some efforts were made to ease the translators' task, please - continue. */ - fputs (_("\ -GNU bison generates parsers for LALR(1) grammars.\n"), stdout); - putc ('\n', stdout); - - fprintf (stdout, _("\ -Usage: %s [OPTION]... FILE\n"), program_name); - putc ('\n', stdout); - - fputs (_("\ -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"), - stdout); - putc ('\n', stdout); - - fputs (_("\ -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\ - -y, --yacc emulate POSIX yacc\n"), stdout); - putc ('\n', stdout); - - fputs (_("\ -Parser:\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\ - -n, --no-parser generate the tables only\n\ - -k, --token-table include a table of token names\n\ -"), stdout); - putc ('\n', stdout); - - fputs (_("\ -Output:\n\ - -d, --defines also produce a header file\n\ - -r, --report=THINGS also produce details on the automaton\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 also produce a VCG description of the automaton\n\ -"), stdout); - putc ('\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\ - `look-ahead' explicitly associate look-ahead tokens to items\n\ - `solved' describe shift/reduce conflicts solving\n\ - `all' include all the above information\n\ - `none' disable the report\n\ -"), stdout); - putc ('\n', stdout); - - fputs (_("\ -Report bugs to .\n"), stdout); - } - - 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"), 2006); - - 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); -} - - -/*----------------------. -| Process the options. | -`----------------------*/ - -/* Shorts options. */ -static char const short_options[] = "yvegdhr:ltknVo:b:p:S:T::"; - -/* Values for long options that do not have single-letter equivalents. */ -enum -{ - LOCATIONS_OPTION = CHAR_MAX + 1, - PRINT_LOCALEDIR_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 }, - - /* 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' }, - { "report", required_argument, 0, 'r' }, - { "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' }, - { "no-parser", no_argument, 0, 'n' }, - { "raw", no_argument, 0, 0 }, - { "skeleton", required_argument, 0, 'S' }, - { "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 'y': - yacc_flag = true; - break; - - case 'h': - usage (EXIT_SUCCESS); - - case 'V': - version (); - exit (EXIT_SUCCESS); - - case PRINT_LOCALEDIR_OPTION: - printf ("%s\n", LOCALEDIR); - exit (EXIT_SUCCESS); - - case 'g': - /* Here, the -g and --graph=FILE options are differentiated. */ - graph_flag = true; - if (optarg) - spec_graph_file = AS_FILE_NAME (optarg); - break; - - case 'v': - report_flag |= report_states; - break; - - case 'S': - skeleton = AS_FILE_NAME (optarg); - break; - - case 'I': - include = AS_FILE_NAME (optarg); - break; - - case 'd': - /* Here, the -d and --defines options are differentiated. */ - defines_flag = true; - if (optarg) - spec_defines_file = AS_FILE_NAME (optarg); - break; - - case 'l': - no_lines_flag = true; - break; - - case LOCATIONS_OPTION: - locations_flag = true; - break; - - case 'k': - token_table_flag = true; - break; - - case 'n': - no_parser_flag = true; - break; - - case 't': - debug_flag = true; - break; - - case 'o': - spec_outfile = AS_FILE_NAME (optarg); - break; - - case 'b': - spec_file_prefix = AS_FILE_NAME (optarg); - break; - - case 'p': - spec_name_prefix = optarg; - break; - - case 'r': - report_argmatch (optarg); - break; - - case 'T': - trace_argmatch (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/bin/bison/src/getargs.h b/src/bin/bison/src/getargs.h deleted file mode 100644 index 816eb95659..0000000000 --- a/src/bin/bison/src/getargs.h +++ /dev/null @@ -1,95 +0,0 @@ -/* Parse command line arguments 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. - - 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 GETARGS_H_ -# define GETARGS_H_ - -/* flags set by % directives */ - -/* for -S */ -extern char const *skeleton; - -/* 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 locations_flag; -extern bool no_lines_flag; /* for -l */ -extern bool no_parser_flag; /* for -n */ -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; - -/* PURE_PARSER is true if should generate a parser that is all pure - and reentrant. */ - -extern bool pure_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; - -/* --trace. */ -enum trace - { - trace_none = 0, - trace_scan = 1 << 0, - trace_parse = 1 << 1, - trace_resource = 1 << 2, - trace_sets = 1 << 3, - trace_bitsets = 1 << 4, - trace_tools = 1 << 5, - trace_automaton = 1 << 6, - trace_grammar = 1 << 7, - trace_time = 1 << 8, - trace_skeleton = 1 << 9, - trace_m4 = 1 << 10, - trace_all = ~0 - }; -extern int trace_flag; - -/* --report. */ -enum report - { - report_none = 0, - report_states = 1 << 0, - report_itemsets = 1 << 1, - report_look_ahead_tokens= 1 << 2, - report_solved_conflicts = 1 << 3, - report_all = ~0 - }; -extern int report_flag; - -void getargs (int argc, char *argv[]); - -#endif /* !GETARGS_H_ */ diff --git a/src/bin/bison/src/gram.c b/src/bin/bison/src/gram.c deleted file mode 100644 index 28666b0c8c..0000000000 --- a/src/bin/bison/src/gram.c +++ /dev/null @@ -1,335 +0,0 @@ -/* Allocate input grammar variables for Bison. - - Copyright (C) 1984, 1986, 1989, 2001, 2002, 2003, 2005, 2006 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 "gram.h" -#include "reader.h" -#include "reduce.h" -#include "symtab.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; - -/*--------------------------------------------------------------. -| Return true IFF the rule has a `number' smaller than NRULES. | -`--------------------------------------------------------------*/ - -bool -rule_useful_p (rule *r) -{ - return r->number < nrules; -} - - -/*-------------------------------------------------------------. -| Return true IFF the rule has a `number' higher than NRULES. | -`-------------------------------------------------------------*/ - -bool -rule_useless_p (rule *r) -{ - return !rule_useful_p (r); -} - - -/*--------------------------------------------------------------------. -| Return true IFF the rule is not flagged as useful *and* is useful. | -| In other words, it was discarded because of conflicts. | -`--------------------------------------------------------------------*/ - -bool -rule_never_reduced_p (rule *r) -{ - return !r->useful && rule_useful_p (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) -{ - 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); - } -} - - -/*--------------------------------------. -| Return the number of symbols in RHS. | -`--------------------------------------*/ - -int -rule_rhs_length (rule *r) -{ - int res = 0; - item_number *rhsp; - for (rhsp = r->rhs; *rhsp >= 0; ++rhsp) - ++res; - return res; -} - - -/*-------------------------------. -| Print this rule's RHS on OUT. | -`-------------------------------*/ - -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")); - } -} - - -/*-------------------------. -| Print this rule on OUT. | -`-------------------------*/ - -void -rule_print (rule *r, FILE *out) -{ - fprintf (out, "%s:", r->lhs->tag); - rule_rhs_print (r, out); -} - - -/*------------------------. -| Dump RITEM for traces. | -`------------------------*/ - -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); -} - - -/*------------------------------------------. -| Return the size of the longest rule RHS. | -`------------------------------------------*/ - -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; -} - - -/*-----------------------------------------------------------------. -| 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) -{ - 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); -} - - -/*------------------------------------------. -| Print the grammar's useful rules on OUT. | -`------------------------------------------*/ - -void -grammar_rules_print (FILE *out) -{ - grammar_rules_partial_print (out, _("Grammar"), rule_useful_p); -} - - -/*-------------------. -| Dump the grammar. | -`-------------------*/ - -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"); -} - - -/*------------------------------------------------------------------. -| Report on STDERR the rules that are not flagged USEFUL, using the | -| MESSAGE (which can be `useless rule' when invoked after grammar | -| reduction, or `never reduced' after conflicts were taken into | -| account). | -`------------------------------------------------------------------*/ - -void -grammar_rules_never_reduced_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/bin/bison/src/gram.h b/src/bin/bison/src/gram.h deleted file mode 100644 index b8f316a039..0000000000 --- a/src/bin/bison/src/gram.h +++ /dev/null @@ -1,271 +0,0 @@ -/* Data definitions for internal representation of Bison's input. - - Copyright (C) 1984, 1986, 1989, 1992, 2001, 2002, 2003, 2004, 2005 - 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 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; -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; -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. */ -bool rule_useful_p (rule *r); - -/* Return true IFF the rule has a `number' higher than NRULES. */ -bool rule_useless_p (rule *r); - -/* Return true IFF the rule is not flagged as useful *and* is useful. - In other words, it was discarded because of conflicts. */ -bool rule_never_reduced_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); - -/* 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 numbers from BEGIN (inclusive) to END - (exclusive) on OUT under TITLE. */ -void grammar_rules_partial_print (FILE *out, const char *title, - rule_filter filter); - -/* Print the grammar's rules on OUT. */ -void grammar_rules_print (FILE *out); - -/* 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 `useless rule' when invoked after grammar - reduction, or `never reduced' after conflicts were taken into - account). */ -void grammar_rules_never_reduced_report (const char *message); - -/* Free the packed grammar. */ -void grammar_free (void); - -#endif /* !GRAM_H_ */ diff --git a/src/bin/bison/src/lalr.c b/src/bin/bison/src/lalr.c deleted file mode 100644 index 65c55ab7c8..0000000000 --- a/src/bin/bison/src/lalr.c +++ /dev/null @@ -1,463 +0,0 @@ -/* Compute look-ahead criteria for Bison. - - Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004, 2005, - 2006 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. */ - - -/* Compute how to make the finite state machine deterministic; find - which rules need look-ahead in each state, and which look-ahead - 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 a LR 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. */ - assert (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 (;;) - { - assert (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->look_ahead_tokens - LA) + ri]; - sp->value = gotono; - lookback[(s->reductions->look_ahead_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 an item 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_look_ahead_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 look-ahead tokens required for S | -| (N_LOOK_AHEAD_TOKENS member). | -`-----------------------------------------------------*/ - -static int -state_look_ahead_tokens_count (state *s) -{ - int k; - int n_look_ahead_tokens = 0; - reductions *rp = s->reductions; - transitions *sp = s->transitions; - - /* We need a look-ahead 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'. */ - if (rp->num > 1 - || (rp->num == 1 && sp->num && - !TRANSITION_IS_DISABLED (sp, 0) && TRANSITION_IS_SHIFT (sp, 0))) - n_look_ahead_tokens += rp->num; - else - s->consistent = 1; - - for (k = 0; k < sp->num; k++) - if (!TRANSITION_IS_DISABLED (sp, k) && TRANSITION_IS_ERROR (sp, k)) - { - s->consistent = 0; - break; - } - - return n_look_ahead_tokens; -} - - -/*-----------------------------------------------------. -| Compute LA, NLA, and the look_ahead_tokens members. | -`-----------------------------------------------------*/ - -static void -initialize_LA (void) -{ - state_number i; - bitsetv pLA; - - /* Compute the total number of reductions requiring a look-ahead. */ - nLA = 0; - for (i = 0; i < nstates; i++) - nLA += state_look_ahead_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 LOOK_AHEAD_TOKENS for each state whose reductions - require look-ahead tokens. */ - for (i = 0; i < nstates; i++) - { - int count = state_look_ahead_tokens_count (states[i]); - if (count) - { - states[i]->reductions->look_ahead_tokens = pLA; - pLA += count; - } - } -} - - -/*----------------------------------------------. -| Output the look-ahead tokens for each state. | -`----------------------------------------------*/ - -static void -look_ahead_tokens_print (FILE *out) -{ - state_number i; - int j, k; - fprintf (out, "Look-ahead tokens: BEGIN\n"); - for (i = 0; i < nstates; ++i) - { - reductions *reds = states[i]->reductions; - bitset_iterator iter; - int n_look_ahead_tokens = 0; - - if (reds->look_ahead_tokens) - for (k = 0; k < reds->num; ++k) - if (reds->look_ahead_tokens[k]) - ++n_look_ahead_tokens; - - fprintf (out, "State %d: %d look-ahead tokens\n", - i, n_look_ahead_tokens); - - if (reds->look_ahead_tokens) - for (j = 0; j < reds->num; ++j) - BITSET_FOR_EACH (iter, reds->look_ahead_tokens[j], k, 0) - { - fprintf (out, " on %d (%s) -> rule %d\n", - k, symbols[k]->tag, - reds->rules[j]->number); - }; - } - fprintf (out, "Look-ahead tokens: END\n"); -} - -void -lalr (void) -{ - initialize_LA (); - set_goto_map (); - initialize_F (); - build_relations (); - compute_FOLLOWS (); - compute_look_ahead_tokens (); - - if (trace_flag & trace_sets) - look_ahead_tokens_print (stderr); -} - - -void -lalr_free (void) -{ - state_number s; - for (s = 0; s < nstates; ++s) - states[s]->reductions->look_ahead_tokens = NULL; - bitsetv_free (LA); -} diff --git a/src/bin/bison/src/lalr.h b/src/bin/bison/src/lalr.h deleted file mode 100644 index a2c1753761..0000000000 --- a/src/bin/bison/src/lalr.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Compute look-ahead criteria for bison, - - Copyright (C) 1984, 1986, 1989, 2000, 2002, 2004 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 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" - -/* Compute how to make the finite state machine deterministic; find - which rules need look-ahead in each state, and which look-ahead - tokens they accept. */ - -void lalr (void); - -/* Release the information related to look-ahead tokens. Can be performed - once the action tables are computed. */ - -void lalr_free (void); - - -/* lalr() builds these data structures. */ - -/* GOTO_MAP, FROM_STATE and TO_STATE -- record each shift transition - which accepts a variable (a nonterminal). - - FROM_STATE[T] -- state number which a transition leads from. - TO_STATE[T] -- state number it leads to. - - 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. */ - -typedef size_t goto_number; -# define GOTO_NUMBER_MAXIMUM ((goto_number) -1) - -extern goto_number *goto_map; -extern state_number *from_state; -extern state_number *to_state; - - -#endif /* !LALR_H_ */ diff --git a/src/bin/bison/src/location.c b/src/bin/bison/src/location.c deleted file mode 100644 index ecd3658b14..0000000000 --- a/src/bin/bison/src/location.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Locations for Bison - - Copyright (C) 2002, 2005 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 "location.h" - -location const empty_location; - -/* Output to OUT the location LOC. - Warning: it uses quotearg's slot 3. */ -void -location_print (FILE *out, location loc) -{ - 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, loc.end.column - 1); - else if (loc.start.line < loc.end.line) - fprintf (out, "-%d.%d", loc.end.line, loc.end.column - 1); - else if (loc.start.column < loc.end.column - 1) - fprintf (out, "-%d", loc.end.column - 1); -} diff --git a/src/bin/bison/src/location.h b/src/bin/bison/src/location.h deleted file mode 100644 index 49d2a2edfa..0000000000 --- a/src/bin/bison/src/location.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Locations for Bison - Copyright (C) 2002, 2004, 2005, 2006 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 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; - -/* 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 - -extern location const empty_location; - -void location_print (FILE *out, location loc); - -#endif /* ! defined LOCATION_H_ */ diff --git a/src/bin/bison/src/main.c b/src/bin/bison/src/main.c deleted file mode 100644 index 8769fef8aa..0000000000 --- a/src/bin/bison/src/main.c +++ /dev/null @@ -1,187 +0,0 @@ -/* Top level entry point of Bison. - - Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000, 2001, 2002, 2004, 2005 - 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 "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 "reader.h" -#include "reduce.h" -#include "symtab.h" -#include "tables.h" -#include "uniqstr.h" - -/* The name this program was run with, for messages. */ -char *program_name; - - - -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 - look-ahead 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 (); - conflicts_print (); - timevar_pop (TV_CONFLICTS); - - /* Compute the parser tables. */ - timevar_push (TV_ACTIONS); - tables_generate (); - timevar_pop (TV_ACTIONS); - - grammar_rules_never_reduced_report - (_("rule never reduced because of 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 VCG graph. */ - if (graph_flag) - { - timevar_push (TV_GRAPH); - print_graph (); - timevar_pop (TV_GRAPH); - } - - /* Stop if there were errors, to avoid trashing previous output - files. */ - if (complaint_issued) - goto finish; - - /* Look-ahead 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 (); - - /* The scanner memory cannot be released right after parsing, as it - contains things such as user actions, prologue, epilogue etc. */ - scanner_free (); - muscle_free (); - uniqstrs_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/bin/bison/src/muscle_tab.c b/src/bin/bison/src/muscle_tab.c deleted file mode 100644 index 2d71085ebe..0000000000 --- a/src/bin/bison/src/muscle_tab.c +++ /dev/null @@ -1,241 +0,0 @@ -/* Muscle table manager for Bison. - - Copyright (C) 2001, 2002, 2003, 2004, 2005 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 "files.h" -#include "muscle_tab.h" -#include "getargs.h" - -typedef struct -{ - const char *key; - char *value; -} 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. | -`-----------------------------------------------------------------*/ - -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, 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 (const char *key, char *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); - } - entry->value = value; -} - - -/*-------------------------------------------------------------------. -| 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 = xstrdup (val); - } - else - { - /* Grow the current value. */ - char *new_val; - obstack_sgrow (&muscle_obstack, entry->value); - free (entry->value); - obstack_sgrow (&muscle_obstack, separator); - obstack_sgrow (&muscle_obstack, val); - obstack_1grow (&muscle_obstack, 0); - new_val = obstack_finish (&muscle_obstack); - entry->value = xstrdup (new_val); - obstack_free (&muscle_obstack, new_val); - } -} - - -/*------------------------------------------------------------------. -| 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 *val, 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, "]])[\n"); - obstack_sgrow (&muscle_obstack, val); - obstack_1grow (&muscle_obstack, 0); - extension = obstack_finish (&muscle_obstack); - muscle_grow (key, extension, ""); -} - - -/*-------------------------------------------------------------------. -| MUSCLE is an M4 list of pairs. Create or extend it with the pair | -| (A1, A2). 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) -{ - char *pair; - obstack_fgrow2 (&muscle_obstack, "[[[%s]], [[%s]]]", a1, a2); - 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. | -`-------------------------------*/ - -char * -muscle_find (const char *key) -{ - muscle_entry probe; - muscle_entry *result = NULL; - - probe.key = key; - result = hash_lookup (muscle_table, &probe); - return result ? result->value : NULL; -} - - -/*------------------------------------------------. -| 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/bin/bison/src/muscle_tab.h b/src/bin/bison/src/muscle_tab.h deleted file mode 100644 index 9e8ac24f24..0000000000 --- a/src/bin/bison/src/muscle_tab.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Muscle table manager for Bison, - Copyright (C) 2001, 2002, 2003 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 MUSCLE_TAB_H_ -# define MUSCLE_TAB_H_ - -# include "location.h" - -void muscle_init (void); -void muscle_insert (const char *key, char *value); -char *muscle_find (const char *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) \ -{ \ - int v = Value; \ - MUSCLE_INSERT_INT (Key, v); \ -} - -#define MUSCLE_INSERT_INT(Key, Value) \ -{ \ - obstack_fgrow1 (&muscle_obstack, "%d", Value); \ - obstack_1grow (&muscle_obstack, 0); \ - muscle_insert (Key, obstack_finish (&muscle_obstack)); \ -} - -#define MUSCLE_INSERT_LONG_INT(Key, Value) \ -{ \ - obstack_fgrow1 (&muscle_obstack, "%ld", Value); \ - obstack_1grow (&muscle_obstack, 0); \ - muscle_insert (Key, obstack_finish (&muscle_obstack)); \ -} - -#define MUSCLE_INSERT_STRING(Key, Value) \ -{ \ - obstack_sgrow (&muscle_obstack, Value); \ - obstack_1grow (&muscle_obstack, 0); \ - muscle_insert (Key, obstack_finish (&muscle_obstack)); \ -} - -#define MUSCLE_OBSTACK_SGROW(Obstack, Value) \ -{ \ - 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; \ - } \ -} - -#define MUSCLE_INSERT_C_STRING(Key, Value) \ -{ \ - MUSCLE_OBSTACK_SGROW (&muscle_obstack, \ - quotearg_style (c_quoting_style, \ - Value)); \ - obstack_1grow (&muscle_obstack, 0); \ - muscle_insert (Key, obstack_finish (&muscle_obstack)); \ -} - -/* Insert (KEY, VALUE). If KEY already existed, overwrite the - previous value. Uses MUSCLE_OBSTACK. De-allocates the previously - associated value. VALUE and SEPARATOR are copied. */ - -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). 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); - -void muscles_m4_output (FILE *out); - -#endif /* not MUSCLE_TAB_H_ */ diff --git a/src/bin/bison/src/nullable.c b/src/bin/bison/src/nullable.c deleted file mode 100644 index 83a90e9556..0000000000 --- a/src/bin/bison/src/nullable.c +++ /dev/null @@ -1,144 +0,0 @@ -/* 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. - - 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. */ - - -/* 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. */ - assert (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/bin/bison/src/nullable.h b/src/bin/bison/src/nullable.h deleted file mode 100644 index d5106c7e98..0000000000 --- a/src/bin/bison/src/nullable.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Part of the bison parser generator, - Copyright (C) 2000, 2002 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 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/bin/bison/src/output.c b/src/bin/bison/src/output.c deleted file mode 100644 index 6a02bb3306..0000000000 --- a/src/bin/bison/src/output.c +++ /dev/null @@ -1,652 +0,0 @@ -/* 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. - - 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 -#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-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; - for (i = 0; i < nsyms; i++) - { - char const *cp = quotearg_style (c_quoting_style, symbols[i]->tag); - /* 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); - obstack_1grow (&format_obstack, ','); - j += width; - } - /* Add a NULL entry to list of tokens (well, 0, as NULL might not be - defined). */ - obstack_sgrow (&format_obstack, " 0"); - - /* 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; - } - assert (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, " case %d:\n", r + 1); - - fprintf (out, "]b4_syncline(%d, ", - rules[r].action_location.start.line); - escaped_output (out, rules[r].action_location.start.file); - fprintf (out, ")[\n"); - fprintf (out, " %s\n break;\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. */ - assert (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 to OUT. | -`---------------------------------------*/ - -static void -symbol_destructors_output (FILE *out) -{ - int i; - char const *sep = ""; - - fputs ("m4_define([b4_symbol_destructors], \n[", out); - for (i = 0; i < nsyms; ++i) - if (symbols[i]->destructor) - { - symbol *sym = symbols[i]; - - /* Filename, lineno, - Symbol-name, Symbol-number, - destructor, optional typename. */ - fprintf (out, "%s[", sep); - sep = ",\n"; - escaped_output (out, sym->destructor_location.start.file); - fprintf (out, ", %d, ", sym->destructor_location.start.line); - escaped_output (out, sym->tag); - fprintf (out, ", %d, [[%s]]", sym->number, sym->destructor); - if (sym->type_name) - fprintf (out, ", [[%s]]", sym->type_name); - fputc (']', out); - } - fputs ("])\n\n", out); -} - - -/*------------------------------------. -| Output the symbol printers to OUT. | -`------------------------------------*/ - -static void -symbol_printers_output (FILE *out) -{ - int i; - char const *sep = ""; - - fputs ("m4_define([b4_symbol_printers], \n[", out); - for (i = 0; i < nsyms; ++i) - if (symbols[i]->printer) - { - symbol *sym = symbols[i]; - - /* Filename, lineno, - Symbol-name, Symbol-number, - printer, optional typename. */ - fprintf (out, "%s[", sep); - sep = ",\n"; - escaped_output (out, sym->printer_location.start.file); - fprintf (out, ", %d, ", sym->printer_location.start.line); - escaped_output (out, sym->tag); - fprintf (out, ", %d, [[%s]]", sym->number, sym->printer); - 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 - look-ahead 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[6]; - pid_t pid; - - /* Compute the names of the package data dir and skeleton file. - Test whether m4sugar.m4 is readable, to check for proper - installation. A faulty installation can cause deadlock, so a - cheap sanity check is worthwhile. */ - char const m4sugar[] = "m4sugar/m4sugar.m4"; - char *full_m4sugar; - char *full_skeleton; - char const *p; - char const *m4 = (p = getenv ("M4")) ? p : M4; - char const *pkgdatadir = (p = getenv ("BISON_PKGDATADIR")) ? p : 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)); - strcpy (full_skeleton, pkgdatadir); - full_skeleton[pkgdatadirlen] = '/'; - strcpy (full_skeleton + pkgdatadirlen + 1, m4sugar); - full_m4sugar = xstrdup (full_skeleton); - strcpy (full_skeleton + pkgdatadirlen + 1, skeleton); - 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\n", - m4, full_m4sugar, full_skeleton); - - argv[0] = m4; - argv[1] = full_m4sugar; - argv[2] = "-"; - argv[3] = full_skeleton; - argv[4] = trace_flag & trace_m4 ? "-dV" : NULL; - argv[5] = NULL; - - init_subpipe (); - pid = create_subpipe (argv, filter_fd); - free (full_m4sugar); - 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_destructors_output (out); - symbol_printers_output (out); - - muscles_m4_output (out); - - fputs ("m4_wrap([m4_divert_pop(0)])\n", out); - fputs ("m4_divert_push(0)dnl\n", 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) -{ - /* 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 ("locations_flag", locations_flag); - MUSCLE_INSERT_BOOL ("pure_flag", pure_parser); - MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag); - - /* File names. */ - MUSCLE_INSERT_STRING ("prefix", spec_name_prefix ? spec_name_prefix : "yy"); -#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 - - /* User Code. */ - obstack_1grow (&pre_prologue_obstack, 0); - obstack_1grow (&post_prologue_obstack, 0); - muscle_insert ("pre_prologue", obstack_finish (&pre_prologue_obstack)); - muscle_insert ("post_prologue", obstack_finish (&post_prologue_obstack)); - - /* Find the right skeleton file. */ - if (!skeleton) - { - if (glr_parser || nondeterministic_parser) - skeleton = "glr.c"; - else - skeleton = "yacc.c"; - } - - /* About the skeletons. */ - { - char const *pkgdatadir = getenv ("BISON_PKGDATADIR"); - MUSCLE_INSERT_STRING ("pkgdatadir", pkgdatadir ? pkgdatadir : PKGDATADIR); - MUSCLE_INSERT_C_STRING ("skeleton", skeleton); - } -} - - -/*----------------------------------------------------------. -| 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); - obstack_free (&pre_prologue_obstack, NULL); - obstack_free (&post_prologue_obstack, NULL); -} diff --git a/src/bin/bison/src/output.h b/src/bin/bison/src/output.h deleted file mode 100644 index 784f227cd2..0000000000 --- a/src/bin/bison/src/output.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Output the generated parsing program for bison, - Copyright (C) 2000, 2001, 2002, 2003, 2006 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 OUTPUT_H_ -# define OUTPUT_H_ - -/* Output the parsing tables and the parser code to FTABLE. */ -void output (void); - -#endif /* !OUTPUT_H_ */ diff --git a/src/bin/bison/src/parse-gram.c b/src/bin/bison/src/parse-gram.c deleted file mode 100644 index 2b77f3eafa..0000000000 --- a/src/bin/bison/src/parse-gram.c +++ /dev/null @@ -1,2485 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.2a. */ - -/* 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 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, 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.2a" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 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 - -/* 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_UNION = 265, - PERCENT_LEFT = 266, - PERCENT_RIGHT = 267, - PERCENT_NONASSOC = 268, - PERCENT_PREC = 269, - PERCENT_DPREC = 270, - PERCENT_MERGE = 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_LEX_PARAM = 282, - PERCENT_LOCATIONS = 283, - PERCENT_NAME_PREFIX = 284, - PERCENT_NO_DEFAULT_PREC = 285, - PERCENT_NO_LINES = 286, - PERCENT_NONDETERMINISTIC_PARSER = 287, - PERCENT_OUTPUT = 288, - PERCENT_PARSE_PARAM = 289, - PERCENT_PURE_PARSER = 290, - PERCENT_REQUIRE = 291, - PERCENT_SKELETON = 292, - PERCENT_START = 293, - PERCENT_TOKEN_TABLE = 294, - PERCENT_VERBOSE = 295, - PERCENT_YACC = 296, - TYPE = 297, - EQUAL = 298, - SEMICOLON = 299, - PIPE = 300, - ID = 301, - ID_COLON = 302, - PERCENT_PERCENT = 303, - PROLOGUE = 304, - EPILOGUE = 305, - BRACED_CODE = 306 - }; -#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_UNION 265 -#define PERCENT_LEFT 266 -#define PERCENT_RIGHT 267 -#define PERCENT_NONASSOC 268 -#define PERCENT_PREC 269 -#define PERCENT_DPREC 270 -#define PERCENT_MERGE 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_LEX_PARAM 282 -#define PERCENT_LOCATIONS 283 -#define PERCENT_NAME_PREFIX 284 -#define PERCENT_NO_DEFAULT_PREC 285 -#define PERCENT_NO_LINES 286 -#define PERCENT_NONDETERMINISTIC_PARSER 287 -#define PERCENT_OUTPUT 288 -#define PERCENT_PARSE_PARAM 289 -#define PERCENT_PURE_PARSER 290 -#define PERCENT_REQUIRE 291 -#define PERCENT_SKELETON 292 -#define PERCENT_START 293 -#define PERCENT_TOKEN_TABLE 294 -#define PERCENT_VERBOSE 295 -#define PERCENT_YACC 296 -#define TYPE 297 -#define EQUAL 298 -#define SEMICOLON 299 -#define PIPE 300 -#define ID 301 -#define ID_COLON 302 -#define PERCENT_PERCENT 303 -#define PROLOGUE 304 -#define EPILOGUE 305 -#define BRACED_CODE 306 - - - - -/* Copy the first part of user declarations. */ -#line 1 "parse-gram.y" -/* Bison Grammar Parser -*- C -*- - - Copyright (C) 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 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 -*/ - -#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 "strverscmp.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 void add_param (char const *, char *, location); - -static symbol_class current_class = unknown_sym; -static uniqstr current_type = 0; -static symbol *current_lhs; -static location current_lhs_location; -static int current_prec = 0; - -#ifdef UINT_FAST8_MAX -# define YYTYPE_UINT8 uint_fast8_t -#endif -#ifdef INT_FAST8_MAX -# define YYTYPE_INT8 int_fast8_t -#endif -#ifdef UINT_FAST16_MAX -# define YYTYPE_UINT16 uint_fast16_t -#endif -#ifdef INT_FAST16_MAX -# define YYTYPE_INT16 int_fast16_t -#endif - - -/* 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 - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 94 "parse-gram.y" -{ - symbol *symbol; - symbol_list *list; - int integer; - char *chars; - assoc assoc; - uniqstr uniqstr; -} -/* Line 193 of yacc.c. */ -#line 290 "parse-gram.c" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 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 216 of yacc.c. */ -#line 315 "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 i) -#else -static int -YYID (i) - int i; -#endif -{ - return i; -} -#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; - YYSTYPE yyvs; - YYLTYPE yyls; -}; - -/* 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) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - 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 161 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 52 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 26 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 82 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 111 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 306 - -#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 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 8, 9, 12, 14, 16, 18, 21, - 25, 27, 29, 32, 35, 39, 41, 43, 45, 47, - 51, 53, 55, 59, 61, 63, 66, 69, 71, 73, - 75, 77, 79, 81, 84, 86, 89, 92, 94, 96, - 97, 101, 102, 106, 110, 114, 116, 118, 120, 121, - 123, 125, 128, 130, 132, 135, 138, 142, 144, 147, - 149, 152, 154, 157, 160, 161, 165, 167, 171, 174, - 175, 178, 181, 185, 189, 193, 195, 197, 198, 201, - 203, 205, 206 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 53, 0, -1, 54, 48, 66, 77, -1, -1, 54, - 55, -1, 56, -1, 49, -1, 17, -1, 19, 76, - -1, 19, 76, 76, -1, 20, -1, 21, -1, 22, - 4, -1, 23, 4, -1, 24, 43, 76, -1, 25, - -1, 26, -1, 27, -1, 28, -1, 29, 43, 76, - -1, 31, -1, 32, -1, 33, 43, 76, -1, 34, - -1, 35, -1, 36, 76, -1, 37, 76, -1, 39, - -1, 40, -1, 41, -1, 44, -1, 60, -1, 57, - -1, 38, 72, -1, 10, -1, 8, 63, -1, 9, - 63, -1, 18, -1, 30, -1, -1, 6, 58, 65, - -1, -1, 5, 59, 65, -1, 7, 42, 63, -1, - 61, 62, 63, -1, 11, -1, 12, -1, 13, -1, - -1, 42, -1, 72, -1, 63, 72, -1, 42, -1, - 46, -1, 46, 4, -1, 46, 75, -1, 46, 4, - 75, -1, 64, -1, 65, 64, -1, 67, -1, 66, - 67, -1, 68, -1, 56, 44, -1, 1, 44, -1, - -1, 47, 69, 70, -1, 71, -1, 70, 45, 71, - -1, 70, 44, -1, -1, 71, 72, -1, 71, 73, - -1, 71, 14, 72, -1, 71, 15, 4, -1, 71, - 16, 42, -1, 46, -1, 75, -1, -1, 74, 51, - -1, 3, -1, 3, -1, -1, 48, 50, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 202, 202, 210, 212, 216, 217, 218, 219, 224, - 225, 226, 227, 228, 229, 230, 235, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 256, 257, 258, 262, 278, 285, 292, 296, 303, - 303, 308, 308, 313, 323, 338, 339, 340, 344, 345, - 351, 352, 357, 361, 366, 372, 378, 389, 390, 399, - 400, 406, 407, 408, 415, 415, 419, 420, 421, 426, - 427, 429, 430, 432, 434, 439, 440, 456, 456, 462, - 471, 476, 478 -}; -#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 {...}\"", "\"%union {...}\"", "\"%left\"", "\"%right\"", - "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%debug\"", - "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"", - "\"%expect\"", "\"%expect-rr\"", "\"%file-prefix\"", "\"%glr-parser\"", - "\"%initial-action {...}\"", "\"%lex-param {...}\"", "\"%locations\"", - "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"", - "\"%nondeterministic-parser\"", "\"%output\"", "\"%parse-param {...}\"", - "\"%pure-parser\"", "\"%require\"", "\"%skeleton\"", "\"%start\"", - "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", "\"type\"", "\"=\"", - "\";\"", "\"|\"", "\"identifier\"", "\"identifier:\"", "\"%%\"", - "\"%{...%}\"", "\"epilogue\"", "\"{...}\"", "$accept", "input", - "declarations", "declaration", "grammar_declaration", - "symbol_declaration", "@1", "@2", "precedence_declaration", - "precedence_declarator", "type.opt", "symbols.1", "symbol_def", - "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules", - "@3", "rhses.1", "rhs", "symbol", "action", "@4", "string_as_id", - "string_content", "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 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 52, 53, 54, 54, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 56, 56, 56, 56, 56, 56, 56, 56, 58, - 57, 59, 57, 57, 60, 61, 61, 61, 62, 62, - 63, 63, 64, 64, 64, 64, 64, 65, 65, 66, - 66, 67, 67, 67, 69, 68, 70, 70, 70, 71, - 71, 71, 71, 71, 71, 72, 72, 74, 73, 75, - 76, 77, 77 -}; - -/* 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, 2, 3, - 1, 1, 2, 2, 3, 1, 1, 1, 1, 3, - 1, 1, 3, 1, 1, 2, 2, 1, 1, 1, - 1, 1, 1, 2, 1, 2, 2, 1, 1, 0, - 3, 0, 3, 3, 3, 1, 1, 1, 0, 1, - 1, 2, 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, 2, 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, 41, 39, 0, 0, 0, 34, - 45, 46, 47, 7, 37, 0, 10, 11, 0, 0, - 0, 15, 16, 17, 18, 0, 38, 20, 21, 0, - 23, 24, 0, 0, 0, 27, 28, 29, 30, 0, - 6, 4, 5, 32, 31, 48, 0, 0, 0, 79, - 75, 35, 50, 76, 36, 80, 8, 12, 13, 0, - 0, 0, 25, 26, 33, 0, 64, 0, 0, 59, - 61, 49, 0, 52, 53, 57, 42, 40, 43, 51, - 9, 14, 19, 22, 63, 69, 62, 0, 60, 2, - 44, 54, 55, 58, 65, 66, 82, 56, 68, 69, - 0, 0, 0, 70, 71, 0, 67, 72, 73, 74, - 78 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 1, 2, 41, 67, 43, 47, 46, 44, 45, - 72, 51, 75, 76, 68, 69, 70, 85, 94, 95, - 52, 104, 105, 53, 56, 89 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -69 -static const yytype_int8 yypact[] = -{ - -69, 5, 112, -69, -69, -69, -35, 0, 0, -69, - -69, -69, -69, -69, -69, 13, -69, -69, 20, 31, - -18, -69, -69, -69, -69, -6, -69, -69, -69, -5, - -69, -69, 13, 13, 0, -69, -69, -69, -69, 69, - -69, -69, -69, -69, -69, -2, -38, -38, 0, -69, - -69, 0, -69, -69, 0, -69, 13, -69, -69, 13, - 13, 13, -69, -69, -69, -8, -69, 3, 21, -69, - -69, -69, 0, -69, 6, -69, -38, -38, 0, -69, - -69, -69, -69, -69, -69, -69, -69, 2, -69, -69, - 0, 39, -69, -69, -33, -1, -69, -69, -69, -69, - 0, 44, 1, -69, -69, 4, -1, -69, -69, -69, - -69 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = -{ - -69, -69, -69, -69, 47, -69, -69, -69, -69, -69, - -69, -7, -58, 7, -69, -15, -69, -69, -69, -42, - -34, -69, -69, -68, 30, -69 -}; - -/* 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 -82 -static const yytype_int8 yytable[] = -{ - 64, 54, 49, 49, 73, 3, 92, 48, 74, 49, - 91, 98, 99, 100, 101, 102, 55, 79, 93, 93, - 79, -81, 65, 97, 57, 59, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 58, 84, 60, 61, 14, - 71, 78, 49, 109, 79, 50, 50, 86, 108, 42, - -77, 26, 96, 88, 77, 110, 79, 106, 0, 34, - 0, 103, 62, 63, 0, 90, 107, 0, 66, 87, - 65, 0, 103, 0, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 0, 0, 0, 80, 14, 0, 81, - 82, 83, 0, 0, 0, 0, 0, 0, 0, 26, - 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, - 0, 0, 0, 0, 0, 0, 66, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 0, 0, 0, 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, 0, 0, 38, 0, 0, 0, - 39, 40 -}; - -static const yytype_int8 yycheck[] = -{ - 34, 8, 3, 3, 42, 0, 74, 42, 46, 3, - 4, 44, 45, 14, 15, 16, 3, 51, 76, 77, - 54, 0, 1, 91, 4, 43, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 4, 44, 43, 43, 18, - 42, 48, 3, 42, 78, 46, 46, 44, 4, 2, - 51, 30, 50, 68, 47, 51, 90, 99, -1, 38, - -1, 95, 32, 33, -1, 72, 100, -1, 47, 48, - 1, -1, 106, -1, 5, 6, 7, 8, 9, 10, - 11, 12, 13, -1, -1, -1, 56, 18, -1, 59, - 60, 61, -1, -1, -1, -1, -1, -1, -1, 30, - -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, - -1, -1, -1, -1, -1, -1, 47, 5, 6, 7, - 8, 9, 10, 11, 12, 13, -1, -1, -1, 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, -1, -1, 44, -1, -1, -1, - 48, 49 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 53, 54, 0, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 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, 44, 48, - 49, 55, 56, 57, 60, 61, 59, 58, 42, 3, - 46, 63, 72, 75, 63, 3, 76, 4, 4, 43, - 43, 43, 76, 76, 72, 1, 47, 56, 66, 67, - 68, 42, 62, 42, 46, 64, 65, 65, 63, 72, - 76, 76, 76, 76, 44, 69, 44, 48, 67, 77, - 63, 4, 75, 64, 70, 71, 50, 75, 44, 45, - 14, 15, 16, 72, 73, 74, 71, 72, 4, 42, - 51 -}; - -#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 179 "parse-gram.y" - { fprintf (stderr, "\"%s\"", (yyvaluep->chars)); }; -#line 979 "parse-gram.c" - break; - case 4: /* "\"integer\"" */ -#line 192 "parse-gram.y" - { fprintf (stderr, "%d", (yyvaluep->integer)); }; -#line 984 "parse-gram.c" - break; - case 8: /* "\"%destructor {...}\"" */ -#line 181 "parse-gram.y" - { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 989 "parse-gram.c" - break; - case 9: /* "\"%printer {...}\"" */ -#line 181 "parse-gram.y" - { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 994 "parse-gram.c" - break; - case 10: /* "\"%union {...}\"" */ -#line 181 "parse-gram.y" - { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 999 "parse-gram.c" - break; - case 26: /* "\"%initial-action {...}\"" */ -#line 181 "parse-gram.y" - { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 1004 "parse-gram.c" - break; - case 27: /* "\"%lex-param {...}\"" */ -#line 181 "parse-gram.y" - { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 1009 "parse-gram.c" - break; - case 34: /* "\"%parse-param {...}\"" */ -#line 181 "parse-gram.y" - { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 1014 "parse-gram.c" - break; - case 42: /* "\"type\"" */ -#line 190 "parse-gram.y" - { fprintf (stderr, "<%s>", (yyvaluep->uniqstr)); }; -#line 1019 "parse-gram.c" - break; - case 46: /* "\"identifier\"" */ -#line 194 "parse-gram.y" - { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; -#line 1024 "parse-gram.c" - break; - case 47: /* "\"identifier:\"" */ -#line 196 "parse-gram.y" - { fprintf (stderr, "%s:", (yyvaluep->symbol)->tag); }; -#line 1029 "parse-gram.c" - break; - case 49: /* "\"%{...%}\"" */ -#line 181 "parse-gram.y" - { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 1034 "parse-gram.c" - break; - case 50: /* "\"epilogue\"" */ -#line 181 "parse-gram.y" - { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 1039 "parse-gram.c" - break; - case 72: /* "symbol" */ -#line 194 "parse-gram.y" - { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; -#line 1044 "parse-gram.c" - break; - case 75: /* "string_as_id" */ -#line 194 "parse-gram.y" - { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; -#line 1049 "parse-gram.c" - break; - case 76: /* "string_content" */ -#line 179 "parse-gram.y" - { fprintf (stderr, "\"%s\"", (yyvaluep->chars)); }; -#line 1054 "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 *bottom, yytype_int16 *top) -#else -static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); - 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++) - { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , &(yylsp[(yyi + 1) - (yynrhs)]) ); - fprintf (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. | -`----------*/ - -#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 look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ -YYLTYPE yylloc; - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three 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 = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - YYLTYPE yyloc; - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - 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 = 0; -#endif - - - /* User initialization code. */ -#line 84 "parse-gram.y" -{ - /* Bison's grammar can initial empty locations, hence a default - location is needed. */ - yylloc.start.file = yylloc.end.file = current_file; - yylloc.start.line = yylloc.end.line = 1; - yylloc.start.column = yylloc.end.column = 0; -} -/* Line 1078 of yacc.c. */ -#line 1573 "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); - YYSTACK_RELOCATE (yyvs); - YYSTACK_RELOCATE (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)); - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a look-ahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead 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; - } - - if (yyn == YYFINAL) - YYACCEPT; - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - 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 217 "parse-gram.y" - { prologue_augment ((yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); } - break; - - case 7: -#line 218 "parse-gram.y" - { debug_flag = true; } - break; - - case 8: -#line 220 "parse-gram.y" - { - static char one[] = "1"; - muscle_insert ((yyvsp[(2) - (2)].chars), one); - } - break; - - case 9: -#line 224 "parse-gram.y" - { muscle_insert ((yyvsp[(2) - (3)].chars), (yyvsp[(3) - (3)].chars)); } - break; - - case 10: -#line 225 "parse-gram.y" - { defines_flag = true; } - break; - - case 11: -#line 226 "parse-gram.y" - { error_verbose = true; } - break; - - case 12: -#line 227 "parse-gram.y" - { expected_sr_conflicts = (yyvsp[(2) - (2)].integer); } - break; - - case 13: -#line 228 "parse-gram.y" - { expected_rr_conflicts = (yyvsp[(2) - (2)].integer); } - break; - - case 14: -#line 229 "parse-gram.y" - { spec_file_prefix = (yyvsp[(3) - (3)].chars); } - break; - - case 15: -#line 231 "parse-gram.y" - { - nondeterministic_parser = true; - glr_parser = true; - } - break; - - case 16: -#line 236 "parse-gram.y" - { - muscle_code_grow ("initial_action", (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); - } - break; - - case 17: -#line 239 "parse-gram.y" - { add_param ("lex_param", (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); } - break; - - case 18: -#line 240 "parse-gram.y" - { locations_flag = true; } - break; - - case 19: -#line 241 "parse-gram.y" - { spec_name_prefix = (yyvsp[(3) - (3)].chars); } - break; - - case 20: -#line 242 "parse-gram.y" - { no_lines_flag = true; } - break; - - case 21: -#line 243 "parse-gram.y" - { nondeterministic_parser = true; } - break; - - case 22: -#line 244 "parse-gram.y" - { spec_outfile = (yyvsp[(3) - (3)].chars); } - break; - - case 23: -#line 245 "parse-gram.y" - { add_param ("parse_param", (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); } - break; - - case 24: -#line 246 "parse-gram.y" - { pure_parser = true; } - break; - - case 25: -#line 247 "parse-gram.y" - { version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); } - break; - - case 26: -#line 248 "parse-gram.y" - { skeleton = (yyvsp[(2) - (2)].chars); } - break; - - case 27: -#line 249 "parse-gram.y" - { token_table_flag = true; } - break; - - case 28: -#line 250 "parse-gram.y" - { report_flag = report_states; } - break; - - case 29: -#line 251 "parse-gram.y" - { yacc_flag = true; } - break; - - case 33: -#line 259 "parse-gram.y" - { - grammar_start_symbol_set ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); - } - break; - - case 34: -#line 263 "parse-gram.y" - { - char const *body = (yyvsp[(1) - (1)].chars); - - if (typed) - { - /* Concatenate the union bodies, turning the first one's - trailing '}' into '\n', and omitting the second one's '{'. */ - char *code = muscle_find ("stype"); - code[strlen (code) - 1] = '\n'; - body++; - } - - typed = true; - muscle_code_grow ("stype", body, (yylsp[(1) - (1)])); - } - break; - - case 35: -#line 279 "parse-gram.y" - { - symbol_list *list; - for (list = (yyvsp[(2) - (2)].list); list; list = list->next) - symbol_destructor_set (list->sym, (yyvsp[(1) - (2)].chars), (yylsp[(1) - (2)])); - symbol_list_free ((yyvsp[(2) - (2)].list)); - } - break; - - case 36: -#line 286 "parse-gram.y" - { - symbol_list *list; - for (list = (yyvsp[(2) - (2)].list); list; list = list->next) - symbol_printer_set (list->sym, (yyvsp[(1) - (2)].chars), (yylsp[(1) - (2)])); - symbol_list_free ((yyvsp[(2) - (2)].list)); - } - break; - - case 37: -#line 293 "parse-gram.y" - { - default_prec = true; - } - break; - - case 38: -#line 297 "parse-gram.y" - { - default_prec = false; - } - break; - - case 39: -#line 303 "parse-gram.y" - { current_class = nterm_sym; } - break; - - case 40: -#line 304 "parse-gram.y" - { - current_class = unknown_sym; - current_type = NULL; - } - break; - - case 41: -#line 308 "parse-gram.y" - { current_class = token_sym; } - break; - - case 42: -#line 309 "parse-gram.y" - { - current_class = unknown_sym; - current_type = NULL; - } - break; - - case 43: -#line 314 "parse-gram.y" - { - symbol_list *list; - for (list = (yyvsp[(3) - (3)].list); list; list = list->next) - symbol_type_set (list->sym, (yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)])); - symbol_list_free ((yyvsp[(3) - (3)].list)); - } - break; - - case 44: -#line 324 "parse-gram.y" - { - symbol_list *list; - ++current_prec; - for (list = (yyvsp[(3) - (3)].list); list; list = list->next) - { - symbol_type_set (list->sym, current_type, (yylsp[(2) - (3)])); - symbol_precedence_set (list->sym, current_prec, (yyvsp[(1) - (3)].assoc), (yylsp[(1) - (3)])); - } - symbol_list_free ((yyvsp[(3) - (3)].list)); - current_type = NULL; - } - break; - - case 45: -#line 338 "parse-gram.y" - { (yyval.assoc) = left_assoc; } - break; - - case 46: -#line 339 "parse-gram.y" - { (yyval.assoc) = right_assoc; } - break; - - case 47: -#line 340 "parse-gram.y" - { (yyval.assoc) = non_assoc; } - break; - - case 48: -#line 344 "parse-gram.y" - { current_type = NULL; } - break; - - case 49: -#line 345 "parse-gram.y" - { current_type = (yyvsp[(1) - (1)].uniqstr); } - break; - - case 50: -#line 351 "parse-gram.y" - { (yyval.list) = symbol_list_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); } - break; - - case 51: -#line 352 "parse-gram.y" - { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); } - break; - - case 52: -#line 358 "parse-gram.y" - { - current_type = (yyvsp[(1) - (1)].uniqstr); - } - break; - - case 53: -#line 362 "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 54: -#line 367 "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 55: -#line 373 "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 56: -#line 379 "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 63: -#line 409 "parse-gram.y" - { - yyerrok; - } - break; - - case 64: -#line 415 "parse-gram.y" - { current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = (yylsp[(1) - (1)]); } - break; - - case 66: -#line 419 "parse-gram.y" - { grammar_current_rule_end ((yylsp[(1) - (1)])); } - break; - - case 67: -#line 420 "parse-gram.y" - { grammar_current_rule_end ((yylsp[(3) - (3)])); } - break; - - case 69: -#line 426 "parse-gram.y" - { grammar_current_rule_begin (current_lhs, current_lhs_location); } - break; - - case 70: -#line 428 "parse-gram.y" - { grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); } - break; - - case 72: -#line 431 "parse-gram.y" - { grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); } - break; - - case 73: -#line 433 "parse-gram.y" - { grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); } - break; - - case 74: -#line 435 "parse-gram.y" - { grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); } - break; - - case 75: -#line 439 "parse-gram.y" - { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); } - break; - - case 76: -#line 440 "parse-gram.y" - { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); } - break; - - case 77: -#line 456 "parse-gram.y" - { grammar_current_rule_action_append (last_string, last_braced_code_loc); } - break; - - case 79: -#line 463 "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 80: -#line 472 "parse-gram.y" - { (yyval.chars) = (yyvsp[(1) - (1)].chars); } - break; - - case 82: -#line 479 "parse-gram.y" - { - muscle_code_grow ("epilogue", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); - scanner_last_string_free (); - } - break; - - -/* Line 1267 of yacc.c. */ -#line 2159 "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 look-ahead 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 look-ahead 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); - } - - if (yyn == YYFINAL) - YYACCEPT; - - *++yyvsp = yylval; - - yyerror_range[1] = yylloc; - /* Using YYLLOC is tempting, but would change the location of - the look-ahead. 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; - -#ifndef yyoverflow -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEOF && 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 485 "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); - } - - 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)]; -} - diff --git a/src/bin/bison/src/parse-gram.h b/src/bin/bison/src/parse-gram.h deleted file mode 100644 index 2d37fc10f0..0000000000 --- a/src/bin/bison/src/parse-gram.h +++ /dev/null @@ -1,183 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.2a. */ - -/* 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 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, 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_UNION = 265, - PERCENT_LEFT = 266, - PERCENT_RIGHT = 267, - PERCENT_NONASSOC = 268, - PERCENT_PREC = 269, - PERCENT_DPREC = 270, - PERCENT_MERGE = 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_LEX_PARAM = 282, - PERCENT_LOCATIONS = 283, - PERCENT_NAME_PREFIX = 284, - PERCENT_NO_DEFAULT_PREC = 285, - PERCENT_NO_LINES = 286, - PERCENT_NONDETERMINISTIC_PARSER = 287, - PERCENT_OUTPUT = 288, - PERCENT_PARSE_PARAM = 289, - PERCENT_PURE_PARSER = 290, - PERCENT_REQUIRE = 291, - PERCENT_SKELETON = 292, - PERCENT_START = 293, - PERCENT_TOKEN_TABLE = 294, - PERCENT_VERBOSE = 295, - PERCENT_YACC = 296, - TYPE = 297, - EQUAL = 298, - SEMICOLON = 299, - PIPE = 300, - ID = 301, - ID_COLON = 302, - PERCENT_PERCENT = 303, - PROLOGUE = 304, - EPILOGUE = 305, - BRACED_CODE = 306 - }; -#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_UNION 265 -#define PERCENT_LEFT 266 -#define PERCENT_RIGHT 267 -#define PERCENT_NONASSOC 268 -#define PERCENT_PREC 269 -#define PERCENT_DPREC 270 -#define PERCENT_MERGE 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_LEX_PARAM 282 -#define PERCENT_LOCATIONS 283 -#define PERCENT_NAME_PREFIX 284 -#define PERCENT_NO_DEFAULT_PREC 285 -#define PERCENT_NO_LINES 286 -#define PERCENT_NONDETERMINISTIC_PARSER 287 -#define PERCENT_OUTPUT 288 -#define PERCENT_PARSE_PARAM 289 -#define PERCENT_PURE_PARSER 290 -#define PERCENT_REQUIRE 291 -#define PERCENT_SKELETON 292 -#define PERCENT_START 293 -#define PERCENT_TOKEN_TABLE 294 -#define PERCENT_VERBOSE 295 -#define PERCENT_YACC 296 -#define TYPE 297 -#define EQUAL 298 -#define SEMICOLON 299 -#define PIPE 300 -#define ID 301 -#define ID_COLON 302 -#define PERCENT_PERCENT 303 -#define PROLOGUE 304 -#define EPILOGUE 305 -#define BRACED_CODE 306 - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 94 "parse-gram.y" -{ - symbol *symbol; - symbol_list *list; - int integer; - char *chars; - assoc assoc; - uniqstr uniqstr; -} -/* Line 1529 of yacc.c. */ -#line 162 "parse-gram.h" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 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/bin/bison/src/parse-gram.y b/src/bin/bison/src/parse-gram.y deleted file mode 100644 index e189e14346..0000000000 --- a/src/bin/bison/src/parse-gram.y +++ /dev/null @@ -1,590 +0,0 @@ -%{/* Bison Grammar Parser -*- C -*- - - Copyright (C) 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 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 -*/ - -#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 "strverscmp.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 void add_param (char const *, char *, location); - -static symbol_class current_class = unknown_sym; -static uniqstr current_type = 0; -static symbol *current_lhs; -static location current_lhs_location; -static int current_prec = 0; - -#ifdef UINT_FAST8_MAX -# define YYTYPE_UINT8 uint_fast8_t -#endif -#ifdef INT_FAST8_MAX -# define YYTYPE_INT8 int_fast8_t -#endif -#ifdef UINT_FAST16_MAX -# define YYTYPE_UINT16 uint_fast16_t -#endif -#ifdef INT_FAST16_MAX -# define YYTYPE_INT16 int_fast16_t -#endif -%} - -%debug -%verbose -%defines -%locations -%pure-parser -%error-verbose -%defines -%name-prefix="gram_" - -%initial-action -{ - /* Bison's grammar can initial empty locations, hence a default - location is needed. */ - @$.start.file = @$.end.file = current_file; - @$.start.line = @$.end.line = 1; - @$.start.column = @$.end.column = 0; -} - -/* Only NUMBERS have a value. */ -%union -{ - symbol *symbol; - symbol_list *list; - int integer; - char *chars; - assoc assoc; - uniqstr uniqstr; -}; - -/* 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_UNION "%union {...}" - -%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_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_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 TYPE "type" -%token EQUAL "=" -%token SEMICOLON ";" -%token PIPE "|" -%token ID "identifier" -%token ID_COLON "identifier:" -%token PERCENT_PERCENT "%%" -%token PROLOGUE "%{...%}" -%token EPILOGUE "epilogue" -%token BRACED_CODE "{...}" - - -%type STRING string_content - "%destructor {...}" - "%initial-action {...}" - "%lex-param {...}" - "%parse-param {...}" - "%printer {...}" - "%union {...}" - PROLOGUE EPILOGUE -%printer { fprintf (stderr, "\"%s\"", $$); } - STRING string_content -%printer { fprintf (stderr, "{\n%s\n}", $$); } - "%destructor {...}" - "%initial-action {...}" - "%lex-param {...}" - "%parse-param {...}" - "%printer {...}" - "%union {...}" - PROLOGUE EPILOGUE -%type TYPE -%printer { fprintf (stderr, "<%s>", $$); } TYPE -%type INT -%printer { fprintf (stderr, "%d", $$); } INT -%type ID symbol string_as_id -%printer { fprintf (stderr, "%s", $$->tag); } ID symbol string_as_id -%type ID_COLON -%printer { fprintf (stderr, "%s:", $$->tag); } ID_COLON -%type precedence_declarator -%type symbols.1 -%% - -input: - declarations "%%" grammar epilogue.opt -; - - - /*------------------------------------. - | Declarations: before the first %%. | - `------------------------------------*/ - -declarations: - /* Nothing */ -| declarations declaration -; - -declaration: - grammar_declaration -| PROLOGUE { prologue_augment ($1, @1); } -| "%debug" { debug_flag = true; } -| "%define" string_content - { - static char one[] = "1"; - muscle_insert ($2, one); - } -| "%define" string_content string_content { muscle_insert ($2, $3); } -| "%defines" { defines_flag = true; } -| "%error-verbose" { error_verbose = true; } -| "%expect" INT { expected_sr_conflicts = $2; } -| "%expect-rr" INT { expected_rr_conflicts = $2; } -| "%file-prefix" "=" string_content { spec_file_prefix = $3; } -| "%glr-parser" - { - nondeterministic_parser = true; - glr_parser = true; - } -| "%initial-action {...}" - { - muscle_code_grow ("initial_action", $1, @1); - } -| "%lex-param {...}" { add_param ("lex_param", $1, @1); } -| "%locations" { locations_flag = true; } -| "%name-prefix" "=" string_content { spec_name_prefix = $3; } -| "%no-lines" { no_lines_flag = true; } -| "%nondeterministic-parser" { nondeterministic_parser = true; } -| "%output" "=" string_content { spec_outfile = $3; } -| "%parse-param {...}" { add_param ("parse_param", $1, @1); } -| "%pure-parser" { pure_parser = true; } -| "%require" string_content { version_check (&@2, $2); } -| "%skeleton" string_content { skeleton = $2; } -| "%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); - } -| "%union {...}" - { - char const *body = $1; - - if (typed) - { - /* Concatenate the union bodies, turning the first one's - trailing '}' into '\n', and omitting the second one's '{'. */ - char *code = muscle_find ("stype"); - code[strlen (code) - 1] = '\n'; - body++; - } - - typed = true; - muscle_code_grow ("stype", body, @1); - } -| "%destructor {...}" symbols.1 - { - symbol_list *list; - for (list = $2; list; list = list->next) - symbol_destructor_set (list->sym, $1, @1); - symbol_list_free ($2); - } -| "%printer {...}" symbols.1 - { - symbol_list *list; - for (list = $2; list; list = list->next) - symbol_printer_set (list->sym, $1, @1); - symbol_list_free ($2); - } -| "%default-prec" - { - default_prec = true; - } -| "%no-default-prec" - { - default_prec = false; - } -; - -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; - for (list = $3; list; list = list->next) - symbol_type_set (list->sym, $2, @2); - symbol_list_free ($3); - } -; - -precedence_declaration: - precedence_declarator type.opt symbols.1 - { - symbol_list *list; - ++current_prec; - for (list = $3; list; list = list->next) - { - symbol_type_set (list->sym, current_type, @2); - symbol_precedence_set (list->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; } -; - -/* One or more nonterminals to be %typed. */ - -symbols.1: - symbol { $$ = symbol_list_new ($1, @1); } -| symbols.1 symbol { $$ = symbol_list_prepend ($1, $2, @2); } -; - -/* One token definition. */ -symbol_def: - TYPE - { - current_type = $1; - } -| 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 action -| 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); } -; - -symbol: - ID { $$ = $1; } -| string_as_id { $$ = $1; } -; - -/* Handle the semantics of an action specially, with a mid-rule - action, so that grammar_current_rule_action_append is invoked - immediately after the braced code is read by the scanner. - - This implementation relies on the LALR(1) parsing algorithm. - If grammar_current_rule_action_append were executed in a normal - action for this rule, then when the input grammar contains two - successive actions, the scanner would have to read both actions - before reducing this rule. That wouldn't work, since the scanner - relies on all preceding input actions being processed by - grammar_current_rule_action_append before it scans the next - action. */ -action: - { grammar_current_rule_action_append (last_string, last_braced_code_loc); } - BRACED_CODE -; - -/* 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); - } -; - -/* A string used for its contents. Don't quote it. */ -string_content: - STRING - { $$ = $1; } -; - - -epilogue.opt: - /* Nothing. */ -| "%%" EPILOGUE - { - muscle_code_grow ("epilogue", $2, @2); - 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); - } - - 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)]; -} diff --git a/src/bin/bison/src/print.c b/src/bin/bison/src/print.c deleted file mode 100644 index cb1600c9fa..0000000000 --- a/src/bin/bison/src/print.c +++ /dev/null @@ -1,575 +0,0 @@ -/* Print information on generated parser, for bison, - - Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004, 2005 - 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 "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" - -static bitset shift_set; -static bitset look_ahead_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 = nritemset; - } - - 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 look-ahead tokens? */ - if (report_flag & report_look_ahead_tokens) - state_rule_look_ahead_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 look-ahead 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 look-ahead 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 look-ahead 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 look-ahead 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); - } -} - - -/*-------------------------------------------------------------. -| Return the default rule of S if it has one, NULL otherwise. | -`-------------------------------------------------------------*/ - -static rule * -state_default_rule (state *s) -{ - reductions *reds = s->reductions; - rule *default_rule = NULL; - int cmax = 0; - int i; - - /* No need for a look-ahead. */ - if (s->consistent) - return reds->rules[0]; - - /* 1. Each reduction is possibly masked by the look-ahead tokens on which - we shift (S/R conflicts)... */ - bitset_zero (shift_set); - { - transitions *trans = s->transitions; - FOR_EACH_SHIFT (trans, i) - { - /* If this state has a shift for the error token, don't use a - default rule. */ - if (TRANSITION_IS_ERROR (trans, i)) - return NULL; - bitset_set (shift_set, TRANSITION_SYMBOL (trans, i)); - } - } - - /* 2. Each reduction is possibly masked by the look-ahead tokens on which - we raise an error (due to %nonassoc). */ - { - errs *errp = s->errs; - for (i = 0; i < errp->num; i++) - if (errp->symbols[i]) - bitset_set (shift_set, errp->symbols[i]->number); - } - - for (i = 0; i < reds->num; ++i) - { - int count = 0; - - /* How many non-masked look-ahead tokens are there for this - reduction? */ - bitset_andn (look_ahead_set, reds->look_ahead_tokens[i], shift_set); - count = bitset_count (look_ahead_set); - - if (count > cmax) - { - cmax = count; - default_rule = reds->rules[i]; - } - - /* 3. And finally, each reduction is possibly masked by previous - reductions (in R/R conflicts, we keep the first reductions). - */ - bitset_or (shift_set, shift_set, reds->look_ahead_tokens[i]); - } - - return default_rule; -} - - -/*--------------------------------------------------------------------------. -| Report a reduction of RULE on LOOK_AHEAD_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 *look_ahead_token, - rule *r, bool enabled) -{ - int j; - fprintf (out, " %s", look_ahead_token); - for (j = width - strlen (look_ahead_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; - - default_rule = state_default_rule (s); - - bitset_zero (shift_set); - FOR_EACH_SHIFT (trans, i) - bitset_set (shift_set, TRANSITION_SYMBOL (trans, i)); - - /* Compute the width of the look-ahead token column. */ - if (default_rule) - width = strlen (_("$default")); - - if (reds->look_ahead_tokens) - for (i = 0; i < ntokens; i++) - { - bool count = bitset_test (shift_set, i); - - for (j = 0; j < reds->num; ++j) - if (bitset_test (reds->look_ahead_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 look-ahead tokens (or $default) and reductions. */ - if (reds->look_ahead_tokens) - for (i = 0; i < ntokens; i++) - { - bool defaulted = false; - bool count = bitset_test (shift_set, i); - - for (j = 0; j < reds->num; ++j) - if (bitset_test (reds->look_ahead_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 (50); - 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 (50); - sprintf (buffer + strlen (buffer), _(" on left:")); - - for (r = 0; r < nrules; r++) - { - END_TEST (65); - if (rules[r].lhs->number == i) - sprintf (buffer + strlen (buffer), " %d", r); - } - } - - if (right_count > 0) - { - if (left_count > 0) - sprintf (buffer + strlen (buffer), ","); - END_TEST (50); - 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 never reduced"), rule_never_reduced_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. */ - shift_set = bitset_create (ntokens, BITSET_FIXED); - look_ahead_set = bitset_create (ntokens, BITSET_FIXED); - for (i = 0; i < nstates; i++) - print_state (out, states[i]); - bitset_free (shift_set); - bitset_free (look_ahead_set); - if (report_flag & report_itemsets) - free_closure (); - - xfclose (out); -} diff --git a/src/bin/bison/src/print.h b/src/bin/bison/src/print.h deleted file mode 100644 index 1daa577d9f..0000000000 --- a/src/bin/bison/src/print.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Print information on generated parser, for bison, - Copyright 2000 Free Software Foundation, Inc. - - This file is part of Bison, the GNU Compiler Compiler. - - Bison is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - Bison is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -#ifndef PRINT_H_ -# define PRINT_H_ - -void print_results (void); - -#endif /* !PRINT_H_ */ diff --git a/src/bin/bison/src/print_graph.c b/src/bin/bison/src/print_graph.c deleted file mode 100644 index 9580f3f145..0000000000 --- a/src/bin/bison/src/print_graph.c +++ /dev/null @@ -1,227 +0,0 @@ -/* Output a VCG description on generated parser, for Bison, - - Copyright (C) 2001, 2002, 2003, 2004, 2005 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 "LR0.h" -#include "closure.h" -#include "complain.h" -#include "conflicts.h" -#include "files.h" -#include "getargs.h" -#include "gram.h" -#include "lalr.h" -#include "print_graph.h" -#include "reader.h" -#include "state.h" -#include "symtab.h" -#include "vcg.h" - -static graph static_graph; -static FILE *fgraph = NULL; - - -/*----------------------------. -| 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 = nritemset; - } - - obstack_fgrow1 (oout, "state %2d\n", 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); - - if (i) - obstack_1grow (oout, '\n'); - obstack_fgrow1 (oout, " %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 look-ahead tokens. */ - if (report_flag & report_look_ahead_tokens) - { - /* 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->look_ahead_tokens && redno != -1) - { - bitset_iterator biter; - int k; - char const *sep = ""; - obstack_sgrow (oout, "["); - BITSET_FOR_EACH (biter, reds->look_ahead_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 *s, const char *node_name) -{ - int i; - - transitions *trans = s->transitions; - reductions *reds = s->reductions; - - static char buff[10]; - edge e; - - if (!trans->num && !reds) - 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; - - new_edge (&e); - - if (s->number > s1->number) - e.type = back_edge; - open_edge (&e, fgraph); - /* The edge source is the current node. */ - e.sourcename = node_name; - sprintf (buff, "%d", s1->number); - e.targetname = buff; - /* Shifts are blue, gotos are green, and error is red. */ - if (TRANSITION_IS_ERROR (trans, i)) - e.color = red; - else - e.color = TRANSITION_IS_SHIFT (trans, i) ? blue : green; - e.label = symbols[sym]->tag; - output_edge (&e, fgraph); - close_edge (fgraph); - } -} - - -/*-------------------------------------------------------------. -| Output in FGRAPH the current node specifications and exiting | -| edges. | -`-------------------------------------------------------------*/ - -static void -print_state (state *s) -{ - static char name[10]; - struct obstack node_obstack; - node n; - - /* The labels of the nodes are their the items. */ - obstack_init (&node_obstack); - new_node (&n); - sprintf (name, "%d", s->number); - n.title = name; - print_core (&node_obstack, s); - obstack_1grow (&node_obstack, '\0'); - n.label = obstack_finish (&node_obstack); - - open_node (fgraph); - output_node (&n, fgraph); - close_node (fgraph); - - /* Output the edges. */ - print_actions (s, name); - - obstack_free (&node_obstack, 0); -} - - -void -print_graph (void) -{ - state_number i; - - /* Output file. */ - fgraph = xfopen (spec_graph_file, "w"); - - new_graph (&static_graph); - - static_graph.display_edge_labels = yes; - - static_graph.port_sharing = no; - static_graph.finetuning = yes; - static_graph.priority_phase = yes; - static_graph.splines = yes; - - static_graph.crossing_weight = median; - - /* Output graph options. */ - open_graph (fgraph); - output_graph (&static_graph, fgraph); - - /* Output nodes and edges. */ - new_closure (nritems); - for (i = 0; i < nstates; i++) - print_state (states[i]); - free_closure (); - - /* Close graph. */ - close_graph (&static_graph, fgraph); - xfclose (fgraph); -} diff --git a/src/bin/bison/src/print_graph.h b/src/bin/bison/src/print_graph.h deleted file mode 100644 index befc531362..0000000000 --- a/src/bin/bison/src/print_graph.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Output a VCG description on generated parser, for bison, - Copyright 2000 Free Software Foundation, Inc. - - This file is part of Bison, the GNU Compiler Compiler. - - Bison is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - Bison is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -#ifndef PRINT_GRAPH_H_ -# define PRINT_GRAPH_H_ - -void print_graph (void); - -#endif /* !PRINT_GRAPH_H_ */ diff --git a/src/bin/bison/src/reader.c b/src/bin/bison/src/reader.c deleted file mode 100644 index d07ce5caa9..0000000000 --- a/src/bin/bison/src/reader.c +++ /dev/null @@ -1,576 +0,0 @@ -/* Input parser for Bison - - Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002, 2003, - 2005, 2006 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 "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" - -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 typed = 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; - } -} - - -/*----------------------------------------------------------------. -| There are two prologues: one before %union, one after. Augment | -| the current one. | -`----------------------------------------------------------------*/ - -void -prologue_augment (const char *prologue, location loc) -{ - struct obstack *oout = - !typed ? &pre_prologue_obstack : &post_prologue_obstack; - - obstack_fgrow1 (oout, "]b4_syncline(%d, [[", loc.start.line); - MUSCLE_OBSTACK_SGROW (oout, - quotearg_style (c_quoting_style, loc.start.file)); - obstack_sgrow (oout, "]])[\n"); - obstack_sgrow (oout, prologue); -} - - - -/*-------------------------------------------------------------------. -| Return the merger index for a merging function named NAME, whose | -| arguments have type TYPE. Records the function, if new, in | -| MERGER_LIST. | -`-------------------------------------------------------------------*/ - -static int -get_merge_function (uniqstr name, uniqstr type, location loc) -{ - merger_list *syms; - merger_list head; - int n; - - if (! glr_parser) - return 0; - - if (type == NULL) - type = uniqstr_new (""); - - 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); - syms->next->type = uniqstr_new (type); - syms->next->next = NULL; - merge_functions = head.next; - } - else if (!UNIQSTR_EQ (type, syms->next->type)) - warn_at (loc, _("result type clash on merge function %s: <%s> != <%s>"), - name, type, syms->next->type); - return n; -} - -/*--------------------------------------. -| 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_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). */ -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) -{ - if (!start_flag) - { - startsymbol = lhs; - startsymbol_location = loc; - start_flag = true; - } - - /* 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 it has a destructor, or if it is a | -| mid-rule symbol (i.e., the generated LHS replacing a mid-rule | -| action) that was assigned to, as in "exp: { $$ = 1; } { $$ = $1; }". | -`----------------------------------------------------------------------*/ - -static bool -symbol_should_be_used (symbol_list const *s) -{ - return (s->sym->destructor - || (s->midrule && s->midrule->used)); -} - -/*----------------------------------------------------------------. -| 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 && r->sym->type_name) - { - symbol *first_rhs = r->next->sym; - /* If $$ is being set in default way, report if any type mismatch. */ - if (first_rhs) - { - char const *lhs_type = r->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->sym; l = l->next, ++n) - if (! (l->used - || !symbol_should_be_used (l) - /* The default action, $$ = $1, `uses' both. */ - || (!r->action && (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; - grammar_rule_check (current_rule); -} - - -/*-------------------------------------------------------------------. -| 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_location; - symbol *dummy = dummy_symbol_get (dummy_location); - symbol_list *midrule = symbol_list_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; - midrule->action = current_rule->action; - midrule->action_location = dummy_location; - current_rule->action = NULL; - /* If $$ was used in the action, the LHS of the enclosing rule was - incorrectly flagged as used. */ - midrule->used = current_rule->used; - current_rule->used = false; - - if (previous_rule_end) - previous_rule_end->next = midrule; - else - grammar = midrule; - - /* End the dummy's rule. */ - midrule->next = symbol_list_new (NULL, dummy_location); - grammar_rule_check (midrule); - 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; -} - -/* Set the precedence symbol of the current rule to PRECSYM. */ - -void -grammar_current_rule_prec_set (symbol *precsym, location loc) -{ - 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->sym->type_name, 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) - 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) -{ - /* There's no need to invoke grammar_midrule_action here, since the - scanner already did it if necessary. */ - current_rule->action = action; - current_rule->action_location = loc; -} - - -/*---------------------------------------------------------------. -| 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) - { - symbol *ruleprec = p->ruleprec; - rules[ruleno].user_number = ruleno; - rules[ruleno].number = ruleno; - rules[ruleno].lhs = p->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; - rules[ruleno].action_location = p->action_location; - - p = p->next; - while (p && p->sym) - { - /* item_number = symbol_number. - But the former needs to contain more: negative rule numbers. */ - ritem[itemno++] = symbol_number_as_item_number (p->sym->number); - /* A rule gets by default the precedence and associativity - of the last token in it. */ - if (p->sym->class == token_sym && default_prec) - rules[ruleno].prec = p->sym; - if (p) - p = p->next; - } - - /* If this rule has a %prec, - the specified symbol's precedence replaces the default. */ - if (ruleprec) - { - rules[ruleno].precsym = ruleprec; - rules[ruleno].prec = ruleprec; - } - ritem[itemno++] = rule_number_as_item_number (ruleno); - ++ruleno; - - if (p) - p = p->next; - } - - assert (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++; - - /* Initialize the obstacks. */ - obstack_init (&pre_prologue_obstack); - obstack_init (&post_prologue_obstack); - - gram_in = xfopen (grammar_file, "r"); - - gram__flex_debug = trace_flag & trace_scan; - gram_debug = trace_flag & trace_parse; - 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; - } - - /* 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_new (accept, empty_location); - p->location = grammar->location; - p->next = symbol_list_new (startsymbol, empty_location); - p->next->next = symbol_list_new (endtoken, empty_location); - p->next->next->next = symbol_list_new (NULL, empty_location); - p->next->next->next->next = grammar; - nrules += 1; - nritems += 3; - grammar = p; - } - - assert (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 (); - - /* Convert the grammar into the format described in gram.h. */ - packgram (); - - /* The grammar as a symbol_list is no longer needed. */ - LIST_FREE (symbol_list, grammar); -} diff --git a/src/bin/bison/src/reader.h b/src/bin/bison/src/reader.h deleted file mode 100644 index f110f70e70..0000000000 --- a/src/bin/bison/src/reader.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Input parser for Bison - - Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006 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 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; -} merger_list; - -/* From the scanner. */ -extern FILE *gram_in; -extern int gram__flex_debug; -extern boundary scanner_cursor; -extern char *last_string; -extern location last_braced_code_loc; -extern int max_left_semantic_context; -void scanner_initialize (void); -void scanner_free (void); -void 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 YY_DECL int gram_lex (YYSTYPE *val, location *loc) -YY_DECL; - - -/* 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 prologue_augment (const char *prologue, 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); -extern symbol_list *current_rule; -void reader (void); -void free_merger_functions (void); - -extern merger_list *merge_functions; - -/* Was %union seen? */ -extern bool typed; - -/* Should rules have a default precedence? */ -extern bool default_prec; - -#endif /* !READER_H_ */ diff --git a/src/bin/bison/src/reduce.c b/src/bin/bison/src/reduce.c deleted file mode 100644 index 1bb40f01bf..0000000000 --- a/src/bin/bison/src/reduce.c +++ /dev/null @@ -1,470 +0,0 @@ -/* Grammar reduction for Bison. - - Copyright (C) 1988, 1989, 2000, 2001, 2002, 2003, 2005, 2006 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. */ - - -/* 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 "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_never_reduced_report (_("useless rule")); - } - - /* 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, _("useless nonterminal: %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", _("Useless nonterminals")); - 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 (!bitset_test (V, i) && !bitset_test (V1, i)) - { - if (!b) - fprintf (out, "%s\n\n", _("Terminals which are not used")); - b = true; - fprintf (out, " %s\n", symbols[i]->tag); - } - if (b) - fputs ("\n\n", out); - } - - if (nuseless_productions > 0) - grammar_rules_partial_print (out, _("Useless rules"), - rule_useless_p); -} - - - - - -/*-------------------------------. -| Report the results to STDERR. | -`-------------------------------*/ - -static void -reduce_print (void) -{ - if (yacc_flag && nuseless_productions) - fprintf (stderr, ngettext ("%d rule never reduced\n", - "%d rules never reduced\n", - nuseless_productions), - nuseless_productions); - - fprintf (stderr, "%s: %s: ", grammar_file, _("warning")); - - if (nuseless_nonterminals > 0) - fprintf (stderr, ngettext ("%d useless nonterminal", - "%d useless nonterminals", - nuseless_nonterminals), - nuseless_nonterminals); - - if (nuseless_nonterminals > 0 && nuseless_productions > 0) - fprintf (stderr, _(" and ")); - - if (nuseless_productions > 0) - fprintf (stderr, ngettext ("%d useless rule", - "%d useless rules", - 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); - } -} - - -/*-----------------------------------------------------------. -| 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/bin/bison/src/reduce.h b/src/bin/bison/src/reduce.h deleted file mode 100644 index dfdab657e8..0000000000 --- a/src/bin/bison/src/reduce.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Grammar reduction for Bison. - - Copyright (C) 2000, 2001, 2002 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 REDUCE_H_ -# define REDUCE_H_ - -void reduce_grammar (void); -void reduce_output (FILE *out); -void reduce_free (void); - -extern symbol_number nuseless_nonterminals; -extern rule_number nuseless_productions; -#endif /* !REDUCE_H_ */ diff --git a/src/bin/bison/src/relation.c b/src/bin/bison/src/relation.c deleted file mode 100644 index 1d2b42dd9f..0000000000 --- a/src/bin/bison/src/relation.c +++ /dev/null @@ -1,183 +0,0 @@ -/* Binary relations. - Copyright (C) 2002, 2004, 2005 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 "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/bin/bison/src/relation.h b/src/bin/bison/src/relation.h deleted file mode 100644 index 479e42ecf0..0000000000 --- a/src/bin/bison/src/relation.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Binary relations. - Copyright (C) 2002, 2004 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 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/bin/bison/src/scan-gram.c b/src/bin/bison/src/scan-gram.c deleted file mode 100644 index 04cf539de8..0000000000 --- a/src/bin/bison/src/scan-gram.c +++ /dev/null @@ -1,3822 +0,0 @@ -#line 2 "scan-gram.c" - -#line 4 "scan-gram.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 31 -#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 -#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 */ - -#if __STDC__ - -#define YY_USE_CONST - -#endif /* __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 - -#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) ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int 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 = 1; /* 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 109 -#define YY_END_OF_BUFFER 110 -/* 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[461] = - { 0, - 0, 0, 0, 0, 66, 66, 0, 0, 84, 84, - 84, 84, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 110, 59, 2, 2, - 54, 59, 53, 1, 50, 59, 51, 51, 49, 59, - 47, 56, 48, 59, 107, 108, 103, 107, 104, 105, - 106, 65, 107, 63, 63, 88, 87, 107, 86, 85, - 61, 2, 1, 61, 60, 61, 68, 67, 107, 71, - 70, 69, 93, 2, 1, 93, 93, 90, 100, 107, - 89, 107, 107, 101, 94, 96, 107, 58, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - - 46, 46, 46, 46, 46, 46, 55, 50, 4, 3, - 51, 0, 0, 0, 64, 0, 0, 66, 62, 84, - 84, 84, 84, 83, 81, 72, 83, 74, 75, 76, - 77, 78, 79, 83, 80, 83, 98, 0, 98, 0, - 95, 0, 91, 92, 0, 94, 97, 0, 99, 0, - 99, 102, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 3, 52, 57, 0, 0, 0, 0, 0, 0, - 0, 0, 72, 0, 0, 73, 0, 0, 0, 0, - - 0, 0, 0, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 0, 72, 0, - 0, 0, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 20, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 32, 46, 46, 46, - 46, 46, 46, 39, 46, 42, 46, 46, 45, 0, - 0, 0, 46, 7, 46, 46, 46, 12, 46, 46, - 46, 46, 46, 46, 46, 46, 23, 46, 46, 46, - - 46, 46, 29, 46, 46, 46, 46, 46, 36, 46, - 38, 40, 43, 46, 0, 0, 82, 6, 46, 9, - 46, 46, 14, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 30, 46, 46, 46, 46, 46, - 46, 46, 0, 46, 10, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 33, 46, 35, 46, 46, 44, 0, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 26, - 27, 46, 46, 46, 37, 46, 0, 46, 46, 46, - 15, 46, 46, 46, 46, 21, 22, 46, 46, 46, - - 46, 46, 46, 0, 0, 46, 11, 46, 46, 46, - 19, 46, 46, 46, 46, 46, 46, 46, 5, 46, - 46, 16, 46, 46, 24, 46, 46, 31, 34, 41, - 8, 46, 46, 46, 46, 46, 13, 46, 46, 46, - 46, 46, 18, 46, 46, 46, 25, 46, 46, 46, - 46, 46, 17, 46, 46, 46, 46, 46, 28, 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, 7, 8, 1, 9, 1, - 1, 10, 1, 11, 12, 13, 14, 15, 16, 16, - 16, 16, 16, 16, 16, 17, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 25, 25, 25, 25, 25, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 26, 13, 13, 27, 13, 13, - 28, 29, 30, 1, 31, 1, 32, 33, 34, 35, - - 36, 37, 38, 39, 40, 13, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 13, 53, - 54, 13, 55, 56, 57, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 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[59] = - { 0, - 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, - 1, 4, 5, 1, 6, 6, 6, 1, 1, 1, - 1, 7, 1, 3, 6, 5, 5, 3, 1, 3, - 5, 6, 6, 6, 6, 6, 6, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 1, 1, 1, 7 - } ; - -static yyconst flex_int16_t yy_base[483] = - { 0, - 0, 733, 56, 57, 65, 68, 728, 727, 96, 99, - 106, 109, 138, 144, 85, 102, 142, 150, 161, 174, - 206, 0, 162, 182, 220, 225, 736, 740, 740, 740, - 740, 275, 740, 740, 0, 51, 176, 61, 740, 0, - 740, 740, 740, 693, 740, 740, 740, 103, 740, 740, - 740, 740, 164, 740, 720, 740, 740, 192, 740, 740, - 740, 740, 740, 59, 740, 691, 740, 740, 326, 740, - 740, 740, 740, 740, 740, 60, 690, 740, 231, 132, - 740, 187, 71, 243, 740, 740, 674, 740, 0, 690, - 75, 151, 689, 686, 683, 74, 690, 173, 674, 220, - - 147, 157, 220, 680, 687, 690, 740, 0, 740, 0, - 269, 0, 699, 680, 740, 287, 290, 690, 740, 740, - 293, 689, 301, 740, 740, 67, 0, 740, 740, 740, - 740, 740, 740, 0, 740, 0, 740, 317, 321, 0, - 740, 341, 740, 740, 344, 740, 740, 358, 740, 349, - 352, 740, 0, 673, 220, 668, 667, 668, 131, 665, - 672, 188, 677, 662, 666, 223, 672, 657, 658, 226, - 657, 657, 665, 666, 669, 652, 658, 652, 657, 648, - 661, 0, 0, 740, 650, 369, 250, 378, 381, 384, - 387, 269, 324, 0, 0, 0, 671, 390, 152, 393, - - 388, 397, 202, 660, 640, 238, 640, 653, 643, 651, - 650, 649, 672, 633, 632, 669, 648, 641, 642, 315, - 241, 629, 630, 626, 640, 629, 636, 620, 631, 627, - 620, 624, 630, 629, 619, 630, 628, 625, 740, 0, - 0, 396, 612, 621, 607, 613, 608, 621, 606, 619, - 640, 616, 604, 609, 0, 602, 597, 610, 344, 609, - 604, 594, 606, 598, 589, 603, 0, 588, 392, 597, - 586, 599, 584, 0, 589, 0, 588, 586, 0, 626, - 0, 0, 575, 0, 586, 591, 575, 0, 393, 575, - 578, 394, 591, 590, 589, 580, 0, 573, 581, 573, - - 567, 565, 0, 564, 601, 576, 565, 562, 0, 559, - 0, 395, 0, 559, 399, 0, 740, 0, 557, 557, - 571, 552, 397, 555, 557, 553, 558, 551, 553, 549, - 564, 559, 549, 557, 0, 546, 543, 558, 553, 543, - 537, 550, 414, 407, 0, 535, 548, 535, 546, 530, - 531, 567, 546, 533, 540, 524, 525, 539, 524, 539, - 0, 522, 0, 525, 536, 0, 562, 520, 520, 516, - 515, 525, 511, 524, 527, 515, 508, 519, 513, 0, - 0, 511, 505, 503, 0, 518, 545, 501, 500, 514, - 0, 506, 499, 496, 509, 0, 0, 502, 491, 500, - - 507, 502, 495, 531, 348, 499, 0, 489, 480, 481, - 0, 481, 477, 408, 485, 485, 479, 490, 740, 491, - 475, 0, 473, 482, 0, 475, 480, 0, 0, 0, - 0, 483, 409, 473, 469, 467, 0, 478, 470, 472, - 452, 455, 0, 445, 432, 395, 0, 402, 399, 422, - 384, 386, 0, 395, 374, 361, 318, 251, 0, 740, - 440, 447, 454, 461, 464, 470, 476, 483, 487, 493, - 281, 275, 236, 218, 500, 206, 151, 138, 116, 102, - 56, 506 - } ; - -static yyconst flex_int16_t yy_def[483] = - { 0, - 460, 1, 461, 461, 461, 461, 462, 462, 461, 461, - 461, 461, 463, 463, 461, 461, 461, 461, 464, 464, - 461, 21, 21, 21, 21, 21, 460, 460, 460, 460, - 460, 460, 460, 460, 465, 460, 460, 460, 460, 466, - 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, - 460, 460, 460, 460, 460, 460, 460, 467, 460, 460, - 460, 460, 460, 460, 460, 460, 460, 460, 468, 460, - 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, - 460, 460, 460, 460, 460, 460, 460, 460, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - - 469, 469, 469, 469, 469, 469, 460, 465, 460, 470, - 460, 471, 466, 460, 460, 460, 460, 460, 460, 460, - 460, 460, 460, 460, 460, 460, 472, 460, 460, 460, - 460, 460, 460, 473, 460, 474, 460, 460, 460, 475, - 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, - 460, 460, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 470, 471, 460, 460, 460, 460, 460, 460, 460, - 460, 467, 460, 476, 477, 474, 475, 460, 460, 460, - - 460, 460, 460, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 460, 460, 478, - 479, 460, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 460, - 480, 481, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 460, 473, 460, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 460, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 460, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 482, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - - 469, 469, 469, 482, 482, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 460, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 0, - 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, - 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, - 460, 460 - } ; - -static yyconst flex_int16_t yy_nxt[799] = - { 0, - 28, 29, 30, 29, 31, 28, 28, 32, 33, 28, - 34, 28, 35, 36, 37, 38, 38, 28, 39, 40, - 41, 28, 28, 28, 35, 35, 35, 28, 28, 28, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 42, 43, 28, 28, 46, 46, - 109, 317, 47, 47, 110, 48, 48, 52, 109, 109, - 52, 47, 110, 110, 47, 111, 111, 111, 146, 49, - 49, 193, 193, 50, 50, 51, 51, 67, 49, 68, - 147, 49, 50, 53, 51, 50, 53, 51, 56, 148, - - 57, 56, 47, 57, 67, 47, 68, 316, 59, 162, - 155, 59, 47, 69, 60, 47, 115, 60, 163, 49, - 156, 282, 49, 50, 58, 51, 50, 58, 51, 49, - 69, 116, 49, 50, 58, 51, 50, 58, 51, 62, - 30, 62, 70, 281, 71, 62, 30, 62, 63, 66, - 72, 64, 71, 141, 63, 65, 241, 64, 72, 70, - 142, 65, 74, 30, 74, 117, 118, 117, 47, 87, - 69, 75, 211, 141, 76, 74, 30, 74, 69, 77, - 142, 45, 172, 212, 75, 49, 173, 76, 47, 87, - 111, 111, 111, 121, 122, 121, 143, 174, 157, 70, - - 144, 45, 112, 158, 165, 49, 175, 70, 46, 146, - 78, 240, 79, 80, 81, 145, 45, 166, 45, 82, - 123, 147, 167, 196, 215, 83, 47, 45, 112, 84, - 148, 47, 45, 50, 220, 51, 45, 137, 45, 45, - 216, 195, 138, 49, 45, 139, 139, 139, 49, 149, - 140, 169, 205, 220, 150, 176, 206, 151, 151, 151, - 85, 225, 86, 115, 177, 226, 221, 170, 207, 245, - 171, 460, 262, 178, 45, 263, 45, 246, 116, 45, - 194, 45, 88, 111, 111, 111, 183, 89, 186, 187, - 186, 117, 118, 117, 189, 122, 189, 123, 459, 89, - - 89, 89, 191, 192, 191, 89, 89, 90, 89, 91, - 92, 93, 94, 89, 95, 89, 96, 97, 98, 99, - 100, 89, 101, 102, 103, 104, 105, 89, 106, 107, - 125, 139, 139, 139, 125, 139, 139, 139, 239, 239, - 126, 126, 198, 199, 198, 200, 201, 200, 125, 260, - 419, 127, 405, 458, 125, 298, 261, 128, 129, 202, - 203, 202, 130, 151, 151, 151, 151, 151, 151, 131, - 186, 187, 186, 132, 298, 133, 134, 135, 136, 117, - 118, 117, 189, 122, 189, 189, 122, 189, 191, 192, - 191, 198, 199, 198, 200, 201, 200, 143, 202, 203, - - 202, 144, 137, 307, 322, 325, 341, 138, 348, 457, - 139, 139, 139, 343, 343, 343, 145, 367, 368, 426, - 438, 456, 307, 322, 325, 341, 455, 348, 343, 343, - 343, 454, 453, 452, 451, 450, 449, 368, 426, 438, - 45, 45, 45, 45, 45, 45, 45, 54, 54, 54, - 54, 54, 54, 54, 61, 61, 61, 61, 61, 61, - 61, 73, 73, 73, 73, 73, 73, 73, 108, 108, - 113, 448, 113, 113, 113, 113, 120, 120, 447, 120, - 120, 120, 120, 124, 124, 124, 124, 124, 124, 124, - 153, 153, 153, 182, 446, 182, 182, 182, 182, 182, - - 197, 445, 197, 197, 197, 197, 404, 444, 404, 404, - 404, 404, 404, 443, 442, 441, 440, 439, 437, 436, - 435, 434, 433, 432, 431, 430, 429, 428, 427, 425, - 424, 423, 422, 421, 420, 405, 418, 417, 416, 415, - 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, - 403, 402, 401, 400, 399, 398, 397, 396, 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, 366, 365, 364, 363, 362, - 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, - - 351, 350, 349, 347, 346, 345, 344, 342, 340, 339, - 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, - 328, 327, 326, 324, 323, 321, 320, 319, 318, 315, - 314, 313, 312, 311, 310, 309, 308, 306, 305, 304, - 303, 302, 301, 300, 299, 297, 296, 295, 294, 293, - 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, - 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, - 270, 269, 268, 267, 266, 265, 264, 259, 258, 257, - 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, - 244, 243, 242, 238, 237, 236, 235, 234, 233, 232, - - 231, 230, 229, 228, 227, 224, 223, 222, 219, 218, - 217, 214, 213, 210, 209, 208, 204, 190, 188, 185, - 184, 181, 180, 179, 168, 164, 161, 160, 159, 154, - 152, 114, 114, 119, 114, 460, 55, 55, 44, 27, - 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, - 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, - 460, 460, 460, 460, 460, 460, 460, 460 - - } ; - -static yyconst flex_int16_t yy_chk[799] = - { 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, 1, 1, 1, 3, 4, - 36, 481, 3, 4, 36, 3, 4, 5, 64, 76, - 6, 5, 64, 76, 6, 38, 38, 38, 83, 3, - 4, 126, 126, 3, 4, 3, 4, 15, 5, 15, - 83, 6, 5, 5, 5, 6, 6, 6, 9, 83, - - 9, 10, 9, 10, 16, 10, 16, 480, 11, 96, - 91, 12, 11, 15, 11, 12, 48, 12, 96, 9, - 91, 479, 10, 9, 9, 9, 10, 10, 10, 11, - 16, 48, 12, 11, 11, 11, 12, 12, 12, 13, - 13, 13, 15, 478, 17, 14, 14, 14, 13, 14, - 17, 13, 18, 80, 14, 13, 477, 14, 18, 16, - 80, 14, 19, 19, 19, 53, 53, 53, 23, 23, - 17, 19, 159, 199, 19, 20, 20, 20, 18, 20, - 199, 23, 101, 159, 20, 23, 101, 20, 24, 24, - 37, 37, 37, 58, 58, 58, 82, 102, 92, 17, - - 82, 24, 37, 92, 98, 24, 102, 18, 21, 203, - 21, 476, 21, 21, 21, 82, 23, 98, 23, 21, - 58, 203, 98, 474, 162, 21, 25, 25, 37, 21, - 203, 26, 26, 21, 166, 21, 24, 79, 24, 25, - 162, 473, 79, 25, 26, 79, 79, 79, 26, 84, - 79, 100, 155, 166, 84, 103, 155, 84, 84, 84, - 21, 170, 21, 187, 103, 170, 166, 100, 155, 206, - 100, 192, 221, 103, 25, 221, 25, 206, 187, 26, - 472, 26, 32, 111, 111, 111, 471, 32, 116, 116, - 116, 117, 117, 117, 121, 121, 121, 192, 458, 32, - - 32, 32, 123, 123, 123, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 69, 138, 138, 138, 69, 139, 139, 139, 193, 193, - 69, 69, 142, 142, 142, 145, 145, 145, 69, 220, - 405, 69, 405, 457, 69, 259, 220, 69, 69, 148, - 148, 148, 69, 150, 150, 150, 151, 151, 151, 69, - 186, 186, 186, 69, 259, 69, 69, 69, 69, 188, - 188, 188, 189, 189, 189, 190, 190, 190, 191, 191, - 191, 198, 198, 198, 200, 200, 200, 201, 202, 202, - - 202, 201, 242, 269, 289, 292, 312, 242, 323, 456, - 242, 242, 242, 315, 315, 315, 201, 343, 344, 414, - 433, 455, 269, 289, 292, 312, 454, 323, 343, 343, - 343, 452, 451, 450, 449, 448, 446, 344, 414, 433, - 461, 461, 461, 461, 461, 461, 461, 462, 462, 462, - 462, 462, 462, 462, 463, 463, 463, 463, 463, 463, - 463, 464, 464, 464, 464, 464, 464, 464, 465, 465, - 466, 445, 466, 466, 466, 466, 467, 467, 444, 467, - 467, 467, 467, 468, 468, 468, 468, 468, 468, 468, - 469, 469, 469, 470, 442, 470, 470, 470, 470, 470, - - 475, 441, 475, 475, 475, 475, 482, 440, 482, 482, - 482, 482, 482, 439, 438, 436, 435, 434, 432, 427, - 426, 424, 423, 421, 420, 418, 417, 416, 415, 413, - 412, 410, 409, 408, 406, 404, 403, 402, 401, 400, - 399, 398, 395, 394, 393, 392, 390, 389, 388, 387, - 386, 384, 383, 382, 379, 378, 377, 376, 375, 374, - 373, 372, 371, 370, 369, 368, 367, 365, 364, 362, - 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, - 350, 349, 348, 347, 346, 342, 341, 340, 339, 338, - 337, 336, 334, 333, 332, 331, 330, 329, 328, 327, - - 326, 325, 324, 322, 321, 320, 319, 314, 310, 308, - 307, 306, 305, 304, 302, 301, 300, 299, 298, 296, - 295, 294, 293, 291, 290, 287, 286, 285, 283, 280, - 278, 277, 275, 273, 272, 271, 270, 268, 266, 265, - 264, 263, 262, 261, 260, 258, 257, 256, 254, 253, - 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, - 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, - 228, 227, 226, 225, 224, 223, 222, 219, 218, 217, - 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, - 205, 204, 197, 185, 181, 180, 179, 178, 177, 176, - - 175, 174, 173, 172, 171, 169, 168, 167, 165, 164, - 163, 161, 160, 158, 157, 156, 154, 122, 118, 114, - 113, 106, 105, 104, 99, 97, 95, 94, 93, 90, - 87, 77, 66, 55, 44, 27, 8, 7, 2, 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, 460, - 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, - 460, 460, 460, 460, 460, 460, 460, 460 - - } ; - -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[109] = - { 0, - 197, 198, 199, 200, 208, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, - 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 260, 264, 265, 266, 268, - 275, 279, 285, 288, 291, 294, 305, 313, 320, 337, - 343, 364, 365, 376, 387, 388, 400, 408, 419, 435, - 441, 451, 461, 472, 473, 474, 475, 476, 477, 478, - 481, 483, 492, 504, 509, 510, 516, 517, 528, 534, - 540, 546, 562, 596, 597, 598, 634, 636, 637, 639, - - 643, 658, 693, 694, 695, 696, 704, 705 - } ; - -/* 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 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 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 -*/ -#line 27 "scan-gram.l" -/* Work around a bug in flex 2.5.31. See Debian bug 333231 - . */ -#undef gram_wrap -#define gram_wrap() 1 - -#include "system.h" - -#include -#include - -#include "complain.h" -#include "files.h" -#include "getargs.h" -#include "gram.h" -#include "quotearg.h" -#include "reader.h" -#include "uniqstr.h" - -#define YY_USER_INIT \ - do \ - { \ - scanner_cursor.file = current_file; \ - scanner_cursor.line = 1; \ - scanner_cursor.column = 1; \ - code_start = scanner_cursor; \ - } \ - while (0) - -/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */ -int gram_get_lineno (void); -FILE *gram_get_in (void); -FILE *gram_get_out (void); -int gram_get_leng (void); -char *gram_get_text (void); -void gram_set_lineno (int); -void gram_set_in (FILE *); -void gram_set_out (FILE *); -int gram_get_debug (void); -void gram_set_debug (int); -int gram_lex_destroy (void); - -/* Location of scanner cursor. */ -boundary scanner_cursor; - -static void adjust_location (location *, char const *, size_t); -#define YY_USER_ACTION adjust_location (loc, 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)) - - -/* 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. */ - -static struct obstack obstack_for_string; - -/* A string representing the most recently saved token. */ -char *last_string; - -/* The location of the most recently saved token, if it was a - BRACED_CODE token; otherwise, this has an unspecified value. */ -location last_braced_code_loc; - -#define STRING_GROW \ - obstack_grow (&obstack_for_string, gram_text, gram_leng) - -#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) - -void -scanner_last_string_free (void) -{ - STRING_FREE; -} - -/* Within well-formed rules, RULE_LENGTH is the number of values in - the current rule so far, which says where to find `$0' with respect - to the top of the stack. It is not the same as the rule->length in - the case of mid rule actions. - - Outside of well-formed rules, RULE_LENGTH has an undefined value. */ -static int rule_length; - -static void rule_length_overflow (location) __attribute__ ((__noreturn__)); - -/* Increment the rule length by one, checking for overflow. */ -static inline void -increment_rule_length (location loc) -{ - 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) - rule_length_overflow (loc); -} - -static void handle_dollar (int token_type, char *cp, location loc); -static void handle_at (int token_type, char *cp, location loc); -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 *); - - - - - - -/* 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 1016 "scan-gram.c" - -#define INITIAL 0 -#define SC_COMMENT 1 -#define SC_LINE_COMMENT 2 -#define SC_YACC_COMMENT 3 -#define SC_STRING 4 -#define SC_CHARACTER 5 -#define SC_AFTER_IDENTIFIER 6 -#define SC_ESCAPED_STRING 7 -#define SC_ESCAPED_CHARACTER 8 -#define SC_PRE_CODE 9 -#define SC_BRACED_CODE 10 -#define SC_PROLOGUE 11 -#define SC_EPILOGUE 12 - -#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-reentrant */ -/* %endif */ -/* %if-bison-bridge */ -/* %endif */ -/* %endif End reentrant structures and macros. */ - -/* 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 (void) 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 = '*'; \ - size_t 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 165 "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); - - /* Token type to return, when applicable. */ - int token_type 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 1266 "scan-gram.c" - - if ( (yy_init) ) - { - (yy_init) = 0; - -#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 >= 461 ) - 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 != 460 ); - 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 < 109 ) - fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", - (long)yy_rule_linenum[yy_act], gram_text ); - else if ( yy_act == 109 ) - fprintf( stderr, "--accepting default rule (\"%s\")\n", - gram_text ); - else if ( yy_act == 110 ) - 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 197 "scan-gram.l" -warn_at (*loc, _("stray `,' treated as white space")); - YY_BREAK -case 2: -/* rule 2 can match eol */ -#line 199 "scan-gram.l" -case 3: -/* rule 3 can match eol */ -YY_RULE_SETUP -#line 199 "scan-gram.l" -; - YY_BREAK -case 4: -YY_RULE_SETUP -#line 200 "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 208 "scan-gram.l" -{ - handle_syncline (gram_text + sizeof "#line " - 1, *loc); - } - YY_BREAK - -/*----------------------------. - | Scanning Bison directives. | - `----------------------------*/ - - -case 6: -YY_RULE_SETUP -#line 219 "scan-gram.l" -return PERCENT_NONASSOC; - YY_BREAK -case 7: -YY_RULE_SETUP -#line 220 "scan-gram.l" -return PERCENT_DEBUG; - YY_BREAK -case 8: -YY_RULE_SETUP -#line 221 "scan-gram.l" -return PERCENT_DEFAULT_PREC; - YY_BREAK -case 9: -YY_RULE_SETUP -#line 222 "scan-gram.l" -return PERCENT_DEFINE; - YY_BREAK -case 10: -YY_RULE_SETUP -#line 223 "scan-gram.l" -return PERCENT_DEFINES; - YY_BREAK -case 11: -YY_RULE_SETUP -#line 224 "scan-gram.l" -token_type = PERCENT_DESTRUCTOR; BEGIN SC_PRE_CODE; - YY_BREAK -case 12: -YY_RULE_SETUP -#line 225 "scan-gram.l" -return PERCENT_DPREC; - YY_BREAK -case 13: -YY_RULE_SETUP -#line 226 "scan-gram.l" -return PERCENT_ERROR_VERBOSE; - YY_BREAK -case 14: -YY_RULE_SETUP -#line 227 "scan-gram.l" -return PERCENT_EXPECT; - YY_BREAK -case 15: -YY_RULE_SETUP -#line 228 "scan-gram.l" -return PERCENT_EXPECT_RR; - YY_BREAK -case 16: -YY_RULE_SETUP -#line 229 "scan-gram.l" -return PERCENT_FILE_PREFIX; - YY_BREAK -case 17: -YY_RULE_SETUP -#line 230 "scan-gram.l" -return PERCENT_YACC; - YY_BREAK -case 18: -YY_RULE_SETUP -#line 231 "scan-gram.l" -token_type = PERCENT_INITIAL_ACTION; BEGIN SC_PRE_CODE; - YY_BREAK -case 19: -YY_RULE_SETUP -#line 232 "scan-gram.l" -return PERCENT_GLR_PARSER; - YY_BREAK -case 20: -YY_RULE_SETUP -#line 233 "scan-gram.l" -return PERCENT_LEFT; - YY_BREAK -case 21: -YY_RULE_SETUP -#line 234 "scan-gram.l" -token_type = PERCENT_LEX_PARAM; BEGIN SC_PRE_CODE; - YY_BREAK -case 22: -YY_RULE_SETUP -#line 235 "scan-gram.l" -return PERCENT_LOCATIONS; - YY_BREAK -case 23: -YY_RULE_SETUP -#line 236 "scan-gram.l" -return PERCENT_MERGE; - YY_BREAK -case 24: -YY_RULE_SETUP -#line 237 "scan-gram.l" -return PERCENT_NAME_PREFIX; - YY_BREAK -case 25: -YY_RULE_SETUP -#line 238 "scan-gram.l" -return PERCENT_NO_DEFAULT_PREC; - YY_BREAK -case 26: -YY_RULE_SETUP -#line 239 "scan-gram.l" -return PERCENT_NO_LINES; - YY_BREAK -case 27: -YY_RULE_SETUP -#line 240 "scan-gram.l" -return PERCENT_NONASSOC; - YY_BREAK -case 28: -YY_RULE_SETUP -#line 241 "scan-gram.l" -return PERCENT_NONDETERMINISTIC_PARSER; - YY_BREAK -case 29: -YY_RULE_SETUP -#line 242 "scan-gram.l" -return PERCENT_NTERM; - YY_BREAK -case 30: -YY_RULE_SETUP -#line 243 "scan-gram.l" -return PERCENT_OUTPUT; - YY_BREAK -case 31: -YY_RULE_SETUP -#line 244 "scan-gram.l" -token_type = PERCENT_PARSE_PARAM; BEGIN SC_PRE_CODE; - YY_BREAK -case 32: -YY_RULE_SETUP -#line 245 "scan-gram.l" -rule_length--; return PERCENT_PREC; - YY_BREAK -case 33: -YY_RULE_SETUP -#line 246 "scan-gram.l" -token_type = PERCENT_PRINTER; BEGIN SC_PRE_CODE; - YY_BREAK -case 34: -YY_RULE_SETUP -#line 247 "scan-gram.l" -return PERCENT_PURE_PARSER; - YY_BREAK -case 35: -YY_RULE_SETUP -#line 248 "scan-gram.l" -return PERCENT_REQUIRE; - YY_BREAK -case 36: -YY_RULE_SETUP -#line 249 "scan-gram.l" -return PERCENT_RIGHT; - YY_BREAK -case 37: -YY_RULE_SETUP -#line 250 "scan-gram.l" -return PERCENT_SKELETON; - YY_BREAK -case 38: -YY_RULE_SETUP -#line 251 "scan-gram.l" -return PERCENT_START; - YY_BREAK -case 39: -YY_RULE_SETUP -#line 252 "scan-gram.l" -return PERCENT_TOKEN; - YY_BREAK -case 40: -YY_RULE_SETUP -#line 253 "scan-gram.l" -return PERCENT_TOKEN; - YY_BREAK -case 41: -YY_RULE_SETUP -#line 254 "scan-gram.l" -return PERCENT_TOKEN_TABLE; - YY_BREAK -case 42: -YY_RULE_SETUP -#line 255 "scan-gram.l" -return PERCENT_TYPE; - YY_BREAK -case 43: -YY_RULE_SETUP -#line 256 "scan-gram.l" -token_type = PERCENT_UNION; BEGIN SC_PRE_CODE; - YY_BREAK -case 44: -YY_RULE_SETUP -#line 257 "scan-gram.l" -return PERCENT_VERBOSE; - YY_BREAK -case 45: -YY_RULE_SETUP -#line 258 "scan-gram.l" -return PERCENT_YACC; - YY_BREAK -case 46: -YY_RULE_SETUP -#line 260 "scan-gram.l" -{ - complain_at (*loc, _("invalid directive: %s"), quote (gram_text)); - } - YY_BREAK -case 47: -YY_RULE_SETUP -#line 264 "scan-gram.l" -return EQUAL; - YY_BREAK -case 48: -YY_RULE_SETUP -#line 265 "scan-gram.l" -rule_length = 0; return PIPE; - YY_BREAK -case 49: -YY_RULE_SETUP -#line 266 "scan-gram.l" -return SEMICOLON; - YY_BREAK -case 50: -YY_RULE_SETUP -#line 268 "scan-gram.l" -{ - val->symbol = symbol_get (gram_text, *loc); - id_loc = *loc; - increment_rule_length (*loc); - BEGIN SC_AFTER_IDENTIFIER; - } - YY_BREAK -case 51: -YY_RULE_SETUP -#line 275 "scan-gram.l" -{ - val->integer = scan_integer (gram_text, 10, *loc); - return INT; - } - YY_BREAK -case 52: -YY_RULE_SETUP -#line 279 "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 53: -YY_RULE_SETUP -#line 285 "scan-gram.l" -STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER; - YY_BREAK -/* Strings. */ -case 54: -YY_RULE_SETUP -#line 288 "scan-gram.l" -token_start = loc->start; BEGIN SC_ESCAPED_STRING; - YY_BREAK -/* Prologue. */ -case 55: -YY_RULE_SETUP -#line 291 "scan-gram.l" -code_start = loc->start; BEGIN SC_PROLOGUE; - YY_BREAK -/* Code in between braces. */ -case 56: -YY_RULE_SETUP -#line 294 "scan-gram.l" -{ - if (current_rule && current_rule->action) - grammar_midrule_action (); - STRING_GROW; - token_type = BRACED_CODE; - braces_level = 0; - code_start = loc->start; - BEGIN SC_BRACED_CODE; - } - YY_BREAK -/* A type. */ -case 57: -YY_RULE_SETUP -#line 305 "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 58: -YY_RULE_SETUP -#line 313 "scan-gram.l" -{ - static int percent_percent_count; - if (++percent_percent_count == 2) - BEGIN SC_EPILOGUE; - return PERCENT_PERCENT; - } - YY_BREAK -case 59: -YY_RULE_SETUP -#line 320 "scan-gram.l" -{ - complain_at (*loc, _("invalid character: %s"), quote (gram_text)); - } - YY_BREAK -case YY_STATE_EOF(INITIAL): -#line 324 "scan-gram.l" -{ - loc->start = loc->end = scanner_cursor; - yyterminate (); - } - YY_BREAK - -/*-----------------------------------------------------------------. - | Scanning after an identifier, checking whether a colon is next. | - `-----------------------------------------------------------------*/ - - -case 60: -YY_RULE_SETUP -#line 337 "scan-gram.l" -{ - rule_length = 0; - *loc = id_loc; - BEGIN INITIAL; - return ID_COLON; - } - YY_BREAK -case 61: -YY_RULE_SETUP -#line 343 "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 350 "scan-gram.l" -{ - *loc = id_loc; - BEGIN INITIAL; - return ID; - } - YY_BREAK - -/*---------------------------------------------------------------. - | Scanning a Yacc comment. The initial `/ *' is already eaten. | - `---------------------------------------------------------------*/ - - -case 62: -YY_RULE_SETUP -#line 364 "scan-gram.l" -BEGIN context_state; - YY_BREAK -case 63: -/* rule 63 can match eol */ -YY_RULE_SETUP -#line 365 "scan-gram.l" -; - YY_BREAK -case YY_STATE_EOF(SC_YACC_COMMENT): -#line 366 "scan-gram.l" -unexpected_eof (token_start, "*/"); BEGIN context_state; - YY_BREAK - -/*------------------------------------------------------------. - | Scanning a C comment. The initial `/ *' is already eaten. | - `------------------------------------------------------------*/ - - -case 64: -/* rule 64 can match eol */ -YY_RULE_SETUP -#line 376 "scan-gram.l" -STRING_GROW; BEGIN context_state; - YY_BREAK -case YY_STATE_EOF(SC_COMMENT): -#line 377 "scan-gram.l" -unexpected_eof (token_start, "*/"); BEGIN context_state; - YY_BREAK - -/*--------------------------------------------------------------. - | Scanning a line comment. The initial `//' is already eaten. | - `--------------------------------------------------------------*/ - - -case 65: -/* rule 65 can match eol */ -YY_RULE_SETUP -#line 387 "scan-gram.l" -STRING_GROW; BEGIN context_state; - YY_BREAK -case 66: -/* rule 66 can match eol */ -YY_RULE_SETUP -#line 388 "scan-gram.l" -STRING_GROW; - YY_BREAK -case YY_STATE_EOF(SC_LINE_COMMENT): -#line 389 "scan-gram.l" -BEGIN context_state; - YY_BREAK - -/*------------------------------------------------. - | Scanning a Bison string, including its escapes. | - | The initial quote is already eaten. | - `------------------------------------------------*/ - - -case 67: -YY_RULE_SETUP -#line 400 "scan-gram.l" -{ - STRING_FINISH; - loc->start = token_start; - val->chars = last_string; - increment_rule_length (*loc); - BEGIN INITIAL; - return STRING; - } - YY_BREAK -case 68: -/* rule 68 can match eol */ -YY_RULE_SETUP -#line 408 "scan-gram.l" -unexpected_newline (token_start, "\""); BEGIN INITIAL; - YY_BREAK -case YY_STATE_EOF(SC_ESCAPED_STRING): -#line 409 "scan-gram.l" -unexpected_eof (token_start, "\""); BEGIN INITIAL; - YY_BREAK - -/*----------------------------------------------------------. - | Scanning a Bison character literal, decoding its escapes. | - | The initial quote is already eaten. | - `----------------------------------------------------------*/ - - -case 69: -YY_RULE_SETUP -#line 419 "scan-gram.l" -{ - unsigned char last_string_1; - STRING_GROW; - STRING_FINISH; - loc->start = token_start; - val->symbol = symbol_get (quotearg_style (escape_quoting_style, - last_string), - *loc); - symbol_class_set (val->symbol, token_sym, *loc, false); - last_string_1 = last_string[1]; - symbol_user_token_number_set (val->symbol, last_string_1, *loc); - STRING_FREE; - increment_rule_length (*loc); - BEGIN INITIAL; - return ID; - } - YY_BREAK -case 70: -/* rule 70 can match eol */ -YY_RULE_SETUP -#line 435 "scan-gram.l" -unexpected_newline (token_start, "'"); BEGIN INITIAL; - YY_BREAK -case YY_STATE_EOF(SC_ESCAPED_CHARACTER): -#line 436 "scan-gram.l" -unexpected_eof (token_start, "'"); BEGIN INITIAL; - YY_BREAK - - - -case 71: -YY_RULE_SETUP -#line 441 "scan-gram.l" -complain_at (*loc, _("invalid null character")); - YY_BREAK - -/*----------------------------. - | Decode escaped characters. | - `----------------------------*/ - - -case 72: -YY_RULE_SETUP -#line 451 "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 73: -YY_RULE_SETUP -#line 461 "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 74: -YY_RULE_SETUP -#line 472 "scan-gram.l" -obstack_1grow (&obstack_for_string, '\a'); - YY_BREAK -case 75: -YY_RULE_SETUP -#line 473 "scan-gram.l" -obstack_1grow (&obstack_for_string, '\b'); - YY_BREAK -case 76: -YY_RULE_SETUP -#line 474 "scan-gram.l" -obstack_1grow (&obstack_for_string, '\f'); - YY_BREAK -case 77: -YY_RULE_SETUP -#line 475 "scan-gram.l" -obstack_1grow (&obstack_for_string, '\n'); - YY_BREAK -case 78: -YY_RULE_SETUP -#line 476 "scan-gram.l" -obstack_1grow (&obstack_for_string, '\r'); - YY_BREAK -case 79: -YY_RULE_SETUP -#line 477 "scan-gram.l" -obstack_1grow (&obstack_for_string, '\t'); - YY_BREAK -case 80: -YY_RULE_SETUP -#line 478 "scan-gram.l" -obstack_1grow (&obstack_for_string, '\v'); - YY_BREAK -/* \\[\"\'?\\] would be shorter, but it confuses xgettext. */ -case 81: -YY_RULE_SETUP -#line 481 "scan-gram.l" -obstack_1grow (&obstack_for_string, gram_text[1]); - YY_BREAK -case 82: -YY_RULE_SETUP -#line 483 "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 83: -/* rule 83 can match eol */ -YY_RULE_SETUP -#line 492 "scan-gram.l" -{ - complain_at (*loc, _("unrecognized escape sequence: %s"), quote (gram_text)); - STRING_GROW; - } - YY_BREAK - -/*--------------------------------------------. - | Scanning user-code characters and strings. | - `--------------------------------------------*/ - - -case 84: -/* rule 84 can match eol */ -YY_RULE_SETUP -#line 504 "scan-gram.l" -STRING_GROW; - YY_BREAK - - - -case 85: -YY_RULE_SETUP -#line 509 "scan-gram.l" -STRING_GROW; BEGIN context_state; - YY_BREAK -case 86: -/* rule 86 can match eol */ -YY_RULE_SETUP -#line 510 "scan-gram.l" -unexpected_newline (token_start, "'"); BEGIN context_state; - YY_BREAK -case YY_STATE_EOF(SC_CHARACTER): -#line 511 "scan-gram.l" -unexpected_eof (token_start, "'"); BEGIN context_state; - YY_BREAK - - - -case 87: -YY_RULE_SETUP -#line 516 "scan-gram.l" -STRING_GROW; BEGIN context_state; - YY_BREAK -case 88: -/* rule 88 can match eol */ -YY_RULE_SETUP -#line 517 "scan-gram.l" -unexpected_newline (token_start, "\""); BEGIN context_state; - YY_BREAK -case YY_STATE_EOF(SC_STRING): -#line 518 "scan-gram.l" -unexpected_eof (token_start, "\""); BEGIN context_state; - YY_BREAK - -/*---------------------------------------------------. - | Strings, comments etc. can be found in user code. | - `---------------------------------------------------*/ - - -case 89: -YY_RULE_SETUP -#line 528 "scan-gram.l" -{ - STRING_GROW; - context_state = YY_START; - token_start = loc->start; - BEGIN SC_CHARACTER; - } - YY_BREAK -case 90: -YY_RULE_SETUP -#line 534 "scan-gram.l" -{ - STRING_GROW; - context_state = YY_START; - token_start = loc->start; - BEGIN SC_STRING; - } - YY_BREAK -case 91: -/* rule 91 can match eol */ -YY_RULE_SETUP -#line 540 "scan-gram.l" -{ - STRING_GROW; - context_state = YY_START; - token_start = loc->start; - BEGIN SC_COMMENT; - } - YY_BREAK -case 92: -/* rule 92 can match eol */ -YY_RULE_SETUP -#line 546 "scan-gram.l" -{ - STRING_GROW; - context_state = YY_START; - BEGIN SC_LINE_COMMENT; - } - YY_BREAK - -/*---------------------------------------------------------------. - | Scanning after %union etc., possibly followed by white space. | - | For %union only, allow arbitrary C code to appear before the | - | following brace, as an extension to POSIX. | - `---------------------------------------------------------------*/ - - -case 93: -YY_RULE_SETUP -#line 562 "scan-gram.l" -{ - bool valid = gram_text[0] == '{' || token_type == PERCENT_UNION; - scanner_cursor.column -= mbsnwidth (gram_text, gram_leng, 0); - yyless (0); - - if (valid) - { - braces_level = -1; - code_start = loc->start; - BEGIN SC_BRACED_CODE; - } - else - { - complain_at (*loc, _("missing `{' in %s"), - token_name (token_type)); - obstack_sgrow (&obstack_for_string, "{}"); - STRING_FINISH; - val->chars = last_string; - BEGIN INITIAL; - return token_type; - } - } - YY_BREAK -case YY_STATE_EOF(SC_PRE_CODE): -#line 585 "scan-gram.l" -unexpected_eof (scanner_cursor, "{}"); BEGIN INITIAL; - YY_BREAK - -/*---------------------------------------------------------------. - | Scanning some code in braces (%union and actions). The initial | - | "{" is already eaten. | - `---------------------------------------------------------------*/ - - -case 94: -/* rule 94 can match eol */ -YY_RULE_SETUP -#line 596 "scan-gram.l" -STRING_GROW; braces_level++; - YY_BREAK -case 95: -/* rule 95 can match eol */ -YY_RULE_SETUP -#line 597 "scan-gram.l" -STRING_GROW; braces_level--; - YY_BREAK -case 96: -YY_RULE_SETUP -#line 598 "scan-gram.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. - - 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 && token_type == BRACED_CODE && ! yacc_flag) - obstack_1grow (&obstack_for_string, ';'); - - obstack_1grow (&obstack_for_string, '}'); - - if (outer_brace) - { - STRING_FINISH; - loc->start = code_start; - val->chars = last_string; - increment_rule_length (*loc); - last_braced_code_loc = *loc; - BEGIN INITIAL; - return token_type; - } - } - YY_BREAK -/* Tokenize `<<%' correctly (as `<<' `%') rather than incorrrectly - (as `<' `<%'). */ -case 97: -/* rule 97 can match eol */ -YY_RULE_SETUP -#line 634 "scan-gram.l" -STRING_GROW; - YY_BREAK -case 98: -YY_RULE_SETUP -#line 636 "scan-gram.l" -handle_dollar (token_type, gram_text, *loc); - YY_BREAK -case 99: -YY_RULE_SETUP -#line 637 "scan-gram.l" -handle_at (token_type, gram_text, *loc); - YY_BREAK -case 100: -YY_RULE_SETUP -#line 639 "scan-gram.l" -{ - warn_at (*loc, _("stray `$'")); - obstack_sgrow (&obstack_for_string, "$]["); - } - YY_BREAK -case 101: -YY_RULE_SETUP -#line 643 "scan-gram.l" -{ - warn_at (*loc, _("stray `@'")); - obstack_sgrow (&obstack_for_string, "@@"); - } - YY_BREAK -case YY_STATE_EOF(SC_BRACED_CODE): -#line 648 "scan-gram.l" -unexpected_eof (code_start, "}"); BEGIN INITIAL; - YY_BREAK - -/*--------------------------------------------------------------. - | Scanning some prologue: from "%{" (already scanned) to "%}". | - `--------------------------------------------------------------*/ - - -case 102: -YY_RULE_SETUP -#line 658 "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 666 "scan-gram.l" -unexpected_eof (code_start, "%}"); BEGIN INITIAL; - YY_BREAK - -/*---------------------------------------------------------------. - | Scanning the epilogue (everything after the second "%%", which | - | has already been eaten). | - `---------------------------------------------------------------*/ - - -case YY_STATE_EOF(SC_EPILOGUE): -#line 677 "scan-gram.l" -{ - STRING_FINISH; - loc->start = code_start; - val->chars = last_string; - BEGIN INITIAL; - return EPILOGUE; - } - YY_BREAK - -/*-----------------------------------------. - | Escape M4 quoting characters in C code. | - `-----------------------------------------*/ - - -case 103: -YY_RULE_SETUP -#line 693 "scan-gram.l" -obstack_sgrow (&obstack_for_string, "$]["); - YY_BREAK -case 104: -YY_RULE_SETUP -#line 694 "scan-gram.l" -obstack_sgrow (&obstack_for_string, "@@"); - YY_BREAK -case 105: -YY_RULE_SETUP -#line 695 "scan-gram.l" -obstack_sgrow (&obstack_for_string, "@{"); - YY_BREAK -case 106: -YY_RULE_SETUP -#line 696 "scan-gram.l" -obstack_sgrow (&obstack_for_string, "@}"); - YY_BREAK - -/*-----------------------------------------------------. - | By default, grow the string obstack with the input. | - `-----------------------------------------------------*/ -case 107: -#line 705 "scan-gram.l" -case 108: -/* rule 108 can match eol */ -YY_RULE_SETUP -#line 705 "scan-gram.l" -STRING_GROW; - YY_BREAK -case 109: -YY_RULE_SETUP -#line 707 "scan-gram.l" -YY_FATAL_ERROR( "flex scanner jammed" ); - YY_BREAK -#line 2305 "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 - { - size_t 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), 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; - - (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)] : 58); - 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 >= 461 ) - 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 = 58; - 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 >= 461 ) - 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 == 460); - - 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*) - ); - - 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*) - ); - - /* 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 str 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 * yy_str ) -{ - - return gram__scan_bytes(yy_str,strlen(yy_str) ); -} -/* %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 * bytes, int 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 = len + 2; - buf = (char *) gram_alloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in gram__scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[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 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; - -/* %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 */ - -#undef YY_NEW_FILE -#undef YY_FLUSH_BUFFER -#undef yy_set_bol -#undef yy_new_buffer -#undef yy_set_interactive -#undef yytext_ptr -#undef YY_DO_BEFORE_ACTION - -#ifdef YY_DECL_IS_OURS -#undef YY_DECL_IS_OURS -#undef YY_DECL -#endif -#line 707 "scan-gram.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; - -/* 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. */ - -static void -adjust_location (location *loc, char const *token, size_t size) -{ - int line = scanner_cursor.line; - int column = scanner_cursor.column; - char const *p0 = token; - char const *p = token; - char const *lim = token + size; - - loc->start = scanner_cursor; - - 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; - } - - scanner_cursor.line = line; - scanner_cursor.column = column = add_column_width (column, p0, p - p0); - - loc->end = scanner_cursor; - - 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")); -} - - -/* 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; -} - - -/*------------------------------------------------------------------. -| 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 inline bool -handle_action_dollar (char *text, location loc) -{ - const char *type_name = NULL; - char *cp = text + 1; - - if (! current_rule) - return false; - - /* Get the type name if explicit. */ - if (*cp == '<') - { - type_name = ++cp; - while (*cp != '>') - ++cp; - *cp = '\0'; - ++cp; - } - - if (*cp == '$') - { - if (!type_name) - type_name = symbol_list_n_type_name_get (current_rule, loc, 0); - if (!type_name && typed) - complain_at (loc, _("$$ of `%s' has no declared type"), - current_rule->sym->tag); - if (!type_name) - type_name = ""; - obstack_fgrow1 (&obstack_for_string, - "]b4_lhs_value([%s])[", type_name); - current_rule->used = true; - } - else - { - long int num = strtol (cp, NULL, 10); - - if (1 - INT_MAX + rule_length <= num && num <= 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 (current_rule, loc, n); - if (!type_name && typed) - complain_at (loc, _("$%d of `%s' has no declared type"), - n, current_rule->sym->tag); - if (!type_name) - type_name = ""; - obstack_fgrow3 (&obstack_for_string, - "]b4_rhs_value(%d, %d, [%s])[", - rule_length, n, type_name); - symbol_list_n_used_set (current_rule, n, true); - } - else - complain_at (loc, _("integer out of range: %s"), quote (text)); - } - - return true; -} - - -/*----------------------------------------------------------------. -| Map `$?' onto the proper M4 symbol, depending on its TOKEN_TYPE | -| (are we in an action?). | -`----------------------------------------------------------------*/ - -static void -handle_dollar (int token_type, char *text, location loc) -{ - switch (token_type) - { - case BRACED_CODE: - if (handle_action_dollar (text, loc)) - return; - break; - - case PERCENT_DESTRUCTOR: - case PERCENT_INITIAL_ACTION: - case PERCENT_PRINTER: - if (text[1] == '$') - { - obstack_sgrow (&obstack_for_string, "]b4_dollar_dollar["); - return; - } - break; - - default: - break; - } - - complain_at (loc, _("invalid value: %s"), quote (text)); -} - - -/*------------------------------------------------------. -| TEXT is a location token (i.e., a `@...'). Output to | -| OBSTACK_FOR_STRING a reference to this location. | -`------------------------------------------------------*/ - -static inline bool -handle_action_at (char *text, location loc) -{ - char *cp = text + 1; - locations_flag = true; - - if (! current_rule) - return false; - - if (*cp == '$') - obstack_sgrow (&obstack_for_string, "]b4_lhs_location["); - else - { - long int num = strtol (cp, NULL, 10); - - if (1 - INT_MAX + rule_length <= num && num <= rule_length) - { - int n = num; - obstack_fgrow2 (&obstack_for_string, "]b4_rhs_location(%d, %d)[", - rule_length, n); - } - else - complain_at (loc, _("integer out of range: %s"), quote (text)); - } - - return true; -} - - -/*----------------------------------------------------------------. -| Map `@?' onto the proper M4 symbol, depending on its TOKEN_TYPE | -| (are we in an action?). | -`----------------------------------------------------------------*/ - -static void -handle_at (int token_type, char *text, location loc) -{ - switch (token_type) - { - case BRACED_CODE: - handle_action_at (text, loc); - return; - - case PERCENT_INITIAL_ACTION: - case PERCENT_DESTRUCTOR: - case PERCENT_PRINTER: - if (text[1] == '$') - { - obstack_sgrow (&obstack_for_string, "]b4_at_dollar["); - return; - } - break; - - default: - break; - } - - complain_at (loc, _("invalid value: %s"), quote (text)); -} - - -/*------------------------------------------------------. -| 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; - } - scanner_cursor.file = current_file = uniqstr_new (file); - scanner_cursor.line = lineno; - scanner_cursor.column = 1; -} - - -/*---------------------------------. -| Report a rule that is too long. | -`---------------------------------*/ - -static void -rule_length_overflow (location loc) -{ - fatal_at (loc, _("rule is too long")); -} - - -/*----------------------------------------------------------------. -| 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 -scanner_initialize (void) -{ - obstack_init (&obstack_for_string); -} - - -/*-----------------------------------------------. -| Free all the memory allocated to the scanner. | -`-----------------------------------------------*/ - -void -scanner_free (void) -{ - obstack_free (&obstack_for_string, 0); - /* Reclaim Flex's buffers. */ - gram__delete_buffer (YY_CURRENT_BUFFER); -} - diff --git a/src/bin/bison/src/scan-gram.l b/src/bin/bison/src/scan-gram.l deleted file mode 100644 index 1622a35bcd..0000000000 --- a/src/bin/bison/src/scan-gram.l +++ /dev/null @@ -1,1167 +0,0 @@ -/* Bison Grammar Scanner -*- C -*- - - Copyright (C) 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 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 -*/ - -%option debug nodefault nounput noyywrap never-interactive -%option prefix="gram_" - -%{ -/* Work around a bug in flex 2.5.31. See Debian bug 333231 - . */ -#undef gram_wrap -#define gram_wrap() 1 - -#include "system.h" - -#include -#include - -#include "complain.h" -#include "files.h" -#include "getargs.h" -#include "gram.h" -#include "quotearg.h" -#include "reader.h" -#include "uniqstr.h" - -#define YY_USER_INIT \ - do \ - { \ - scanner_cursor.file = current_file; \ - scanner_cursor.line = 1; \ - scanner_cursor.column = 1; \ - code_start = scanner_cursor; \ - } \ - while (0) - -/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */ -int gram_get_lineno (void); -FILE *gram_get_in (void); -FILE *gram_get_out (void); -int gram_get_leng (void); -char *gram_get_text (void); -void gram_set_lineno (int); -void gram_set_in (FILE *); -void gram_set_out (FILE *); -int gram_get_debug (void); -void gram_set_debug (int); -int gram_lex_destroy (void); - -/* Location of scanner cursor. */ -boundary scanner_cursor; - -static void adjust_location (location *, char const *, size_t); -#define YY_USER_ACTION adjust_location (loc, 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)) - - -/* 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. */ - -static struct obstack obstack_for_string; - -/* A string representing the most recently saved token. */ -char *last_string; - -/* The location of the most recently saved token, if it was a - BRACED_CODE token; otherwise, this has an unspecified value. */ -location last_braced_code_loc; - -#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) - -void -scanner_last_string_free (void) -{ - STRING_FREE; -} - -/* Within well-formed rules, RULE_LENGTH is the number of values in - the current rule so far, which says where to find `$0' with respect - to the top of the stack. It is not the same as the rule->length in - the case of mid rule actions. - - Outside of well-formed rules, RULE_LENGTH has an undefined value. */ -static int rule_length; - -static void rule_length_overflow (location) __attribute__ ((__noreturn__)); - -/* Increment the rule length by one, checking for overflow. */ -static inline void -increment_rule_length (location loc) -{ - 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) - rule_length_overflow (loc); -} - -static void handle_dollar (int token_type, char *cp, location loc); -static void handle_at (int token_type, char *cp, location loc); -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 *); - -%} -%x SC_COMMENT SC_LINE_COMMENT SC_YACC_COMMENT -%x SC_STRING SC_CHARACTER -%x SC_AFTER_IDENTIFIER -%x SC_ESCAPED_STRING SC_ESCAPED_CHARACTER -%x SC_PRE_CODE SC_BRACED_CODE SC_PROLOGUE SC_EPILOGUE - -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); - - /* Token type to return, when applicable. */ - int token_type 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; - "%debug" return PERCENT_DEBUG; - "%default"[-_]"prec" return PERCENT_DEFAULT_PREC; - "%define" return PERCENT_DEFINE; - "%defines" return PERCENT_DEFINES; - "%destructor" token_type = PERCENT_DESTRUCTOR; BEGIN SC_PRE_CODE; - "%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" token_type = PERCENT_INITIAL_ACTION; BEGIN SC_PRE_CODE; - "%glr-parser" return PERCENT_GLR_PARSER; - "%left" return PERCENT_LEFT; - "%lex-param" token_type = PERCENT_LEX_PARAM; BEGIN SC_PRE_CODE; - "%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" token_type = PERCENT_PARSE_PARAM; BEGIN SC_PRE_CODE; - "%prec" rule_length--; return PERCENT_PREC; - "%printer" token_type = PERCENT_PRINTER; BEGIN SC_PRE_CODE; - "%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" token_type = PERCENT_UNION; BEGIN SC_PRE_CODE; - "%verbose" return PERCENT_VERBOSE; - "%yacc" return PERCENT_YACC; - - {directive} { - complain_at (*loc, _("invalid directive: %s"), quote (yytext)); - } - - "=" return EQUAL; - "|" rule_length = 0; return PIPE; - ";" return SEMICOLON; - - {id} { - val->symbol = symbol_get (yytext, *loc); - id_loc = *loc; - increment_rule_length (*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. */ - "{" { - if (current_rule && current_rule->action) - grammar_midrule_action (); - STRING_GROW; - token_type = BRACED_CODE; - 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. | - `-----------------------------------------------------------------*/ - - -{ - ":" { - rule_length = 0; - *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. | - `------------------------------------------------*/ - - -{ - "\"" { - STRING_FINISH; - loc->start = token_start; - val->chars = last_string; - increment_rule_length (*loc); - BEGIN INITIAL; - return STRING; - } - \n unexpected_newline (token_start, "\""); BEGIN INITIAL; - <> unexpected_eof (token_start, "\""); BEGIN INITIAL; -} - - /*----------------------------------------------------------. - | Scanning a Bison character literal, decoding its escapes. | - | The initial quote is already eaten. | - `----------------------------------------------------------*/ - - -{ - "'" { - unsigned char last_string_1; - STRING_GROW; - STRING_FINISH; - loc->start = token_start; - val->symbol = symbol_get (quotearg_style (escape_quoting_style, - last_string), - *loc); - symbol_class_set (val->symbol, token_sym, *loc, false); - last_string_1 = last_string[1]; - symbol_user_token_number_set (val->symbol, last_string_1, *loc); - STRING_FREE; - increment_rule_length (*loc); - BEGIN INITIAL; - return ID; - } - \n unexpected_newline (token_start, "'"); BEGIN INITIAL; - <> unexpected_eof (token_start, "'"); BEGIN INITIAL; -} - - -{ - \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 after %union etc., possibly followed by white space. | - | For %union only, allow arbitrary C code to appear before the | - | following brace, as an extension to POSIX. | - `---------------------------------------------------------------*/ - - -{ - . { - bool valid = yytext[0] == '{' || token_type == PERCENT_UNION; - scanner_cursor.column -= mbsnwidth (yytext, yyleng, 0); - yyless (0); - - if (valid) - { - braces_level = -1; - code_start = loc->start; - BEGIN SC_BRACED_CODE; - } - else - { - complain_at (*loc, _("missing `{' in %s"), - token_name (token_type)); - obstack_sgrow (&obstack_for_string, "{}"); - STRING_FINISH; - val->chars = last_string; - BEGIN INITIAL; - return token_type; - } - } - - <> unexpected_eof (scanner_cursor, "{}"); BEGIN INITIAL; -} - - - /*---------------------------------------------------------------. - | Scanning some code in braces (%union and actions). The initial | - | "{" is already eaten. | - `---------------------------------------------------------------*/ - - -{ - "{"|"<"{splice}"%" STRING_GROW; braces_level++; - "%"{splice}">" 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. - - 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 && token_type == BRACED_CODE && ! yacc_flag) - obstack_1grow (&obstack_for_string, ';'); - - obstack_1grow (&obstack_for_string, '}'); - - if (outer_brace) - { - STRING_FINISH; - loc->start = code_start; - val->chars = last_string; - increment_rule_length (*loc); - last_braced_code_loc = *loc; - BEGIN INITIAL; - return token_type; - } - } - - /* Tokenize `<<%' correctly (as `<<' `%') rather than incorrrectly - (as `<' `<%'). */ - "<"{splice}"<" STRING_GROW; - - "$"("<"{tag}">")?(-?[0-9]+|"$") handle_dollar (token_type, yytext, *loc); - "@"(-?[0-9]+|"$") handle_at (token_type, yytext, *loc); - - "$" { - warn_at (*loc, _("stray `$'")); - obstack_sgrow (&obstack_for_string, "$]["); - } - "@" { - warn_at (*loc, _("stray `@'")); - obstack_sgrow (&obstack_for_string, "@@"); - } - - <> unexpected_eof (code_start, "}"); BEGIN INITIAL; -} - - - /*--------------------------------------------------------------. - | 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, "%}"); BEGIN INITIAL; -} - - - /*---------------------------------------------------------------. - | 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; - } -} - - - /*-----------------------------------------. - | 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; - -%% - -/* 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; - -/* 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. */ - -static void -adjust_location (location *loc, char const *token, size_t size) -{ - int line = scanner_cursor.line; - int column = scanner_cursor.column; - char const *p0 = token; - char const *p = token; - char const *lim = token + size; - - loc->start = scanner_cursor; - - 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; - } - - scanner_cursor.line = line; - scanner_cursor.column = column = add_column_width (column, p0, p - p0); - - loc->end = scanner_cursor; - - 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")); -} - - -/* 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; -} - - -/*------------------------------------------------------------------. -| 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 inline bool -handle_action_dollar (char *text, location loc) -{ - const char *type_name = NULL; - char *cp = text + 1; - - if (! current_rule) - return false; - - /* Get the type name if explicit. */ - if (*cp == '<') - { - type_name = ++cp; - while (*cp != '>') - ++cp; - *cp = '\0'; - ++cp; - } - - if (*cp == '$') - { - if (!type_name) - type_name = symbol_list_n_type_name_get (current_rule, loc, 0); - if (!type_name && typed) - complain_at (loc, _("$$ of `%s' has no declared type"), - current_rule->sym->tag); - if (!type_name) - type_name = ""; - obstack_fgrow1 (&obstack_for_string, - "]b4_lhs_value([%s])[", type_name); - current_rule->used = true; - } - else - { - long int num = strtol (cp, NULL, 10); - - if (1 - INT_MAX + rule_length <= num && num <= 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 (current_rule, loc, n); - if (!type_name && typed) - complain_at (loc, _("$%d of `%s' has no declared type"), - n, current_rule->sym->tag); - if (!type_name) - type_name = ""; - obstack_fgrow3 (&obstack_for_string, - "]b4_rhs_value(%d, %d, [%s])[", - rule_length, n, type_name); - symbol_list_n_used_set (current_rule, n, true); - } - else - complain_at (loc, _("integer out of range: %s"), quote (text)); - } - - return true; -} - - -/*----------------------------------------------------------------. -| Map `$?' onto the proper M4 symbol, depending on its TOKEN_TYPE | -| (are we in an action?). | -`----------------------------------------------------------------*/ - -static void -handle_dollar (int token_type, char *text, location loc) -{ - switch (token_type) - { - case BRACED_CODE: - if (handle_action_dollar (text, loc)) - return; - break; - - case PERCENT_DESTRUCTOR: - case PERCENT_INITIAL_ACTION: - case PERCENT_PRINTER: - if (text[1] == '$') - { - obstack_sgrow (&obstack_for_string, "]b4_dollar_dollar["); - return; - } - break; - - default: - break; - } - - complain_at (loc, _("invalid value: %s"), quote (text)); -} - - -/*------------------------------------------------------. -| TEXT is a location token (i.e., a `@...'). Output to | -| OBSTACK_FOR_STRING a reference to this location. | -`------------------------------------------------------*/ - -static inline bool -handle_action_at (char *text, location loc) -{ - char *cp = text + 1; - locations_flag = true; - - if (! current_rule) - return false; - - if (*cp == '$') - obstack_sgrow (&obstack_for_string, "]b4_lhs_location["); - else - { - long int num = strtol (cp, NULL, 10); - - if (1 - INT_MAX + rule_length <= num && num <= rule_length) - { - int n = num; - obstack_fgrow2 (&obstack_for_string, "]b4_rhs_location(%d, %d)[", - rule_length, n); - } - else - complain_at (loc, _("integer out of range: %s"), quote (text)); - } - - return true; -} - - -/*----------------------------------------------------------------. -| Map `@?' onto the proper M4 symbol, depending on its TOKEN_TYPE | -| (are we in an action?). | -`----------------------------------------------------------------*/ - -static void -handle_at (int token_type, char *text, location loc) -{ - switch (token_type) - { - case BRACED_CODE: - handle_action_at (text, loc); - return; - - case PERCENT_INITIAL_ACTION: - case PERCENT_DESTRUCTOR: - case PERCENT_PRINTER: - if (text[1] == '$') - { - obstack_sgrow (&obstack_for_string, "]b4_at_dollar["); - return; - } - break; - - default: - break; - } - - complain_at (loc, _("invalid value: %s"), quote (text)); -} - - -/*------------------------------------------------------. -| 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; - } - scanner_cursor.file = current_file = uniqstr_new (file); - scanner_cursor.line = lineno; - scanner_cursor.column = 1; -} - - -/*---------------------------------. -| Report a rule that is too long. | -`---------------------------------*/ - -static void -rule_length_overflow (location loc) -{ - fatal_at (loc, _("rule is too long")); -} - - -/*----------------------------------------------------------------. -| 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 -scanner_initialize (void) -{ - obstack_init (&obstack_for_string); -} - - -/*-----------------------------------------------. -| Free all the memory allocated to the scanner. | -`-----------------------------------------------*/ - -void -scanner_free (void) -{ - obstack_free (&obstack_for_string, 0); - /* Reclaim Flex's buffers. */ - yy_delete_buffer (YY_CURRENT_BUFFER); -} diff --git a/src/bin/bison/src/scan-skel.c b/src/bin/bison/src/scan-skel.c deleted file mode 100644 index f2dd18c980..0000000000 --- a/src/bin/bison/src/scan-skel.c +++ /dev/null @@ -1,2134 +0,0 @@ -#line 2 "scan-skel.c" - -#line 4 "scan-skel.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 31 -#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 -#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 */ - -#if __STDC__ - -#define YY_USE_CONST - -#endif /* __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 - -#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) ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int 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 = 1; /* 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 13 -#define YY_END_OF_BUFFER 14 -/* 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[69] = - { 0, - 0, 0, 14, 12, 11, 10, 12, 10, 2, 10, - 10, 3, 4, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 6, 5, 10, 10, 10, 10, 10, 10, 1, 0, - 10, 10, 10, 10, 10, 10, 10, 10, 7, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 9, 8, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, - 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, 1, 6, 1, 1, 7, - - 8, 9, 1, 10, 11, 1, 1, 12, 13, 14, - 15, 16, 1, 17, 18, 19, 20, 1, 1, 21, - 1, 1, 22, 1, 23, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 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[24] = - { 0, - 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1 - } ; - -static yyconst flex_int16_t yy_base[74] = - { 0, - 0, 1, 107, 0, 138, 2, 0, 4, 138, 24, - 39, 138, 138, 1, 63, 45, 0, 2, 3, 9, - 5, 18, 22, 28, 11, 21, 33, 38, 34, 32, - 138, 138, 49, 46, 59, 54, 30, 81, 138, 8, - 58, 56, 47, 65, 61, 69, 68, 66, 138, 78, - 79, 77, 80, 87, 88, 91, 95, 89, 90, 97, - 100, 104, 106, 112, 114, 138, 138, 138, 125, 0, - 128, 131, 134 - } ; - -static yyconst flex_int16_t yy_def[74] = - { 0, - 69, 69, 68, 70, 68, 71, 70, 71, 68, 71, - 10, 68, 68, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 68, 68, 10, 10, 72, 10, 10, 72, 68, 73, - 10, 10, 10, 10, 10, 10, 10, 10, 68, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 68, 68, 0, 68, 68, - 68, 68, 68 - } ; - -static yyconst flex_int16_t yy_nxt[162] = - { 0, - 7, 5, 5, 6, 6, 9, 22, 68, 10, 39, - 8, 8, 8, 8, 23, 8, 11, 18, 21, 8, - 25, 8, 24, 12, 13, 68, 68, 68, 8, 27, - 29, 8, 8, 26, 14, 28, 31, 30, 8, 34, - 43, 32, 8, 8, 8, 68, 68, 15, 8, 8, - 16, 35, 33, 36, 37, 20, 8, 8, 17, 8, - 39, 45, 40, 41, 8, 44, 8, 46, 8, 42, - 47, 8, 49, 19, 50, 8, 8, 48, 8, 8, - 40, 40, 39, 51, 40, 52, 53, 8, 8, 8, - 8, 56, 57, 54, 60, 61, 55, 8, 8, 8, - - 8, 8, 40, 40, 58, 8, 68, 8, 59, 62, - 8, 64, 63, 65, 8, 66, 8, 67, 68, 68, - 68, 68, 8, 68, 8, 4, 4, 4, 8, 68, - 8, 38, 38, 38, 40, 40, 40, 3, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68 - } ; - -static yyconst flex_int16_t yy_chk[162] = - { 0, - 70, 1, 2, 1, 2, 6, 18, 8, 6, 40, - 17, 14, 18, 19, 19, 21, 6, 14, 17, 20, - 21, 25, 20, 6, 6, 8, 8, 10, 22, 23, - 25, 26, 23, 22, 10, 24, 27, 26, 24, 30, - 37, 28, 30, 27, 29, 10, 10, 11, 28, 11, - 11, 33, 29, 33, 34, 16, 34, 43, 11, 33, - 35, 42, 35, 36, 36, 41, 42, 43, 41, 36, - 44, 45, 46, 15, 47, 44, 48, 45, 47, 46, - 35, 35, 38, 48, 38, 50, 51, 52, 50, 51, - 53, 54, 55, 52, 58, 59, 53, 54, 55, 58, - - 59, 56, 38, 38, 56, 57, 3, 60, 57, 60, - 61, 62, 61, 63, 62, 64, 63, 65, 0, 0, - 0, 0, 64, 0, 65, 69, 69, 69, 71, 0, - 71, 72, 72, 72, 73, 73, 73, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68 - } ; - -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[13] = - { 0, - 70, 97, 98, 99, 101, 102, 103, 104, 105, 108, - 109, 110 - } ; - -/* 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 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. */ -#line 27 "scan-skel.l" -/* Work around a bug in flex 2.5.31. See Debian bug 333231 - . */ -#undef skel_wrap -#define skel_wrap() 1 - -#include "system.h" - -#include -#include - -#include "complain.h" -#include "getargs.h" -#include "files.h" -#include "scan-skel.h" - -/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */ -int skel_lex (void); -int skel_get_lineno (void); -FILE *skel_get_in (void); -FILE *skel_get_out (void); -int skel_get_leng (void); -char *skel_get_text (void); -void skel_set_lineno (int); -void skel_set_in (FILE *); -void skel_set_out (FILE *); -int skel_get_debug (void); -void skel_set_debug (int); -int skel_lex_destroy (void); - -#define QPUTS(String) \ - fputs (quotearg_style (c_quoting_style, String), skel_out) - -#define BASE_QPUTS(File) \ - QPUTS (base_name (File)) - -#line 638 "scan-skel.c" - -#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-reentrant */ -/* %endif */ -/* %if-bison-bridge */ -/* %endif */ -/* %endif End reentrant structures and macros. */ - -/* 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 (void) 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 = '*'; \ - size_t 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 63 "scan-skel.l" - - - - int lineno IF_LINT (= 0); - char *outname = NULL; - - -#line 851 "scan-skel.c" - - if ( (yy_init) ) - { - (yy_init) = 0; - -#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 >= 69 ) - 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 != 68 ); - 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 < 13 ) - fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", - (long)yy_rule_linenum[yy_act], skel_text ); - else if ( yy_act == 13 ) - fprintf( stderr, "--accepting default rule (\"%s\")\n", - skel_text ); - else if ( yy_act == 14 ) - 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 70 "scan-skel.l" -{ - char const *file_name = skel_text + sizeof "@output " - 1; - skel_text[skel_leng - 1] = '\0'; - - /* Decode special file names. They include the directory part, - contrary to their "free" occurrences, used for issuing #includes, - which must not include the directory part. */ - - if (*file_name == '@') - { - if (strcmp (file_name, "@output_header_name@") == 0) - file_name = spec_defines_file; - else if (strcmp (file_name, "@output_parser_name@") == 0) - file_name = parser_file_name; - else - fatal ("invalid token in skeleton: %s", skel_text); - } - if (outname) - { - free (outname); - xfclose (skel_out); - } - outname = xstrdup (file_name); - skel_out = xfopen (outname, "w"); - lineno = 1; -} - YY_BREAK -case 2: -YY_RULE_SETUP -#line 97 "scan-skel.l" -fputc ('@', skel_out); - YY_BREAK -case 3: -YY_RULE_SETUP -#line 98 "scan-skel.l" -fputc ('[', skel_out); - YY_BREAK -case 4: -YY_RULE_SETUP -#line 99 "scan-skel.l" -fputc (']', skel_out); - YY_BREAK -case 5: -YY_RULE_SETUP -#line 101 "scan-skel.l" -fprintf (skel_out, "%d", lineno + 1); - YY_BREAK -case 6: -YY_RULE_SETUP -#line 102 "scan-skel.l" -QPUTS (outname); - YY_BREAK -case 7: -YY_RULE_SETUP -#line 103 "scan-skel.l" -QPUTS (dir_prefix); - YY_BREAK -case 8: -YY_RULE_SETUP -#line 104 "scan-skel.l" -BASE_QPUTS (parser_file_name); - YY_BREAK -case 9: -YY_RULE_SETUP -#line 105 "scan-skel.l" -BASE_QPUTS (spec_defines_file); - YY_BREAK -/* This pattern must not match more than the previous @ patterns. */ -case 10: -YY_RULE_SETUP -#line 108 "scan-skel.l" -fatal ("invalid @ in skeleton: %s", skel_text); - YY_BREAK -case 11: -/* rule 11 can match eol */ -YY_RULE_SETUP -#line 109 "scan-skel.l" -lineno++; ECHO; - YY_BREAK -case 12: -YY_RULE_SETUP -#line 110 "scan-skel.l" -ECHO; - YY_BREAK -case YY_STATE_EOF(INITIAL): -#line 112 "scan-skel.l" -{ - if (outname) - { - free (outname); - xfclose (skel_out); - } - return EOF; -} - YY_BREAK -case 13: -YY_RULE_SETUP -#line 120 "scan-skel.l" -YY_FATAL_ERROR( "flex scanner jammed" ); - YY_BREAK -#line 1065 "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 - { - size_t 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), 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; - - (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 >= 69 ) - 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 >= 69 ) - 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 == 68); - - 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*) - ); - - 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*) - ); - - /* 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 str 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 * yy_str ) -{ - - return skel__scan_bytes(yy_str,strlen(yy_str) ); -} -/* %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 * bytes, int 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 = len + 2; - buf = (char *) skel_alloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in skel__scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[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 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; - -/* %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 */ - -#undef YY_NEW_FILE -#undef YY_FLUSH_BUFFER -#undef yy_set_bol -#undef yy_new_buffer -#undef yy_set_interactive -#undef yytext_ptr -#undef YY_DO_BEFORE_ACTION - -#ifdef YY_DECL_IS_OURS -#undef YY_DECL_IS_OURS -#undef YY_DECL -#endif -#line 120 "scan-skel.l" - - - -/*------------------------. -| Scan a Bison skeleton. | -`------------------------*/ - -void -scan_skel (FILE *in) -{ - skel_in = in; - skel__flex_debug = trace_flag & trace_skeleton; - skel_lex (); - /* Reclaim Flex's buffers. */ - skel__delete_buffer (YY_CURRENT_BUFFER); -} - diff --git a/src/bin/bison/src/scan-skel.h b/src/bin/bison/src/scan-skel.h deleted file mode 100644 index a7e14c38d1..0000000000 --- a/src/bin/bison/src/scan-skel.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Scan Bison Skeletons. - - Copyright (C) 2005, 2006 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. */ - -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; diff --git a/src/bin/bison/src/scan-skel.l b/src/bin/bison/src/scan-skel.l deleted file mode 100644 index edccceca54..0000000000 --- a/src/bin/bison/src/scan-skel.l +++ /dev/null @@ -1,134 +0,0 @@ -/* Scan Bison Skeletons. -*- C -*- - - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 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. */ - -%option nodefault noyywrap nounput never-interactive debug -%option prefix="skel_" - -%{ -/* Work around a bug in flex 2.5.31. See Debian bug 333231 - . */ -#undef skel_wrap -#define skel_wrap() 1 - -#include "system.h" - -#include -#include - -#include "complain.h" -#include "getargs.h" -#include "files.h" -#include "scan-skel.h" - -/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */ -int skel_lex (void); -int skel_get_lineno (void); -FILE *skel_get_in (void); -FILE *skel_get_out (void); -int skel_get_leng (void); -char *skel_get_text (void); -void skel_set_lineno (int); -void skel_set_in (FILE *); -void skel_set_out (FILE *); -int skel_get_debug (void); -void skel_set_debug (int); -int skel_lex_destroy (void); - -#define QPUTS(String) \ - fputs (quotearg_style (c_quoting_style, String), yyout) - -#define BASE_QPUTS(File) \ - QPUTS (base_name (File)) - -%} -%% - -%{ - int lineno IF_LINT (= 0); - char *outname = NULL; -%} - -"@output ".*\n { - char const *file_name = yytext + sizeof "@output " - 1; - yytext[yyleng - 1] = '\0'; - - /* Decode special file names. They include the directory part, - contrary to their "free" occurrences, used for issuing #includes, - which must not include the directory part. */ - - if (*file_name == '@') - { - if (strcmp (file_name, "@output_header_name@") == 0) - file_name = spec_defines_file; - else if (strcmp (file_name, "@output_parser_name@") == 0) - file_name = parser_file_name; - else - fatal ("invalid token in skeleton: %s", yytext); - } - if (outname) - { - free (outname); - xfclose (yyout); - } - outname = xstrdup (file_name); - yyout = xfopen (outname, "w"); - lineno = 1; -} - -"@@" fputc ('@', yyout); -"@{" fputc ('[', yyout); -"@}" fputc (']', yyout); - -"@oline@" fprintf (yyout, "%d", lineno + 1); -"@ofile@" QPUTS (outname); -"@dir_prefix@" QPUTS (dir_prefix); -"@output_parser_name@" BASE_QPUTS (parser_file_name); -"@output_header_name@" BASE_QPUTS (spec_defines_file); - - /* This pattern must not match more than the previous @ patterns. */ -@[^{}@\n]* fatal ("invalid @ in skeleton: %s", yytext); -\n lineno++; ECHO; -[^@\n]+ ECHO; - -<> { - if (outname) - { - free (outname); - xfclose (yyout); - } - return EOF; -} -%% - -/*------------------------. -| Scan a Bison skeleton. | -`------------------------*/ - -void -scan_skel (FILE *in) -{ - skel_in = in; - skel__flex_debug = trace_flag & trace_skeleton; - skel_lex (); - /* Reclaim Flex's buffers. */ - yy_delete_buffer (YY_CURRENT_BUFFER); -} diff --git a/src/bin/bison/src/state.c b/src/bin/bison/src/state.c deleted file mode 100644 index 4eb39f9f6c..0000000000 --- a/src/bin/bison/src/state.c +++ /dev/null @@ -1,370 +0,0 @@ -/* Type definitions for nondeterministic finite state machine for Bison. - - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 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 "complain.h" -#include "gram.h" -#include "state.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++) - { - assert (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->look_ahead_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; - - assert (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->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) -{ - assert (!s->transitions); - s->transitions = transitions_new (num, trans); -} - - -/*--------------------------. -| Set the reductions of S. | -`--------------------------*/ - -void -state_reductions_set (state *s, int num, rule **reds) -{ - assert (!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) -{ - assert (!s->errs); - s->errs = errs_new (num, tokens); -} - - - -/*---------------------------------------------------. -| Print on OUT all the look-ahead tokens such that S | -| wants to reduce R. | -`---------------------------------------------------*/ - -void -state_rule_look_ahead_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->look_ahead_tokens && red != -1) - { - bitset_iterator biter; - int k; - char const *sep = ""; - fprintf (out, " ["); - BITSET_FOR_EACH (biter, reds->look_ahead_tokens[red], k, 0) - { - fprintf (out, "%s%s", sep, symbols[k]->tag); - sep = ", "; - } - fprintf (out, "]"); - } -} - - -/*---------------------. -| 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; -} - -/* 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/bin/bison/src/state.h b/src/bin/bison/src/state.h deleted file mode 100644 index 440cd466bf..0000000000 --- a/src/bin/bison/src/state.h +++ /dev/null @@ -1,257 +0,0 @@ -/* Type definitions for nondeterministic finite state machine for Bison. - - Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2004 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. */ - - -/* 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 RITEMS vector of the items that are selected in this state. - - The two types of actions are shifts/gotos (push the look-ahead 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 - look-ahead 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. The data is a list of - nreds rules, represented by their rule numbers. first_reduction - points to the list of these structures. - - 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 *look_ahead_tokens; - rule *rules[1]; -} reductions; - - - -/*---------. -| states. | -`---------*/ - -struct state -{ - state_number number; - symbol_number accessing_symbol; - transitions *transitions; - reductions *reductions; - errs *errs; - - /* Nonzero if no look-ahead is 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; - - /* Its items. Must be last, since ITEMS can be arbitrarily large. - */ - 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 look-ahead tokens such that this STATE wants to - reduce R. */ -void state_rule_look_ahead_tokens_print (state *s, rule *r, FILE *out); - -/* 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); - -/* 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/bin/bison/src/symlist.c b/src/bin/bison/src/symlist.c deleted file mode 100644 index 70db82f07c..0000000000 --- a/src/bin/bison/src/symlist.c +++ /dev/null @@ -1,162 +0,0 @@ -/* Lists of symbols for Bison - - Copyright (C) 2002, 2005, 2006 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 "complain.h" -#include "symlist.h" - - -/*--------------------------------------. -| Create a list containing SYM at LOC. | -`--------------------------------------*/ - -symbol_list * -symbol_list_new (symbol *sym, location loc) -{ - symbol_list *res = xmalloc (sizeof *res); - - res->sym = sym; - res->location = loc; - - res->midrule = NULL; - - res->action = NULL; - res->used = false; - - res->ruleprec = NULL; - res->dprec = 0; - res->merger = 0; - - res->next = NULL; - - return res; -} - - -/*------------------. -| Print this list. | -`------------------*/ - -void -symbol_list_print (const symbol_list *l, FILE *f) -{ - for (/* Nothing. */; l && l->sym; l = l->next) - { - symbol_print (l->sym, f); - fprintf (stderr, l->used ? " used" : " unused"); - if (l && l->sym) - fprintf (f, ", "); - } -} - - -/*---------------------------------. -| Prepend SYM at LOC to the LIST. | -`---------------------------------*/ - -symbol_list * -symbol_list_prepend (symbol_list *list, symbol *sym, location loc) -{ - symbol_list *res = symbol_list_new (sym, loc); - res->next = list; - return res; -} - - -/*-------------------------------------------------. -| Free the LIST, but not the symbols it contains. | -`-------------------------------------------------*/ - -void -symbol_list_free (symbol_list *list) -{ - LIST_FREE (symbol_list, list); -} - - -/*--------------------. -| Return its length. | -`--------------------*/ - -unsigned int -symbol_list_length (const symbol_list *l) -{ - int res = 0; - for (/* Nothing. */; l; l = l->next) - ++res; - return res; -} - - -/*--------------------------------. -| Get symbol 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->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; - } - return l->sym->type_name; -} - - -/*----------------------------------------. -| The symbol N in symbol list L is USED. | -`----------------------------------------*/ - -void -symbol_list_n_used_set (symbol_list *l, int n, bool used) -{ - l = symbol_list_n_get (l, n); - if (l) - l->used = used; -} diff --git a/src/bin/bison/src/symlist.h b/src/bin/bison/src/symlist.h deleted file mode 100644 index 0423d016d1..0000000000 --- a/src/bin/bison/src/symlist.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Lists of symbols for Bison - - Copyright (C) 2002, 2005 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 SYMLIST_H_ -# define SYMLIST_H_ - -# include "location.h" -# include "symtab.h" - -/* A list of symbols, used during the parsing to store the rules. */ -typedef struct symbol_list -{ - /* The symbol. */ - symbol *sym; - location location; - - /* If this symbol is the generated lhs for a mid-rule, a pointer to - that mid-rule. */ - struct symbol_list *midrule; - - /* The action is attached to the LHS of a rule. */ - const char *action; - location action_location; - - /* Whether this symbol's value is used in the current action. */ - bool used; - - /* Precedence/associativity. */ - symbol *ruleprec; - int dprec; - int merger; - - /* The list. */ - struct symbol_list *next; -} symbol_list; - - -/* Create a list containing SYM at LOC. */ -symbol_list *symbol_list_new (symbol *sym, location loc); - -/* Print it. */ -void symbol_list_print (const symbol_list *l, FILE *f); - -/* Prepend SYM at LOC to the LIST. */ -symbol_list *symbol_list_prepend (symbol_list *l, - symbol *sym, - location loc); - -/* Free the LIST, but not the symbols it contains. */ -void symbol_list_free (symbol_list *l); - -/* Return its length. */ -unsigned int symbol_list_length (const symbol_list *l); - -/* Get symbol N in symbol list 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); - -/* The symbol N in symbol list L is USED. */ -void symbol_list_n_used_set (symbol_list *l, int n, bool used); - -#endif /* !SYMLIST_H_ */ diff --git a/src/bin/bison/src/symtab.c b/src/bin/bison/src/symtab.c deleted file mode 100644 index ef59c6eef7..0000000000 --- a/src/bin/bison/src/symtab.c +++ /dev/null @@ -1,657 +0,0 @@ -/* Symbol table manager for Bison. - - Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004, 2005, 2006 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 "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; - -/*---------------------------------. -| 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; - res->destructor = NULL; - res->printer = NULL; - - 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; -} - - -/*-----------------. -| Print a symbol. | -`-----------------*/ - -#define SYMBOL_ATTR_PRINT(Attr) \ - if (s->Attr) \ - fprintf (f, " %s { %s }", #Attr, s->Attr) - -void -symbol_print (symbol *s, FILE *f) -{ - if (s) - { - fprintf (f, "\"%s\"", s->tag); - SYMBOL_ATTR_PRINT (type_name); - SYMBOL_ATTR_PRINT (destructor); - SYMBOL_ATTR_PRINT (printer); - } - else - fprintf (f, ""); -} - -#undef SYMBOL_ATTR_PRINT - -/*------------------------------------------------------------------. -| Complain that S's WHAT is redeclared at SECOND, and was first set | -| at FIRST. | -`------------------------------------------------------------------*/ - -static void -redeclaration (symbol* s, const char *what, location first, location second) -{ - complain_at (second, _("%s redeclaration for %s"), what, s->tag); - complain_at (first, _("first 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) - redeclaration (sym, "%type", sym->type_location, loc); - uniqstr_assert (type_name); - sym->type_name = type_name; - sym->type_location = loc; - } -} - - -/*------------------------------------------------------------------. -| Set the DESTRUCTOR associated with SYM. Do nothing if passed 0. | -`------------------------------------------------------------------*/ - -void -symbol_destructor_set (symbol *sym, const char *destructor, location loc) -{ - if (destructor) - { - if (sym->destructor) - redeclaration (sym, "%destructor", sym->destructor_location, loc); - sym->destructor = destructor; - sym->destructor_location = loc; - } -} - - -/*---------------------------------------------------------------. -| Set the PRINTER associated with SYM. Do nothing if passed 0. | -`---------------------------------------------------------------*/ - -void -symbol_printer_set (symbol *sym, const char *printer, location loc) -{ - if (printer) - { - if (sym->printer) - redeclaration (sym, "%printer", sym->destructor_location, loc); - sym->printer = printer; - sym->printer_location = loc; - } -} - - -/*-----------------------------------------------------------------. -| 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) - 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) -{ - assert (sym->class == token_sym); - - if (sym->user_token_number != USER_NUMBER_UNDEFINED - && sym->user_token_number != user_token_number) - complain_at (loc, _("redefining user token number of %s"), sym->tag); - - sym->user_token_number = 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; - /* sym and symval combined are only one symbol. */ - nsyms--; - ntokens--; - assert (ntokens == sym->number || ntokens == symval->number); - sym->number = symval->number = - (symval->number < sym->number) ? 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 || alias->destructor) - { - if (orig->destructor) - symbol_destructor_set (alias, orig->destructor, - orig->destructor_location); - else - symbol_destructor_set (orig, alias->destructor, - alias->destructor_location); - } - - if (orig->printer || alias->printer) - { - if (orig->printer) - symbol_printer_set (alias, orig->printer, orig->printer_location); - else - symbol_printer_set (orig, alias->printer, alias->printer_location); - } - - 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 - { - assert (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 */ - assert (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); -} - - -/*----------------------. -| A symbol hash table. | -`----------------------*/ - -/* Initial capacity of symbols hash table. */ -#define HT_INITIAL_CAPACITY 257 - -static struct hash_table *symbol_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 bool -hash_symbol_comparator (void const *m1, void const *m2) -{ - return hash_compare_symbol (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 size_t -hash_symbol_hasher (void const *m, size_t tablesize) -{ - return hash_symbol (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); -} - - -/*----------------------------------------------------------------. -| Find the symbol named KEY, and return it. If it does not exist | -| yet, create it. | -`----------------------------------------------------------------*/ - -symbol * -symbol_get (const char *key, location loc) -{ - symbol probe; - symbol *entry; - - key = uniqstr_new (key); - 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; -} - - -/*------------------------------------------------------------------. -| 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; -} - - -/*-------------------. -| Free the symbols. | -`-------------------*/ - -void -symbols_free (void) -{ - hash_free (symbol_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 = xcalloc (nsyms, sizeof *symbols); - - symbols_do (symbol_check_alias_consistency_processor, NULL); - symbols_do (symbol_pack_processor, NULL); - - 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); -} diff --git a/src/bin/bison/src/symtab.h b/src/bin/bison/src/symtab.h deleted file mode 100644 index 0f852b7aa7..0000000000 --- a/src/bin/bison/src/symtab.h +++ /dev/null @@ -1,162 +0,0 @@ -/* Definitions for symtab.c and callers, part of Bison. - - Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2004, 2005, 2006 - 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 SYMTAB_H_ -# define SYMTAB_H_ - -# include "assoc.h" -# include "location.h" -# include "uniqstr.h" - -/*----------. -| Symbols. | -`----------*/ - -/* Symbol classes. */ -typedef enum -{ - unknown_sym, - token_sym, /* terminal symbol */ - 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 %type and associated printer and destructor. */ - uniqstr type_name; - location type_location; - - /* Does not own the memory. */ - const char *destructor; - location destructor_location; - - /* Does not own the memory. */ - const char *printer; - location printer_location; - - 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_get (const char *key, location loc); - -/* Generate a dummy nonterminal, whose name cannot conflict with the - user's names. */ -symbol *dummy_symbol_get (location loc); - -/* Declare the new symbol SYM. Make it an alias of SYMVAL. */ -void symbol_make_alias (symbol *sym, symbol *symval, location loc); - -/* Set the TYPE_NAME associated with SYM. Do nothing if passed 0 as - TYPE_NAME. */ -void symbol_type_set (symbol *sym, uniqstr type_name, location loc); - -/* Set the DESTRUCTOR associated with SYM. */ -void symbol_destructor_set (symbol *sym, const char *destructor, location loc); - -/* Set the PRINTER associated with SYM. */ -void symbol_printer_set (symbol *sym, const char *printer, location loc); - -/* Set the PRECEDENCE associated with SYM. Ensure that SYMBOL is a - terminal. Do nothing if invoked with UNDEF_ASSOC as ASSOC. */ -void symbol_precedence_set (symbol *sym, int prec, assoc a, location loc); - -/* Set the CLASS associated with SYM. */ -void symbol_class_set (symbol *sym, symbol_class class, location loc, - bool declaring); - -/* Set the USER_TOKEN_NUMBER associated with SYM. */ -void symbol_user_token_number_set (symbol *sym, int user_number, location loc); - - -/* Distinguished symbols. AXIOM is the real start symbol, that used - by the automaton. STARTSYMBOL is the one specified by the user. - */ -extern symbol *errtoken; -extern symbol *undeftoken; -extern symbol *endtoken; -extern symbol *accept; -extern symbol *startsymbol; -extern location startsymbol_location; - - -/*---------------. -| Symbol table. | -`---------------*/ - - -/* Create the symbol table. */ -void symbols_new (void); - -/* Free all the memory allocated for symbols. */ -void symbols_free (void); - -/* Check that all the symbols are defined. Report any undefined - symbols and consider them nonterminals. */ -void symbols_check_defined (void); - -/* Perform various sanity checks, assign symbol numbers, and set up - TOKEN_TRANSLATIONS. */ -void symbols_pack (void); - -#endif /* !SYMTAB_H_ */ diff --git a/src/bin/bison/src/system.h b/src/bin/bison/src/system.h deleted file mode 100644 index 63157904fb..0000000000 --- a/src/bin/bison/src/system.h +++ /dev/null @@ -1,231 +0,0 @@ -/* System-dependent definitions for Bison. - - Copyright (C) 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 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. */ - -#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 - -#include "unlocked-io.h" - -#if HAVE_SYS_TYPES_H -# include -#endif - -#if HAVE_UNISTD_H -# include -#endif - -#if HAVE_INTTYPES_H -# include -#endif -#if HAVE_STDINT_H -# include -#endif - -#if ! HAVE_UINTPTR_T -/* This isn't perfect, but it's good enough for Bison, which needs - only to hash pointers. */ -typedef size_t uintptr_t; -#endif - -#include -#include - - -/*---------------------. -| Missing prototypes. | -`---------------------*/ - -#include - -/* From lib/basename.c. */ -char *base_name (char const *name); - - -/*-----------------. -| 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 - -/*------. -| NLS. | -`------*/ - -#include - -#include -#define _(Msgid) gettext (Msgid) -#define N_(Msgid) (Msgid) - - -/*-------------------------------. -| Fix broken compilation flags. | -`-------------------------------*/ - -#ifndef LOCALEDIR -# define LOCALEDIR "/usr/local/share/locale" -#endif - - -/*-----------. -| Booleans. | -`-----------*/ - -#include - - -/*-----------. -| 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) - - -/* Assertions. 's assertions are too heavyweight, and can - be disabled too easily, so implement it separately here. */ -#define assert(x) ((void) ((x) || (abort (), 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/bin/bison/src/tables.c b/src/bin/bison/src/tables.c deleted file mode 100644 index c938139b2b..0000000000 --- a/src/bin/bison/src/tables.c +++ /dev/null @@ -1,861 +0,0 @@ -/* Output the generated parsing program for Bison. - - Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, - 2005 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 "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->look_ahead_tokens[i], j) - && (actrow[j] - != rule_number_as_item_number (reds->rules[i]->number))) - { - assert (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. */ - assert (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 | -| look-ahead 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 look-ahead | -| 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->look_ahead_tokens) - { - int j; - bitset_iterator biter; - /* loop over all the rules available here which require - look-ahead (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->look_ahead_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 | -| look-ahead 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]; - - assert (t); - - for (j = lowzero - from[0]; ; j++) - { - int k; - bool ok = true; - - assert (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; - - assert (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/bin/bison/src/tables.h b/src/bin/bison/src/tables.h deleted file mode 100644 index 911917fdfc..0000000000 --- a/src/bin/bison/src/tables.h +++ /dev/null @@ -1,119 +0,0 @@ -/* 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. - - 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 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 look-ahead 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/bin/bison/src/uniqstr.c b/src/bin/bison/src/uniqstr.c deleted file mode 100644 index 8804a80e0e..0000000000 --- a/src/bin/bison/src/uniqstr.c +++ /dev/null @@ -1,153 +0,0 @@ -/* 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. - - 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 "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/bin/bison/src/uniqstr.h b/src/bin/bison/src/uniqstr.h deleted file mode 100644 index ab482bebab..0000000000 --- a/src/bin/bison/src/uniqstr.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Keeping a unique copy of strings. - - Copyright (C) 2002, 2003 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 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/src/bin/bison/src/vcg.c b/src/bin/bison/src/vcg.c deleted file mode 100644 index 25fbb64ec8..0000000000 --- a/src/bin/bison/src/vcg.c +++ /dev/null @@ -1,841 +0,0 @@ -/* VCG description handler for Bison. - - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 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 "vcg.h" -#include "vcg_defaults.h" - -/* Return an unambiguous printable representated, 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); -} - - -/* Initialize a graph with the default values. */ -void -new_graph (graph *g) -{ - g->title = G_TITLE; - g->label = G_LABEL; - - g->infos[0] = G_INFOS1; - g->infos[1] = G_INFOS2; - g->infos[2] = G_INFOS3; - - g->color = G_COLOR; - g->textcolor = G_TEXTCOLOR; - g->bordercolor = G_BORDERCOLOR; - - g->width = G_WIDTH; - g->height = G_HEIGHT; - g->borderwidth = G_BORDERWIDTH; - g->x = G_X; - g->y = G_Y; - g->folding = G_FOLDING; - g->shrink = G_SHRINK; - g->stretch = G_STRETCH; - - g->textmode = G_TEXTMODE; - g->shape = G_SHAPE; - - g->vertical_order = G_VERTICAL_ORDER; - g->horizontal_order = G_HORIZONTAL_ORDER; - - g->xmax = G_XMAX; /* Not output. */ - g->ymax = G_YMAX; /* Not output. */ - - g->xbase = G_XBASE; - g->ybase = G_YBASE; - - g->xspace = G_XSPACE; - g->yspace = G_YSPACE; - g->xlspace = G_XLSPACE; /* Not output. */ - - g->xraster = G_XRASTER; - g->yraster = G_YRASTER; - g->xlraster = G_XLRASTER; - - g->hidden = G_HIDDEN; /* No default value. */ - - g->classname = G_CLASSNAME; /* No class name association. */ - - g->layout_downfactor = G_LAYOUT_DOWNFACTOR; - g->layout_upfactor = G_LAYOUT_UPFACTOR; - g->layout_nearfactor = G_LAYOUT_NEARFACTOR; - g->layout_splinefactor = G_LAYOUT_SPLINEFACTOR; - - g->late_edge_labels = G_LATE_EDGE_LABELS; - g->display_edge_labels = G_DISPLAY_EDGE_LABELS; - g->dirty_edge_labels = G_DIRTY_EDGE_LABELS; - g->finetuning = G_FINETUNING; - g->ignore_singles = G_IGNORE_SINGLES; - g->priority_phase = G_PRIORITY_PHASE; - g->manhattan_edges = G_MANHATTAN_EDGES; - g->smanhattan_edges = G_SMANHATTAN_EDGES; - g->near_edges = G_NEAR_EDGES; - - g->orientation = G_ORIENTATION; - g->node_alignment = G_NODE_ALIGNMENT; - g->port_sharing = G_PORT_SHARING; - g->arrow_mode = G_ARROW_MODE; - g->treefactor = G_TREEFACTOR; - g->spreadlevel = G_SPREADLEVEL; - g->crossing_weight = G_CROSSING_WEIGHT; - g->crossing_phase2 = G_CROSSING_PHASE2; - g->crossing_optimization = G_CROSSING_OPTIMIZATION; - g->view = G_VIEW; - - g->edges = G_EDGES; - g->nodes = G_NODES; - g->splines = G_SPLINES; - - g->bmax = G_BMAX; - g->cmin = G_CMIN; - g->cmax = G_CMAX; - g->pmin = G_PMIN; - g->pmax = G_PMAX; - g->rmin = G_RMIN; - g->rmax = G_RMAX; - g->smax = G_SMAX; - - g->node_list = G_NODE_LIST; - g->edge_list = G_EDGE_LIST; - - new_edge (&g->edge); - new_node (&g->node); -} - -/* Initialize a node with the default values. */ -void -new_node (node *n) -{ - n->title = N_TITLE; - n->label = N_LABEL; - - n->locx = N_LOCX; /* Default unspcified. */ - n->locy = N_LOCY; /* Default unspcified. */ - - n->vertical_order = N_VERTICAL_ORDER; /* Default unspcified. */ - n->horizontal_order = N_HORIZONTAL_ORDER; /* Default unspcified. */ - - n->width = N_WIDTH; /* We assume that we can't define it now. */ - n->height = N_HEIGHT; /* Also. */ - - n->shrink = N_SHRINK; - n->stretch = N_STRETCH; - - n->folding = N_FOLDING; /* No explicit default value. */ - - n->shape = N_SHAPE; - n->textmode = N_TEXTMODE; - n->borderwidth = N_BORDERWIDTH; - - n->color = N_COLOR; - n->textcolor = N_TEXTCOLOR; - n->bordercolor = N_BORDERCOLOR; - - n->infos[0] = N_INFOS1; - n->infos[1] = N_INFOS2; - n->infos[2] = N_INFOS3; - - n->next = N_NEXT; -} - -/* Initialize an edge with the default values. */ -void -new_edge (edge *e) -{ - e->type = E_EDGE_TYPE; - - e->sourcename = E_SOURCENAME; - e->targetname = E_TARGETNAME; - e->label = E_LABEL; - - e->linestyle = E_LINESTYLE; - e->thickness = E_THICKNESS; - - e->class = E_CLASS; - - e->color = E_COLOR; - e->textcolor = E_TEXTCOLOR; - e->arrowcolor = E_ARROWCOLOR; - e->backarrowcolor = E_BACKARROWCOLOR; - - e->arrowsize = E_ARROWSIZE; - e->backarrowsize = E_BACKARROWSIZE; - e->arrowstyle = E_ARROWSTYLE; - - e->backarrowstyle = E_BACKARROWSTYLE; - - e->priority = E_PRIORITY; - - e->anchor = E_ANCHOR; - - e->horizontal_order = E_HORIZONTAL_ORDER; - - e->next = E_NEXT; -} - -/*----------------------------------------------. -| Get functions. | -| Return string corresponding to an enum value. | -`----------------------------------------------*/ - -static const char * -get_color_str (enum color color) -{ - switch (color) - { - default: abort (); - case white: return "white"; - case blue: return "blue"; - case red: return "red"; - case green: return "green"; - case yellow: return "yellow"; - case magenta: return "magenta"; - case cyan: return "cyan"; - case darkgrey: return "darkgrey"; - case darkblue: return "darkblue"; - case darkred: return "darkred"; - case darkgreen: return "darkgreen"; - case darkyellow: return "darkyellow"; - case darkmagenta: return "darkmagenta"; - case darkcyan: return "darkcyan"; - case gold: return "gold"; - case lightgrey: return "lightgrey"; - case lightblue: return "lightblue"; - case lightred: return "lightred"; - case lightgreen: return "lightgreen"; - case lightyellow: return "lightyellow"; - case lightmagenta: return "lightmagenta"; - case lightcyan: return "lightcyan"; - case lilac: return "lilac"; - case turquoise: return "turquoise"; - case aquamarine: return "aquamarine"; - case khaki: return "khaki"; - case purple: return "purple"; - case yellowgreen: return "yellowgreen"; - case pink: return "pink"; - case orange: return "orange"; - case orchid: return "orchid"; - case black: return "black"; - } -} - -static const char * -get_textmode_str (enum textmode textmode) -{ - switch (textmode) - { - default: abort (); - case centered: return "center"; - case left_justify: return "left_justify"; - case right_justify: return "right_justify"; - } -} - -static const char * -get_shape_str (enum shape shape) -{ - switch (shape) - { - default: abort (); - case box: return "box"; - case rhomb: return "rhomb"; - case ellipse: return "ellipse"; - case triangle: return "triangle"; - } -} - -static const char * -get_decision_str (enum decision decision) -{ - switch (decision) - { - default: abort (); - case no: return "no"; - case yes: return "yes"; - } -} - -static const char * -get_orientation_str (enum orientation orientation) -{ - switch (orientation) - { - default: abort (); - case top_to_bottom: return "top_to_bottom"; - case bottom_to_top: return "bottom_to_top"; - case left_to_right: return "left_to_right"; - case right_to_left: return "right_to_left"; - } -} - -static const char * -get_node_alignment_str (enum alignment alignment) -{ - switch (alignment) - { - default: abort (); - case center: return "center"; - case top: return "top"; - case bottom: return "bottom"; - } -} - -static const char * -get_arrow_mode_str (enum arrow_mode arrow_mode) -{ - switch (arrow_mode) - { - default: abort (); - case fixed: return "fixed"; - case free_a: return "free"; - } -} - -static const char * -get_crossing_type_str (enum crossing_type crossing_type) -{ - switch (crossing_type) - { - default: abort (); - case bary: return "bary"; - case median: return "median"; - case barymedian: return "barymedian"; - case medianbary: return "medianbary"; - } -} - -static const char * -get_view_str (enum view view) -{ - /* There is no way with vcg 1.30 to specify a normal view explicitly, - so it is an error here if view == normal_view. */ - switch (view) - { - default: abort (); - case cfish: return "cfish"; - case pfish: return "pfish"; - case fcfish: return "fcfish"; - case fpfish: return "fpfish"; - } -} - -static const char * -get_linestyle_str (enum linestyle linestyle) -{ - switch (linestyle) - { - default: abort (); - case continuous: return "continuous"; - case dashed: return "dashed"; - case dotted: return "dotted"; - case invisible: return "invisible"; - } -} - -static const char * -get_arrowstyle_str (enum arrowstyle arrowstyle) -{ - switch (arrowstyle) - { - default: abort (); - case solid: return "solid"; - case line: return "line"; - case none: return "none"; - } -} - -/*------------------------------. -| Add functions. | -| Edge and nodes into a graph. | -`------------------------------*/ - -void -add_node (graph *g, node *n) -{ - n->next = g->node_list; - g->node_list = n; -} - -void -add_edge (graph *g, edge *e) -{ - e->next = g->edge_list; - g->edge_list = e; -} - -void -add_classname (graph *g, int val, const char *name) -{ - struct classname *classname = xmalloc (sizeof *classname); - classname->no = val; - classname->name = name; - classname->next = g->classname; - g->classname = classname; -} - -void -add_infoname (graph *g, int integer, const char *str) -{ - struct infoname *infoname = xmalloc (sizeof *infoname); - infoname->integer = integer; - infoname->chars = str; - infoname->next = g->infoname; - g->infoname = infoname; -} - -/* Build a colorentry struct and add it to the list. */ -void -add_colorentry (graph *g, int color_idx, int red_cp, - int green_cp, int blue_cp) -{ - struct colorentry *ce = xmalloc (sizeof *ce); - ce->color_index = color_idx; - ce->red_cp = red_cp; - ce->green_cp = green_cp; - ce->blue_cp = blue_cp; - ce->next = g->colorentry; - g->colorentry = ce; -} - -/*-------------------------------------. -| Open and close functions (formatted) | -`-------------------------------------*/ - -void -open_edge (edge *e, FILE *fout) -{ - switch (e->type) - { - case normal_edge: - fputs ("\tedge: {\n", fout); - break; - case back_edge: - fputs ("\tbackedge: {\n", fout); - break; - case near_edge: - fputs ("\tnearedge: {\n", fout); - break; - case bent_near_edge: - fputs ("\tbentnearedge: {\n", fout); - break; - default: - fputs ("\tedge: {\n", fout); - } -} - -void -close_edge (FILE *fout) -{ - fputs ("\t}\n", fout); -} - -void -open_node (FILE *fout) -{ - fputs ("\tnode: {\n", fout); -} - -void -close_node (FILE *fout) -{ - fputs ("\t}\n", fout); -} - -void -open_graph (FILE *fout) -{ - fputs ("graph: {\n", fout); -} - -void -close_graph (graph *g, FILE *fout) -{ - fputc ('\n', fout); - - /* FIXME: Unallocate nodes and edges if required. */ - { - node *n; - - for (n = g->node_list; n; n = n->next) - { - open_node (fout); - output_node (n, fout); - close_node (fout); - } - } - - fputc ('\n', fout); - - { - edge *e; - - for (e = g->edge_list; e; e = e->next) - { - open_edge (e, fout); - output_edge (e, fout); - close_edge (fout); - } - } - - fputs ("}\n", fout); -} - -/*-------------------------------------------. -| Output functions (formatted) in file FOUT | -`-------------------------------------------*/ - -void -output_node (node *n, FILE *fout) -{ - if (n->title != N_TITLE) - fprintf (fout, "\t\ttitle:\t%s\n", quote (n->title)); - if (n->label != N_LABEL) - fprintf (fout, "\t\tlabel:\t%s\n", quote (n->label)); - - if ((n->locx != N_LOCX) && (n->locy != N_LOCY)) - fprintf (fout, "\t\tloc { x: %d y: %d }\t\n", n->locx, n->locy); - - if (n->vertical_order != N_VERTICAL_ORDER) - fprintf (fout, "\t\tvertical_order:\t%d\n", n->vertical_order); - if (n->horizontal_order != N_HORIZONTAL_ORDER) - fprintf (fout, "\t\thorizontal_order:\t%d\n", n->horizontal_order); - - if (n->width != N_WIDTH) - fprintf (fout, "\t\twidth:\t%d\n", n->width); - if (n->height != N_HEIGHT) - fprintf (fout, "\t\theight:\t%d\n", n->height); - - if (n->shrink != N_SHRINK) - fprintf (fout, "\t\tshrink:\t%d\n", n->shrink); - if (n->stretch != N_STRETCH) - fprintf (fout, "\t\tstretch:\t%d\n", n->stretch); - - if (n->folding != N_FOLDING) - fprintf (fout, "\t\tfolding:\t%d\n", n->folding); - - if (n->textmode != N_TEXTMODE) - fprintf (fout, "\t\ttextmode:\t%s\n", - get_textmode_str (n->textmode)); - - if (n->shape != N_SHAPE) - fprintf (fout, "\t\tshape:\t%s\n", get_shape_str (n->shape)); - - if (n->borderwidth != N_BORDERWIDTH) - fprintf (fout, "\t\tborderwidth:\t%d\n", n->borderwidth); - - if (n->color != N_COLOR) - fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (n->color)); - if (n->textcolor != N_TEXTCOLOR) - fprintf (fout, "\t\ttextcolor:\t%s\n", - get_color_str (n->textcolor)); - if (n->bordercolor != N_BORDERCOLOR) - fprintf (fout, "\t\tbordercolor:\t%s\n", - get_color_str (n->bordercolor)); - - { - int i; - for (i = 0; i < 3; ++i) - if (n->infos[i]) - fprintf (fout, "\t\tinfo%d:\t%s\n", - i, quote (n->infos[i])); - } -} - -void -output_edge (edge *e, FILE *fout) -{ - /* FIXME: SOURCENAME and TARGETNAME are mandatory - so it has to be fatal not to give these informations. */ - if (e->sourcename != E_SOURCENAME) - fprintf (fout, "\t\tsourcename:\t%s\n", quote (e->sourcename)); - if (e->targetname != E_TARGETNAME) - fprintf (fout, "\t\ttargetname:\t%s\n", quote (e->targetname)); - - if (e->label != E_LABEL) - fprintf (fout, "\t\tlabel:\t%s\n", quote (e->label)); - - if (e->linestyle != E_LINESTYLE) - fprintf (fout, "\t\tlinestyle:\t%s\n", get_linestyle_str (e->linestyle)); - - if (e->thickness != E_THICKNESS) - fprintf (fout, "\t\tthickness:\t%d\n", e->thickness); - if (e->class != E_CLASS) - fprintf (fout, "\t\tclass:\t%d\n", e->class); - - if (e->color != E_COLOR) - fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (e->color)); - if (e->color != E_TEXTCOLOR) - fprintf (fout, "\t\ttextcolor:\t%s\n", - get_color_str (e->textcolor)); - if (e->arrowcolor != E_ARROWCOLOR) - fprintf (fout, "\t\tarrowcolor:\t%s\n", - get_color_str (e->arrowcolor)); - if (e->backarrowcolor != E_BACKARROWCOLOR) - fprintf (fout, "\t\tbackarrowcolor:\t%s\n", - get_color_str (e->backarrowcolor)); - - if (e->arrowsize != E_ARROWSIZE) - fprintf (fout, "\t\tarrowsize:\t%d\n", e->arrowsize); - if (e->backarrowsize != E_BACKARROWSIZE) - fprintf (fout, "\t\tbackarrowsize:\t%d\n", e->backarrowsize); - - if (e->arrowstyle != E_ARROWSTYLE) - fprintf (fout, "\t\tarrowstyle:\t%s\n", - get_arrowstyle_str (e->arrowstyle)); - if (e->backarrowstyle != E_BACKARROWSTYLE) - fprintf (fout, "\t\tbackarrowstyle:\t%s\n", - get_arrowstyle_str (e->backarrowstyle)); - - if (e->priority != E_PRIORITY) - fprintf (fout, "\t\tpriority:\t%d\n", e->priority); - if (e->anchor != E_ANCHOR) - fprintf (fout, "\t\tanchor:\t%d\n", e->anchor); - if (e->horizontal_order != E_HORIZONTAL_ORDER) - fprintf (fout, "\t\thorizontal_order:\t%d\n", e->horizontal_order); -} - -void -output_graph (graph *g, FILE *fout) -{ - if (g->title) - fprintf (fout, "\ttitle:\t%s\n", quote (g->title)); - if (g->label) - fprintf (fout, "\tlabel:\t%s\n", quote (g->label)); - - { - int i; - for (i = 0; i < 3; ++i) - if (g->infos[i]) - fprintf (fout, "\tinfo%d:\t%s\n", i, quote (g->infos[i])); - } - - if (g->color != G_COLOR) - fprintf (fout, "\tcolor:\t%s\n", get_color_str (g->color)); - if (g->textcolor != G_TEXTCOLOR) - fprintf (fout, "\ttextcolor:\t%s\n", get_color_str (g->textcolor)); - if (g->bordercolor != G_BORDERCOLOR) - fprintf (fout, "\tbordercolor:\t%s\n", - get_color_str (g->bordercolor)); - - if (g->width != G_WIDTH) - fprintf (fout, "\twidth:\t%d\n", g->width); - if (g->height != G_HEIGHT) - fprintf (fout, "\theight:\t%d\n", g->height); - if (g->borderwidth != G_BORDERWIDTH) - fprintf (fout, "\tborderwidth:\t%d\n", g->borderwidth); - - if (g->x != G_X) - fprintf (fout, "\tx:\t%d\n", g->x); - if (g->y != G_Y) - fprintf (fout, "\ty:\t%d\n", g->y); - - if (g->folding != G_FOLDING) - fprintf (fout, "\tfolding:\t%d\n", g->folding); - - if (g->shrink != G_SHRINK) - fprintf (fout, "\tshrink:\t%d\n", g->shrink); - if (g->stretch != G_STRETCH) - fprintf (fout, "\tstretch:\t%d\n", g->stretch); - - if (g->textmode != G_TEXTMODE) - fprintf (fout, "\ttextmode:\t%s\n", - get_textmode_str (g->textmode)); - - if (g->shape != G_SHAPE) - fprintf (fout, "\tshape:\t%s\n", get_shape_str (g->shape)); - - if (g->vertical_order != G_VERTICAL_ORDER) - fprintf (fout, "\tvertical_order:\t%d\n", g->vertical_order); - if (g->horizontal_order != G_HORIZONTAL_ORDER) - fprintf (fout, "\thorizontal_order:\t%d\n", g->horizontal_order); - - if (g->xmax != G_XMAX) - fprintf (fout, "\txmax:\t%d\n", g->xmax); - if (g->ymax != G_YMAX) - fprintf (fout, "\tymax:\t%d\n", g->ymax); - - if (g->xbase != G_XBASE) - fprintf (fout, "\txbase:\t%d\n", g->xbase); - if (g->ybase != G_YBASE) - fprintf (fout, "\tybase:\t%d\n", g->ybase); - - if (g->xspace != G_XSPACE) - fprintf (fout, "\txspace:\t%d\n", g->xspace); - if (g->yspace != G_YSPACE) - fprintf (fout, "\tyspace:\t%d\n", g->yspace); - if (g->xlspace != G_XLSPACE) - fprintf (fout, "\txlspace:\t%d\n", g->xlspace); - - if (g->xraster != G_XRASTER) - fprintf (fout, "\txraster:\t%d\n", g->xraster); - if (g->yraster != G_YRASTER) - fprintf (fout, "\tyraster:\t%d\n", g->yraster); - if (g->xlraster != G_XLRASTER) - fprintf (fout, "\txlraster:\t%d\n", g->xlraster); - - if (g->hidden != G_HIDDEN) - fprintf (fout, "\thidden:\t%d\n", g->hidden); - - /* FIXME: Unallocate struct list if required. - Maybe with a little function. */ - if (g->classname != G_CLASSNAME) - { - struct classname *ite; - - for (ite = g->classname; ite; ite = ite->next) - fprintf (fout, "\tclassname %d :\t%s\n", ite->no, ite->name); - } - - if (g->infoname != G_INFONAME) - { - struct infoname *ite; - - for (ite = g->infoname; ite; ite = ite->next) - fprintf (fout, "\tinfoname %d :\t%s\n", ite->integer, ite->chars); - } - - if (g->colorentry != G_COLORENTRY) - { - struct colorentry *ite; - - for (ite = g->colorentry; ite; ite = ite->next) - { - fprintf (fout, "\tcolorentry %d :\t%d %d %d\n", - ite->color_index, - ite->red_cp, - ite->green_cp, - ite->blue_cp); - } - } - - if (g->layout_downfactor != G_LAYOUT_DOWNFACTOR) - fprintf (fout, "\tlayout_downfactor:\t%d\n", g->layout_downfactor); - if (g->layout_upfactor != G_LAYOUT_UPFACTOR) - fprintf (fout, "\tlayout_upfactor:\t%d\n", g->layout_upfactor); - if (g->layout_nearfactor != G_LAYOUT_NEARFACTOR) - fprintf (fout, "\tlayout_nearfactor:\t%d\n", g->layout_nearfactor); - if (g->layout_splinefactor != G_LAYOUT_SPLINEFACTOR) - fprintf (fout, "\tlayout_splinefactor:\t%d\n", - g->layout_splinefactor); - - if (g->late_edge_labels != G_LATE_EDGE_LABELS) - fprintf (fout, "\tlate_edge_labels:\t%s\n", - get_decision_str (g->late_edge_labels)); - if (g->display_edge_labels != G_DISPLAY_EDGE_LABELS) - fprintf (fout, "\tdisplay_edge_labels:\t%s\n", - get_decision_str (g->display_edge_labels)); - if (g->dirty_edge_labels != G_DIRTY_EDGE_LABELS) - fprintf (fout, "\tdirty_edge_labels:\t%s\n", - get_decision_str (g->dirty_edge_labels)); - if (g->finetuning != G_FINETUNING) - fprintf (fout, "\tfinetuning:\t%s\n", - get_decision_str (g->finetuning)); - if (g->ignore_singles != G_IGNORE_SINGLES) - fprintf (fout, "\tignore_singles:\t%s\n", - get_decision_str (g->ignore_singles)); - if (g->priority_phase != G_PRIORITY_PHASE) - fprintf (fout, "\tpriority_phase:\t%s\n", - get_decision_str (g->priority_phase)); - if (g->manhattan_edges != G_MANHATTAN_EDGES) - fprintf (fout, - "\tmanhattan_edges:\t%s\n", - get_decision_str (g->manhattan_edges)); - if (g->smanhattan_edges != G_SMANHATTAN_EDGES) - fprintf (fout, - "\tsmanhattan_edges:\t%s\n", - get_decision_str (g->smanhattan_edges)); - if (g->near_edges != G_NEAR_EDGES) - fprintf (fout, "\tnear_edges:\t%s\n", - get_decision_str (g->near_edges)); - - if (g->orientation != G_ORIENTATION) - fprintf (fout, "\torientation:\t%s\n", - get_orientation_str (g->orientation)); - - if (g->node_alignment != G_NODE_ALIGNMENT) - fprintf (fout, "\tnode_alignment:\t%s\n", - get_node_alignment_str (g->node_alignment)); - - if (g->port_sharing != G_PORT_SHARING) - fprintf (fout, "\tport_sharing:\t%s\n", - get_decision_str (g->port_sharing)); - - if (g->arrow_mode != G_ARROW_MODE) - fprintf (fout, "\tarrow_mode:\t%s\n", - get_arrow_mode_str (g->arrow_mode)); - - if (g->treefactor != G_TREEFACTOR) - fprintf (fout, "\ttreefactor:\t%f\n", g->treefactor); - if (g->spreadlevel != G_SPREADLEVEL) - fprintf (fout, "\tspreadlevel:\t%d\n", g->spreadlevel); - - if (g->crossing_weight != G_CROSSING_WEIGHT) - fprintf (fout, "\tcrossing_weight:\t%s\n", - get_crossing_type_str (g->crossing_weight)); - if (g->crossing_phase2 != G_CROSSING_PHASE2) - fprintf (fout, "\tcrossing_phase2:\t%s\n", - get_decision_str (g->crossing_phase2)); - if (g->crossing_optimization != G_CROSSING_OPTIMIZATION) - fprintf (fout, "\tcrossing_optimization:\t%s\n", - get_decision_str (g->crossing_optimization)); - - if (g->view != normal_view) - fprintf (fout, "\tview:\t%s\n", get_view_str (g->view)); - - if (g->edges != G_EDGES) - fprintf (fout, "\tedges:\t%s\n", get_decision_str (g->edges)); - - if (g->nodes != G_NODES) - fprintf (fout,"\tnodes:\t%s\n", get_decision_str (g->nodes)); - - if (g->splines != G_SPLINES) - fprintf (fout, "\tsplines:\t%s\n", get_decision_str (g->splines)); - - if (g->bmax != G_BMAX) - fprintf (fout, "\tbmax:\t%d\n", g->bmax); - if (g->cmin != G_CMIN) - fprintf (fout, "\tcmin:\t%d\n", g->cmin); - if (g->cmax != G_CMAX) - fprintf (fout, "\tcmax:\t%d\n", g->cmax); - if (g->pmin != G_PMIN) - fprintf (fout, "\tpmin:\t%d\n", g->pmin); - if (g->pmax != G_PMAX) - fprintf (fout, "\tpmax:\t%d\n", g->pmax); - if (g->rmin != G_RMIN) - fprintf (fout, "\trmin:\t%d\n", g->rmin); - if (g->rmax != G_RMAX) - fprintf (fout, "\trmax:\t%d\n", g->rmax); - if (g->smax != G_SMAX) - fprintf (fout, "\tsmax:\t%d\n", g->smax); -} diff --git a/src/bin/bison/src/vcg.h b/src/bin/bison/src/vcg.h deleted file mode 100644 index ed356030a7..0000000000 --- a/src/bin/bison/src/vcg.h +++ /dev/null @@ -1,963 +0,0 @@ -/* VCG description handler for Bison. - - Copyright (C) 2001, 2002, 2005 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 VCG_H_ -# define VCG_H_ - -/* VCG color map. The 32 prime predefined colors. */ -enum color -{ - white = 0, - blue, - red, - green = 3, - yellow, - magenta, - cyan = 6, - darkgrey, - darkblue, - darkred = 9, - darkgreen, - darkyellow, - darkmagenta = 12, - darkcyan, - gold, - lightgrey = 15, - lightblue, - lightred, - lightgreen = 18, - lightyellow, - lightmagenta, - lightcyan = 21, - lilac, - turquoise, - aquamarine = 24, - khaki, - purple, - yellowgreen = 27, - pink, - orange, - orchid, - black = 31 -}; - -/* VCG textmode. Specify the adjustement of the text within the border of a summary node. */ -enum textmode -{ - centered, - left_justify, - right_justify -}; - -/* VCG shapes. Used for nodes shapes. */ -enum shape -{ - box, - rhomb, - ellipse, - triangle -}; - -/* Structure for colorentries. */ -struct colorentry -{ - int color_index; - int red_cp; - int green_cp; - int blue_cp; - struct colorentry *next; -}; - -/* Structure to construct lists of classnames. */ -struct classname -{ - int no; /* Class number */ - const char *name; /* Name associated to the class no. */ - struct classname *next; /* next name class association. */ -}; - -/* Structure is in infoname. */ -struct infoname -{ - int integer; - char const *chars; - struct infoname *next; -}; - -/* VCG decision yes/no. */ -enum decision -{ - yes, - no -}; - -/* VCG graph orientation. */ -enum orientation -{ - top_to_bottom, - bottom_to_top, - left_to_right, - right_to_left -}; - -/* VCG alignment for node alignement. */ -enum alignment -{ - center, - top, - bottom -}; - -/* VCG arrow mode. */ -enum arrow_mode -{ - fixed, - free_a -}; - -/* VCG crossing weight type. */ -enum crossing_type -{ - bary, - median, - barymedian, - medianbary -}; - -/* VCG views. */ -enum view -{ - normal_view, - cfish, - pfish, - fcfish, - fpfish -}; - -/*------------------------------------------------------. -| Node attributs list. structure that describes a node. | -`------------------------------------------------------*/ - -struct node -{ - /* Title the unique string identifying the node. This attribute is - mandatory. */ - const char *title; - - /* Label the text displayed inside the node. If no label is specified - then the title of the node will be used. Note that this text may - contain control characters like NEWLINE that influences the size of - the node. */ - const char *label; - - /* loc is the location as x, y position relatively to the system of - coordinates of the graph. Locations are specified in the form - loc: - x: xpos y: ypos "". The locations of nodes are only valid, - if the whole graph is fully specified with locations and no part is - folded. The layout algorithm of the tool calculates appropriate x, y - positions, if at least one node that must be drawn (i.e., is not - hidden by folding or edge classes) does not have fixed specified - locations. - Default is none. */ - int locx; - int locy; - - /* vertical order is the level position (rank) of the node. We can also - specify level: int. Level specifications are only valid, if the - layout is calculated, i.e. if at least one node does not have a - fixed location specification. The layout algorithm partitioned all - nodes into levels 0...maxlevel. Nodes at the level 0 are on the - upper corner. The algorithm is able to calculate appropriate levels - for the nodes automatically, if no fixed levels are given. - Specifications of levels are additional constraints, that may be - ignored, if they are in conflict with near edge specifications. - Default values are unspecified. */ - int vertical_order; - - /* horizontal order is the horizontal position of the node within a - level. The nodes which are specified with horizontal positions are - ordered according to these positions within the levels. The nodes - which do not have this attribute are inserted into this ordering by - the crossing reduction mechanism. Note that connected components are - handled separately, thus it is not possible to intermix such - components by specifying a horizontal order. If the algorithm for - downward laid out trees is used, the horizontal order influences - only the order of the child nodes at a node, but not the order of - the whole level. - Default is unspecified. */ - int horizontal_order; - - /* width, height is the width and height of a node including the border. - If no value (in pixels) is given then width and height are - calculated from the size of the label. - Default are width and height of the label. */ - int width; - int height; - - /* shrink, stretch gives the shrinking and stretching factor of the - node. The values of the attributes width, height, borderwidth and - the size of the label text is scaled by ((stretch=shrink) \Lambda - 100) percent. Note that the actual scale value is determined by the - scale value of a node relatively to a scale value of the graph, - i.e. if (stretch,shrink) = (2,1) for the graph and (stretch,shrink) - = (2,1) for the node of the graph, then the node is scaled by the - factor 4 compared to the normal size. The scale value can also be - specified by scaling: float. - Default are 1,1. */ - int shrink; - int stretch; - - /* folding specifies the default folding of the nodes. The folding k - (with k ? 0) means that the graph part that is reachable via edges - of a class less or equal to k is folded and displayed as one node. - There are commands to unfold such summary nodes, see section 5. If - no folding is specified for a node, then the node may be folded if - it is in the region of another node that starts the folding. If - folding 0 is specified, then the node is never folded. In this case - the folding stops at the predecessors of this node, if it is - reachable from another folding node. The summary node inherits some - attributes from the original node which starts the folding (all - color attributes, textmode and label, but not the location). A - folded region may contain folded regions with smaller folding class - values (nested foldings). If there is more than one node that start - the folding of the same region (this implies that the folding class - values are equal) then the attributes are inherited by one of these - nodes nondeterministically. If foldnode attributes are specified, - then the summary node attributes are inherited from these attributes. - Default is none. */ - int folding; - - /* shape specifies the visual appearance of a node: box, rhomb, ellipse, - and triangle. The drawing of ellipses is much slower than the drawing - of the other shapes. - Default is box. */ - enum shape shape; - - /* textmode specifies the adjustment of the text within the border of a - node. The possibilities are center, left.justify and right.justify. - Default is center. */ - enum textmode textmode; - - /* borderwidth specifies the thickness of the node's border in pixels. - color is the background color of the node. If none is given, the - node is white. For the possibilities, see the attribute color for - graphs. - Default is 2. */ - int borderwidth; - - /* node color. - Default is white or transparent, */ - enum color color; - - /* textcolor is the color for the label text. bordercolor is the color - of the border. Default color is the textcolor. info1, info2, info3 - combines additional text labels with a node or a folded graph. info1, - Default is black. */ - enum color textcolor; - - /* info2, info3 can be selected from the menu. The corresponding text - labels can be shown by mouse clicks on nodes. - Default are null strings. */ - const char *infos[3]; - - /* Node border color. - Default is textcolor. */ - enum color bordercolor; - - /* Next node node... */ - struct node *next; -}; - -/* typedef alias. */ -typedef struct node node; - -/*-------------------------------------------------------. -| Edge attributs list. Structure that describes an edge. | -`-------------------------------------------------------*/ - -/* VCG Edge type. */ -enum edge_type -{ - normal_edge, - back_edge, - near_edge, - bent_near_edge -}; - -/* Structs enum definitions for edges. */ -enum linestyle -{ - continuous, - dashed, - dotted, - invisible -}; - -enum arrowstyle -{ - solid, - line, - none -}; - -/* The struct edge itself. */ -struct edge -{ - - /* Edge type. - Default is normal edge. */ - enum edge_type type; - - /* Sourcename is the title of the source node of the edge. - Default: none. */ - const char *sourcename; /* Mandatory. */ - - /* Targetname is the title of the target node of the edge. - Default: none. */ - const char *targetname; /* Mandatory. */ - - /* Label specifies the label of the edge. It is drawn if - display.edge.labels is set to yes. - Default: no label. */ - const char *label; - - /* Linestyle specifies the style the edge is drawn. Possibilities are: - ffl continuous a solid line is drawn ( -- ) ffl dashed the edge - consists of single dashes ( - - - ) ffl dotted the edge is made of - single dots ( \Delta \Delta \Delta ) ffl invisible the edge is not - drawn. The attributes of its shape (color, thickness) are ignored. - To draw a dashed or dotted line needs more time than solid lines. - Default is continuous. */ - enum linestyle linestyle; - - /* Thickness is the thickness of an edge. - Default is 2. */ - int thickness; - - /* Class specifies the folding class of the edge. Nodes reachable by - edges of a class less or equal to a constant k specify folding - regions of k. See the node attribute folding and the folding commands. - Default is 1. */ - int class; - - /* color is the color of the edge. - Default is black. */ - enum color color; - - /* textcolor is the color of the label of the edge. arrowcolor, - backarrowcolor is the color of the arrow head and of the backarrow - head. priority The positions of the nodes are mainly determined by - the incoming and outgoing edges. One can think of rubberbands instead - of edges that pull a node into its position. The priority of an edges - corresponds to the strength of the rubberband. - Default is color. */ - enum color textcolor; - - /* Arrow color. - Default is color. */ - enum color arrowcolor; - - /* BackArrow color. - Default is color. */ - enum color backarrowcolor; - - /* arrowsize, backarrowsize The arrow head is a right-angled, isosceles - triangle and the cathetuses have length arrowsize. - Default is 10. */ - int arrowsize; - - /* Backarrow size - Default is 0. */ - int backarrowsize; - - /* arrowstyle, backarrowstyle Each edge has two arrow heads: the one - appears at the target node (the normal arrow head), the other appears - at the source node (the backarrow head). Normal edges only have the - normal solid arrow head, while the backarrow head is not drawn, i.e. - it is none. Arrowstyle is the style of the normal arrow head, and - backarrowstyle is the style of the backarrow head. Styles are none, - i.e. no arrow head, solid, and line. - Default is solid. */ - enum arrowstyle arrowstyle; - - /* Default is none. */ - enum arrowstyle backarrowstyle; - - /* Default is 1. */ - int priority; - - /* Anchor. An anchor point describes the vertical position in a node - where an edge goes out. This is useful, if node labels are several - lines long, and outgoing edges are related to label lines. (E.g., - this allows a nice visualization of structs containing pointers as - fields.). - Default is none. */ - int anchor; - - /* Horizontal order is the horizontal position the edge. This is of - interest only if the edge crosses several levels because it specifies - the point where the edge crosses the level. within a level. The nodes - which are specified with horizontal positions are ordered according - to these positions within a level. The horizontal position of a long - edge that crosses the level specifies between which two node of that - level the edge has to be drawn. Other edges which do not have this - attribute are inserted into this ordering by the crossing reduction - mechanism. Note that connected components are handled separately, - thus it is not possible to intermix such components by specifying a - horizontal order. - Default is unspcified. */ - int horizontal_order; - - /* - ** Next edge node... - */ - struct edge *next; - -}; - -/* -** typedef alias. -*/ -typedef struct edge edge; - -/*--------------------------------------------------------. -| Graph attributs list. Structure that describes a graph. | -`--------------------------------------------------------*/ - -struct graph -{ - /* Graph title or name. - Title specifies the name (a string) associated with the graph. The - default name of a subgraph is the name of the outer graph, and the - name of the outmost graph is the name of the specification input - file. The name of a graph is used to identify this graph, e.g., if - we want to express that an edge points to a subgraph. Such edges - point to the root of the graph, i.e. the first node of the graph or - the root of the first subgraph in the graph, if the subgraph is - visualized explicitly. - By default, it's the name of the vcg graph file description. */ - const char *title; - - /* Graph label. - Label the text displayed inside the node, when the graph is folded - to a node. If no label is specified then the title of the graph will - be used. Note that this text may contain control characters like - NEWLINE that influences the size of the node. - By default, it takes the title value */ - const char *label; - - /* Any informations. - Info1, info2, info3 combines additional text labels with a node or a - folded graph. info1, info2, info3 can be selected from the menu - interactively. The corresponding text labels can be shown by mouse - clicks on nodes. - Default values are empty strings (here NULL pointers) */ - const char *infos[3]; - - /* Background color and summary node colors - Color specifies the background color for the outermost graph, or the - color of the summary node for subgraphs. Colors are given in the enum - declared above. If more than these default colors are needed, a - color map with maximal 256 entries can be used. The first 32 entries - correspond to the colors just listed. A color of the color map can - selected by the color map index, an integer, for instance red has - index 2, green has index 3, etc. - Default is white for background and white or transparent for summary - nodes. */ - enum color color; - - /* Textcolor. - need explanations ??? - default is black for summary nodes. */ - enum color textcolor; - - /* Bordercolor is the color of the summary node's border. Default color - is the textcolor. width, height are width and height of the - displayed part of the window of the outermost graph in pixels, or - width and height of the summary node of inner subgraphs. - Default is the default of the textcolor. */ - enum color bordercolor; - - /* Width, height are width and height of the displayed part of the - window of the outermost graph in pixels, or width and height of the - summary node of inner subgraphs. - Default value is 100. */ - int width; - int height; - - /* Specify the thickness if summary node's border in pixels. - default value is 2. */ - int borderwidth; - - /* x, y are the x-position and y-position of the graph's window in - pixels, relatively to the root screen, if it is the outermost graph. - The origin of the window is upper, left hand. For inner subgraphs, - it is the position of the folded summary node. The position can also - be specified in the form loc: fx:int y:intg. - The default value is 0. */ - int x; - int y; - - /* folding of a subgraph is 1, if the subgraph is fused, and 0, if the - subgraph is visualized explicitly. There are commands to unfold such - summary nodes. - Default value is 0 */ - int folding; - - /* Shrink, stretch gives the shrinking and stretching factor for the - graph's representation (default is 1, 1). ((stretch=shrink) \Lambda - 100) is the scaling of the graph in percentage, e.g., - (stretch,shrink) = (1,1) or (2,2) or (3,3) : : : is normal size, - (stretch,shrink) = (1,2) is half size, (stretch,shrink) = (2,1) is - double size. For subgraphs, it is also the scaling factor of the - summary node. The scaling factor can also be specified by scaling: - float (here, scaling 1.0 means normal size). */ - int shrink; - int stretch; - - /* textmode specifies the adjustment of the text within the border of a - summary node. The possibilities are center, left.justify and - right.justify. - Default value is center.*/ - enum textmode textmode; - - /* Shape can be specified for subgraphs only. It is the shape of the - subgraph summary node that appears if the subgraph is folded: box, - rhomb, ellipse, and triangle. vertical order is the level position - (rank) of the summary node of an inner subgraph, if this subgraph is - folded. We can also specify level: int. The level is only - recognized, if an automatical layout is calculated. horizontal order - is the horizontal position of the summary node within a level. The - nodes which are specified with horizontal positions are ordered - according to these positions within the levels. The nodes which do - not have this attribute are inserted into this ordering by the - crossing reduction mechanism. Note that connected - components are handled separately, thus it is not possible to - intermix such components by specifying a horizontal order. If the - algorithm for downward laid out trees is used, the horizontal order - influences only the order of the child nodes at a node, but not the - order of the whole level. - Default is box, other: rhomb, ellipse, triangle. */ - enum shape shape; - - /* Vertical order is the level position (rank) of the summary node of an - inner subgraph, if this subgraph is folded. We can also specify - level: int. The level is only recognized, if an automatical layout is - calculated. */ - int vertical_order; - - /* Horizontal order is the horizontal position of the summary node within - a level. The nodes which are specified with horizontal positions are - ordered according to these positions within the levels. The nodes which - do not have this attribute are inserted into this ordering by the - crossing reduction mechanism. Note that connected components are - handled separately, thus it is not possible to intermix such components - by specifying a horizontal order. If the algorithm for downward laid - out trees is used, the horizontal order influences only the order of - the child nodes at a node, but not the order of the whole level. */ - int horizontal_order; - - /* xmax, ymax specify the maximal size of the virtual window that is - used to display the graph. This is usually larger than the displayed - part, thus the width and height of the displayed part cannot be - greater than xmax and ymax. Only those parts of the graph are drawn - that are inside the virtual window. The virtual window can be moved - over the potential infinite system of coordinates by special - positioning commands. - Defaults are 90 and 90. */ - int xmax; - int ymax; - - /* xy-base: specify the upper left corner coordinates of the graph - relatively to the root window. - Defaults are 5, 5. */ - int xbase; - int ybase; - - /* xspace, yspace the minimum horizontal and vertical distance between - nodes. xlspace is the horizontal distance between lines at the - points where they cross the levels. (At these points, dummy nodes - are used. In fact, this is the horizontal distance between dummy - nodes.) It is recommended to set xlspace to a larger value, if - splines are used to draw edges, to prevent sharp bendings. - Default are 20 and 70. */ - int xspace; - int yspace; - - /* The horizontal space between lines at the point where they cross - the levels. - defaults value is 1/2 xspace (polygone) and 4/5 xspace (splines)*/ - int xlspace; - - /* xraster, yraster specifies the raster distance for the position of - the nodes. The center of a node is aligned to this raster. xlraster - is the horizontal raster for the positions of the line control - points (the dummy nodes). It should be a divisor of xraster. - defaults are 1,1. */ - int xraster; - int yraster; - - /* xlraster is the horizontal raster for the positions of the line - control points (the dummy nodes). It should be a divisor of xraster. - defaults is 1. */ - int xlraster; - - /* hidden specifies the classes of edges that are hidden. - Edges that are within such a class are not laid out nor drawn. - Nodes that are only reachable (forward or backward) by edges of an - hidden class are not drawn. However, nodes that are not reachable - at all are drawn. (But see attribute ignore.singles.) Specification - of classes of hidden edges allows to hide parts of a graph, e.g., - annotations of a syntax tree. This attribute is only allowed at the - outermost level. More than one settings are possible to specify - exactly the set of classes that are hidden. Note the important - difference between hiding of edges and the edge line style invisible. - Hidden edges are not existent in the layout. Edges with line style - invisible are existent in the layout; they need space and may - produce crossings and influence the layout, but you cannot see - them. - No default value. */ - int hidden; - - /* Classname allows to introduce names for the edge classes. The names - are used in the menus. infoname allows to introduce names for the - additional text labels. The names are used in the menus. - defaults are 1,2,3... - By default, no class names. */ - struct classname *classname; - - /* Infoname allows to introduce names for the additional text labels. - The names are used in the menus. - Infoname is given by an integer and a string. - The default value is NULL. */ - struct infoname *infoname; - - /* Colorentry allows to fill the color map. A color is a triplet of integer - values for the red/green/blue-part. Each integer is between 0 (off) and - 255 (on), e.g., 0 0 0 is black and 255 255 255 is white. For instance - colorentry 75 : 70 130 180 sets the map entry 75 to steel blue. This - color can be used by specifying just the number 75. - Default id NULL. */ - struct colorentry *colorentry; - - /* Layout downfactor, layout upfactor, layout nearfactor The layout - algorithm partitions the set of edges into edges pointing upward, - edges pointing downward, and edges pointing sidewards. The last type - of edges is also called near edges. If the layout.downfactor is - large compared to the layout.upfactor and the layout.nearfactor, - then the positions of the nodes is mainly determined by the edges - pointing downwards. If the layout.upfactor is large compared to the - layout.downfactor and the layout.nearfactor, then the positions of - the nodes is mainly determined by the edges pointing upwards. If the - layout.nearfactor is large, then the positions of the nodes is - mainly determined by the edges pointing sidewards. These attributes - have no effect, if the method for downward laid out trees is used. - Default is normal. */ - int layout_downfactor; - int layout_upfactor; - int layout_nearfactor; - /* Layout splinefactor determines the bending at splines. The factor - 100 indicates a very sharp bending, a factor 1 indicates a very flat - bending. Useful values are 30 : : : 80. */ - int layout_splinefactor; - - /* Late edge labels yes means that the graph is first partitioned and - then, labels are introduced. The default algorithm first creates - labels and then partitions the graph, which yield a more compact - layout, but may have more crossings. - Default is no. */ - enum decision late_edge_labels; - - /* Display edge labels yes means display labels and no means don't - display edge labels. - Default vaule is no. */ - enum decision display_edge_labels; - - /* Dirty edge labels yes enforces a fast layout of edge labels, which - may very ugly because several labels may be drawn at the same place. - Dirty edge labels cannot be used if splines are used. - Default is no. - */ - enum decision dirty_edge_labels; - - /* Finetuning no switches the fine tuning phase of the graph layout - algorithm off, while it is on as default. The fine tuning phase - tries to give all edges the same length. - Default is yes. */ - enum decision finetuning; - - /* Ignore singles yes hides all nodes which would appear single and - unconnected from the remaining graph. Such nodes have no edge at all - and are sometimes very ugly. Default is to show all nodes. - Default is no. */ - enum decision ignore_singles; - - /* priority phase yes replaces the normal pendulum method by a - specialized method: It forces straight long edges with 90 degree, - just as the straight phase. In fact, the straight phase is a fine - tune phase of the priority method. This phase is also recommended, - if an orthogonal layout is selected (see manhattan.edges). - Default is no. */ - enum decision priority_phase; - - /* manhattan edges yes switches the orthogonal layout on. Orthogonal - layout (or manhattan layout) means that all edges consist of line - segments with gradient 0 or 90 degree. Vertical edge segments might - by shared by several edges, while horizontal edge segments are never - shared. This results in very aesthetical layouts just for flowcharts. - If the orthogonal layout is used, then the priority phase and - straight phase should be used. Thus, these both phases are switched - on, too, unless priority layout and straight line tuning are - switched off explicitly. - Default is no. */ - enum decision manhattan_edges; - - /* Smanhattan edges yes switches a specialized orthogonal layout on: - Here, all horizontal edge segments between two levels share the same - horizontal line, i.e. not only vertical edge segments are shared, - but horizontal edge segments are shared by several edges, too. This - looks nice for trees but might be too confusing in general, because - the location of an edge might be ambiguously. - Default is no. */ - enum decision smanhattan_edges; - - /* Near edges no suppresses near edges and bent near edges in the - graph layout. - Default is yes. */ - enum decision near_edges; - - /* Orientation specifies the orientation of the graph: top.to.bottom, - bottom.to.top, left.to.right or right.to.left. Note: the normal - orientation is top.to.bottom. All explanations here are given - relatively to the normal orientation, i.e., e.g., if the orientation - is left to right, the attribute xlspace is not the horizontal but - the vertical distance between lines, etc. - Default is to_to_bottom. */ - enum orientation orientation; - - /* Node alignment specified the vertical alignment of nodes at the - horizontal reference line of the levels. If top is specified, the - tops of all nodes of a level have the same y-coordinate; on bottom, - the bottoms have the same y-coordinate, on center the nodes are - centered at the levels. - Default is center. */ - enum alignment node_alignment; - - /* Port sharing no suppresses the sharing of ports of edges at the - nodes. Normally, if multiple edges are adjacent to the same node, - and the arrow head of all these edges has the same visual appearance - (color, size, etc.), then these edges may share a port at a node, - i.e. only one arrow head is draw, and all edges are incoming into - this arrow head. This allows to have many edges adjacent to one node - without getting confused by too many arrow heads. If no port sharing - is used, each edge has its own port, i.e. its own place where it is - adjacent to the node. - Default is yes. */ - enum decision port_sharing; - - /* Arrow mode fixed (default) should be used, if port sharing is used, - because then, only a fixed set of rotations for the arrow heads are - used. If the arrow mode is free, then each arrow head is rotated - individually to each edge. But this can yield to a black spot, where - nothing is recognizable, if port sharing is used, since all these - qdifferently rotated arrow heads are drawn at the same place. If the - arrow mode is fixed, then the arrow head is rotated only in steps of - 45 degree, and only one arrow head occurs at each port. - Default is fixed. */ - enum arrow_mode arrow_mode; - - /* Treefactor The algorithm tree for downward laid out trees tries to - produce a medium dense, balanced tree-like layout. If the tree - factor is greater than 0.5, the tree edges are spread, i.e. they - get a larger gradient. This may improve the readability of the tree. - Note: it is not obvious whether spreading results in a more dense or - wide layout. For a tree, there is a tree factor such that the whole - tree is minimal wide. - Default is 0.5. */ - float treefactor; - - /* Spreadlevel This parameter only influences the algorithm tree, too. - For large, balanced trees, spreading of the uppermost nodes would - enlarge the width of the tree too much, such that the tree does not - fit anymore in a window. Thus, the spreadlevel specifies the minimal - level (rank) where nodes are spread. Nodes of levels upper than - spreadlevel are not spread. - Default is 1. */ - int spreadlevel; - - /* Crossing weight specifies the weight that is used for the crossing - reduction: bary (default), median, barymedian or medianbary. We - cannot give a general recommendation, which is the best method. For - graphs with very large average degree of edges (number of incoming - and outgoing edges at a node), the weight bary is the fastest - method. With the weights barymedian and medianbary, equal weights of - different nodes are not very probable, thus the crossing reduction - phase 2 might be very fast. - Default is bary. */ - enum crossing_type crossing_weight; - - /* Crossing phase2 is the most time consuming phase of the crossing - reduction. In this phase, the nodes that happen to have equal - crossing weights are permuted. By specifying no, this phase is - suppressed. - Default is yes. */ - enum decision crossing_phase2; - - /* Crossing optimization is a postprocessing phase after the normal - crossing reduction: we try to optimize locally, by exchanging pairs - of nodes to reduce the crossings. Although this phase is not very - time consuming, it can be suppressed by specifying no. - Default is yes. */ - enum decision crossing_optimization; - - /* View allows to select the fisheye views. Because - of the fixed size of the window that shows the graph, we normally - can only see a small amount of a large graph. If we shrink the graph - such that it fits into the window, we cannot recognize any detail - anymore. Fisheye views are coordinate transformations: the view onto - the graph is distort, to overcome this usage deficiency. The polar - fisheye is easy to explain: assume a projection of the plane that - contains the graph picture onto a spheric ball. If we now look onto - this ball in 3 D, we have a polar fisheye view. There is a focus - point which is magnified such that we see all details. Parts of the - plane that are far away from the focus point are demagnified very - much. Cartesian fisheye have a similar effect; only the formula for - the coordinate transformation is different. Selecting cfish means - the cartesian fisheye is used which demagnifies such that the whole - graph is visible (self adaptable cartesian fisheye). With fcfish, - the cartesian fisheye shows the region of a fixed radius around the - focus point (fixed radius cartesian fisheye). This region might be - smaller than the whole graph, but the demagnification needed to show - this region in the window is also not so large, thus more details - are recognizable. With pfish the self adaptable polar fisheye is - selected that shows the whole graph, and with fpfish the fixed - radius polar fisheye is selected. - Default is normal view. */ - enum view view; - - /* Edges no suppresses the drawing of edges. - Default is yes. */ - enum decision edges; - - /* Nodes no suppresses the drawing of nodes. - Default is yes. */ - enum decision nodes; - - /* Splines specifies whether splines are used to draw edges (yes or no). - As default, polygon segments are used to draw edges, because this is - much faster. Note that the spline drawing routine is not fully - validated, and is very slow. Its use is mainly to prepare high - quality PostScript output for very small graphs. - Default is no. */ - enum decision splines; - - /* Bmax set the maximal number of iterations that are done for the - reduction of edge bendings. - Default is 100. */ - int bmax; - - /* Cmin set the minimal number of iterations that are done for the - crossing reduction with the crossing weights. The normal method - stops if two consecutive checks does not reduce the number of - crossings anymore. However, this increasing of the number of - crossings might be locally, such that after some more iterations, - the crossing number might decrease much more. - Default is 0. */ - int cmin; - - /* Cmax set the maximal number of interactions for crossing reduction. - This is helpful for speeding up the layout process. - Default is -1, which represents infinity. */ - int cmax; - - /* Pmin set the minimal number of iterations that is done with the - pendulum method. Similar to the crossing reduction, this method - stops if the `imbalancement weight' does not decreases anymore. - However, the increasing of the imbalancement weight might be locally, - such that after some more iterations, the imbalancement weight might - decrease much more. - Default is 0. */ - int pmin; - - /* Pmax set the maximal number of iterations of the pendulum method. - This is helpful for speedup the layout process. - Default is 100. */ - int pmax; - - /* Rmin set the minimal number of iterations that is done with the - rubberband method. This is similar as for the pendulum method. - Default is 0. */ - int rmin; - - /* Rmax set the maximal number of iterations of the rubberband method. - This is helpful for speedup the layout process. - Default is 100. */ - int rmax; - - /* Smax set the maximal number of iterations of the straight line - recognition phase (useful only, if the straight line recognition - phase is switched on, see attribute straight.phase). - Default is 100. */ - int smax; - - /* Generic values. - */ - node node; - edge edge; - - /* List of nodes declared. - Pointer. */ - node *node_list; - - /* List of edges declared. - Pointer. */ - edge *edge_list; - -}; - -/* Graph typedefs. */ -typedef struct graph graph; - -void new_graph (graph *g); -void new_node (node *n); -void new_edge (edge *e); - -void add_node (graph *g, node *n); -void add_edge (graph *g, edge *e); - -void add_colorentry (graph *g, int color_idx, int red_cp, - int green_cp, int blue_cp); -void add_classname (graph *g, int val, const char *name); -void add_infoname (graph *g, int val, const char *name); - -void open_node (FILE *fout); -void output_node (node *n, FILE *fout); -void close_node (FILE *fout); - -void open_edge (edge *e, FILE *fout); -void output_edge (edge *e, FILE *fout); -void close_edge (FILE *fout); - -void open_graph (FILE *fout); -void output_graph (graph *g, FILE *fout); -void close_graph (graph *g, FILE *fout); - -#endif /* VCG_H_ */ diff --git a/src/bin/bison/src/vcg_defaults.h b/src/bin/bison/src/vcg_defaults.h deleted file mode 100644 index 78e24b5c79..0000000000 --- a/src/bin/bison/src/vcg_defaults.h +++ /dev/null @@ -1,181 +0,0 @@ -/* VCG description handler for Bison. - - Copyright (C) 2001, 2002, 2005 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 VCG_DEFAULTS_H_ -# define VCG_DEFAULTS_H_ - -/* Graph defaults. */ -# define G_TITLE NULL -# define G_LABEL NULL -# define G_INFOS1 NULL -# define G_INFOS2 NULL -# define G_INFOS3 NULL - -# define G_COLOR white -# define G_TEXTCOLOR black -# define G_BORDERCOLOR G_TEXTCOLOR - -# define G_WIDTH 100 -# define G_HEIGHT 100 -# define G_BORDERWIDTH 2 - -# define G_X 0 -# define G_Y 0 - -# define G_FOLDING 0 - -# define G_SHRINK 1 -# define G_STRETCH 1 - -# define G_TEXTMODE centered -# define G_SHAPE box - -# define G_VERTICAL_ORDER 0 /* Unspecified for subgraphs. */ -# define G_HORIZONTAL_ORDER 0 /* Unspecified for subgraphs. */ - -# define G_XMAX 90 /* Not output. */ -# define G_YMAX 90 /* Not output. */ - -# define G_XBASE 5 -# define G_YBASE 5 - -# define G_XSPACE 20 -# define G_YSPACE 70 -# define G_XLSPACE (G_XSPACE / 2) /* Not output */ - -# define G_XRASTER 1 -# define G_YRASTER 1 -# define G_XLRASTER 1 - -# define G_HIDDEN (-1) /* No default value. */ - -# define G_CLASSNAME NULL /* No class name association. */ -# define G_INFONAME NULL -# define G_COLORENTRY NULL - -# define G_LAYOUTALGORITHM normal -# define G_LAYOUT_DOWNFACTOR 1 -# define G_LAYOUT_UPFACTOR 1 -# define G_LAYOUT_NEARFACTOR 1 -# define G_LAYOUT_SPLINEFACTOR 70 - -# define G_LATE_EDGE_LABELS no -# define G_DISPLAY_EDGE_LABELS no -# define G_DIRTY_EDGE_LABELS no -# define G_FINETUNING yes -# define G_IGNORE_SINGLES no -# define G_LONG_STRAIGHT_PHASE no -# define G_PRIORITY_PHASE no -# define G_MANHATTAN_EDGES no -# define G_SMANHATTAN_EDGES no -# define G_NEAR_EDGES yes - -# define G_ORIENTATION top_to_bottom -# define G_NODE_ALIGNMENT center -# define G_PORT_SHARING yes -# define G_ARROW_MODE fixed -# define G_TREEFACTOR 0.5 -# define G_SPREADLEVEL 1 -# define G_CROSSING_WEIGHT bary -# define G_CROSSING_PHASE2 yes -# define G_CROSSING_OPTIMIZATION yes -# define G_VIEW normal_view - -# define G_EDGES yes -# define G_NODES yes -# define G_SPLINES no - -# define G_BMAX 100 -# define G_CMIN 0 -# define G_CMAX (-1) /* Infinity */ -# define G_PMIN 0 -# define G_PMAX 100 -# define G_RMIN 0 -# define G_RMAX 100 -# define G_SMAX 100 - -# define G_NODE_LIST NULL -# define G_EDGE_LIST NULL - -/* Nodes defaults. */ -# define N_TITLE NULL -# define N_LABEL NULL - -# define N_LOCX (-1) /* Default unspcified */ -# define N_LOCY (-1) /* Default unspcified */ - -# define N_VERTICAL_ORDER (-1) /* Default unspcified */ -# define N_HORIZONTAL_ORDER (-1) /* Default unspcified */ - -# define N_WIDTH (-1) /* We assume that we can't define it now. */ -# define N_HEIGHT (-1) /* also. */ - -# define N_SHRINK 1 -# define N_STRETCH 1 - -# define N_FOLDING (-1) /* no explicit default value. */ - -# define N_SHAPE box -# define N_TEXTMODE centered -# define N_BORDERWIDTH 2 - -# define N_COLOR white -# define N_TEXTCOLOR black -# define N_BORDERCOLOR N_TEXTCOLOR - -# define N_INFOS1 NULL -# define N_INFOS2 NULL -# define N_INFOS3 NULL - -# define N_NEXT NULL - -/* Edge defaults. */ -# define E_EDGE_TYPE normal_edge - -# define E_SOURCENAME NULL /* Mandatory. */ -# define E_TARGETNAME NULL /* Mandatory. */ -# define E_LABEL NULL - -# define E_LINESTYLE continuous -# define E_THICKNESS 2 - -# define E_CLASS 1 - -# define E_COLOR black -# define E_TEXTCOLOR E_COLOR -# define E_ARROWCOLOR E_COLOR -# define E_BACKARROWCOLOR E_COLOR - -# define E_ARROWSIZE 10 -# define E_BACKARROWSIZE 0 - -# define E_ARROWSTYLE solid -# define E_BACKARROWSTYLE none - -# define E_PRIORITY 1 - -# define E_ANCHOR (-1) - -# define E_HORIZONTAL_ORDER (-1) - -# define E_NEXT NULL - -#endif /* not VCG_DEFAULTS_H_ */ diff --git a/src/bin/flex/ABOUT-NLS b/src/bin/flex/ABOUT-NLS deleted file mode 100644 index 47d5e39f0e..0000000000 --- a/src/bin/flex/ABOUT-NLS +++ /dev/null @@ -1,625 +0,0 @@ -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 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 at translations should 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. - -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'. - -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 GNU `gettext' own -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 be not what is 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 have usually 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. - -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 country 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'. - - 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. - -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. - -Available Packages -================== - - Languages are not equally supported in all packages. The following -matrix shows the current state of internationalization, as of May 2003. -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 am az be bg ca cs da de el en en_GB eo es - +-------------------------------------------+ - a2ps | [] [] [] [] | - aegis | () | - anubis | | - ap-utils | | - bash | [] [] [] | - batchelor | | - bfd | [] [] | - binutils | [] [] | - bison | [] [] [] | - bluez-pin | [] [] | - clisp | | - clisp | [] [] [] | - coreutils | [] [] [] [] | - cpio | [] [] [] | - darkstat | () [] | - diffutils | [] [] [] [] [] [] [] | - e2fsprogs | [] [] | - enscript | [] [] [] [] | - error | [] [] [] [] [] | - fetchmail | [] () [] [] [] [] | - fileutils | [] [] [] | - findutils | [] [] [] [] [] [] | - flex | [] [] [] [] | - gas | [] | - gawk | [] [] [] [] | - gcal | [] | - gcc | [] [] | - gettext | [] [] [] [] [] | - gettext-runtime | [] [] [] [] [] | - gettext-tools | [] [] | - gimp-print | [] [] [] [] [] | - gliv | | - glunarclock | [] [] [] | - gnucash | () [] | - gnucash-glossary | [] () [] | - gnupg | [] () [] [] [] [] | - gpe-calendar | [] | - gpe-conf | [] | - gpe-contacts | [] | - gpe-edit | | - gpe-login | [] | - gpe-ownerinfo | [] | - gpe-sketchbook | [] | - gpe-timesheet | | - gpe-today | [] | - gpe-todo | [] | - gphoto2 | [] [] [] [] | - gprof | [] [] | - gpsdrive | () () () | - grep | [] [] [] [] [] | - gretl | [] | - hello | [] [] [] [] [] [] | - id-utils | [] [] | - indent | [] [] [] [] | - jpilot | [] [] [] [] | - jwhois | [] | - kbd | [] [] [] [] [] | - ld | [] [] | - libc | [] [] [] [] [] [] | - libgpewidget | [] | - libiconv | [] [] [] [] [] | - lifelines | [] () | - lilypond | [] | - lingoteach | | - lingoteach_lessons | () () | - lynx | [] [] [] [] | - m4 | [] [] [] [] | - mailutils | [] [] | - make | [] [] [] | - man-db | [] () [] [] () | - mysecretdiary | [] [] [] | - nano | [] () [] [] [] | - nano_1_0 | [] () [] [] [] | - opcodes | [] [] | - parted | [] [] [] [] [] | - ptx | [] [] [] [] [] | - python | | - radius | | - recode | [] [] [] [] [] [] | - screem | | - sed | [] [] [] [] [] | - sh-utils | [] [] [] | - sharutils | [] [] [] [] [] [] | - sketch | [] () [] | - soundtracker | [] [] [] | - sp | [] | - tar | [] [] [] [] | - texinfo | [] [] [] [] | - textutils | [] [] [] [] | - tin | () () | - util-linux | [] [] [] [] [] | - vorbis-tools | [] [] [] | - wastesedge | () | - wdiff | [] [] [] [] | - wget | [] [] [] [] [] [] [] | - xchat | [] [] [] | - xpad | | - +-------------------------------------------+ - am az be bg ca cs da de el en en_GB eo es - 0 1 4 2 31 17 54 60 14 1 4 12 56 - - et fa fi fr ga gl he hr hu id it ja ko - +----------------------------------------+ - a2ps | [] [] [] () () | - aegis | | - anubis | [] | - ap-utils | [] | - bash | [] [] | - batchelor | [] | - bfd | [] [] | - binutils | [] [] | - bison | [] [] [] [] | - bluez-pin | [] [] [] [] | - clisp | | - clisp | [] | - coreutils | [] [] [] [] | - cpio | [] [] [] [] | - darkstat | () [] [] [] | - diffutils | [] [] [] [] [] [] [] | - e2fsprogs | | - enscript | [] [] | - error | [] [] [] [] | - fetchmail | [] | - fileutils | [] [] [] [] [] | - findutils | [] [] [] [] [] [] [] [] [] [] [] | - flex | [] [] | - gas | [] | - gawk | [] [] | - gcal | [] | - gcc | [] | - gettext | [] [] [] | - gettext-runtime | [] [] [] [] | - gettext-tools | [] | - gimp-print | [] [] | - gliv | () | - glunarclock | [] [] [] [] | - gnucash | [] | - gnucash-glossary | [] | - gnupg | [] [] [] [] [] [] [] | - gpe-calendar | [] | - gpe-conf | | - gpe-contacts | [] | - gpe-edit | [] [] | - gpe-login | [] | - gpe-ownerinfo | [] [] [] | - gpe-sketchbook | [] | - gpe-timesheet | [] [] [] | - gpe-today | [] [] | - gpe-todo | [] [] | - gphoto2 | [] [] [] | - gprof | [] [] | - gpsdrive | () [] () () | - grep | [] [] [] [] [] [] [] [] [] [] [] | - gretl | [] | - hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | - id-utils | [] [] [] | - indent | [] [] [] [] [] [] [] [] | - jpilot | [] () | - jwhois | [] [] [] [] | - kbd | [] | - ld | [] | - libc | [] [] [] [] [] [] | - libgpewidget | [] [] [] | - libiconv | [] [] [] [] [] [] [] [] | - lifelines | () | - lilypond | [] | - lingoteach | [] [] | - lingoteach_lessons | | - lynx | [] [] [] [] | - m4 | [] [] [] [] | - mailutils | | - make | [] [] [] [] [] [] | - man-db | [] () () | - mysecretdiary | [] [] | - nano | [] [] [] [] | - nano_1_0 | [] [] [] [] | - opcodes | [] [] | - parted | [] [] [] | - ptx | [] [] [] [] [] [] [] | - python | | - radius | | - recode | [] [] [] [] [] [] | - screem | | - sed | [] [] [] [] [] [] [] [] | - sh-utils | [] [] [] [] [] [] | - sharutils | [] [] [] [] [] | - sketch | [] | - soundtracker | [] [] [] | - sp | [] () | - tar | [] [] [] [] [] [] [] [] [] | - texinfo | [] [] [] [] | - textutils | [] [] [] [] [] | - tin | [] () | - util-linux | [] [] [] [] () [] | - vorbis-tools | [] | - wastesedge | () | - wdiff | [] [] [] [] [] | - wget | [] [] [] [] [] [] [] [] | - xchat | [] [] [] | - xpad | | - +----------------------------------------+ - et fa fi fr ga gl he hr hu id it ja ko - 20 1 15 73 14 24 8 10 30 31 19 31 9 - - lg lt lv ms nb nl nn no pl pt pt_BR ro - +----------------------------------------+ - a2ps | [] [] () () () [] [] | - aegis | () | - anubis | [] [] | - ap-utils | () | - bash | [] | - batchelor | | - bfd | | - binutils | | - bison | [] [] [] [] | - bluez-pin | [] | - clisp | | - clisp | [] | - coreutils | [] | - cpio | [] [] [] | - darkstat | [] [] [] [] | - diffutils | [] [] [] | - e2fsprogs | | - enscript | [] [] | - error | [] [] | - fetchmail | () () | - fileutils | [] | - findutils | [] [] [] [] | - flex | [] | - gas | | - gawk | [] | - gcal | | - gcc | | - gettext | [] | - gettext-runtime | [] | - gettext-tools | | - gimp-print | [] | - gliv | [] | - glunarclock | [] | - gnucash | | - gnucash-glossary | [] [] | - gnupg | | - gpe-calendar | [] [] | - gpe-conf | [] [] | - gpe-contacts | [] | - gpe-edit | [] [] | - gpe-login | [] [] | - gpe-ownerinfo | [] [] | - gpe-sketchbook | [] [] | - gpe-timesheet | [] [] | - gpe-today | [] [] | - gpe-todo | [] [] | - gphoto2 | | - gprof | [] | - gpsdrive | () () () | - grep | [] [] [] [] | - gretl | | - hello | [] [] [] [] [] [] [] [] [] | - id-utils | [] [] [] | - indent | [] [] [] | - jpilot | () () | - jwhois | [] [] [] | - kbd | | - ld | | - libc | [] [] [] [] | - libgpewidget | [] [] | - libiconv | [] [] | - lifelines | | - lilypond | [] | - lingoteach | | - lingoteach_lessons | | - lynx | [] [] | - m4 | [] [] [] [] | - mailutils | | - make | [] [] | - man-db | [] | - mysecretdiary | [] | - nano | [] [] [] [] | - nano_1_0 | [] [] [] [] | - opcodes | [] [] [] | - parted | [] [] [] | - ptx | [] [] [] [] [] [] [] | - python | | - radius | | - recode | [] [] [] | - screem | | - sed | [] [] | - sh-utils | [] | - sharutils | [] | - sketch | [] | - soundtracker | | - sp | | - tar | [] [] [] [] [] [] | - texinfo | [] | - textutils | [] | - tin | | - util-linux | [] [] | - vorbis-tools | [] [] | - wastesedge | | - wdiff | [] [] [] [] | - wget | [] [] [] | - xchat | [] [] | - xpad | [] | - +----------------------------------------+ - lg lt lv ms nb nl nn no pl pt pt_BR ro - 0 0 2 11 7 26 3 4 18 15 34 34 - - ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW - +-------------------------------------------+ - a2ps | [] [] [] [] [] | 16 - aegis | () | 0 - anubis | [] [] | 5 - ap-utils | () | 1 - bash | [] | 7 - batchelor | | 1 - bfd | [] [] [] | 7 - binutils | [] [] [] | 7 - bison | [] [] | 13 - bluez-pin | | 7 - clisp | | 0 - clisp | | 5 - coreutils | [] [] [] [] [] | 14 - cpio | [] [] [] | 13 - darkstat | [] () () | 9 - diffutils | [] [] [] [] | 21 - e2fsprogs | [] | 3 - enscript | [] [] [] | 11 - error | [] [] [] | 14 - fetchmail | [] | 7 - fileutils | [] [] [] [] [] [] | 15 - findutils | [] [] [] [] [] [] | 27 - flex | [] [] [] | 10 - gas | [] | 3 - gawk | [] [] | 9 - gcal | [] [] | 4 - gcc | [] | 4 - gettext | [] [] [] [] [] [] | 15 - gettext-runtime | [] [] [] [] [] [] | 16 - gettext-tools | [] [] | 5 - gimp-print | [] [] | 10 - gliv | | 1 - glunarclock | [] [] [] | 11 - gnucash | [] [] | 4 - gnucash-glossary | [] [] [] | 8 - gnupg | [] [] [] [] | 16 - gpe-calendar | [] | 5 - gpe-conf | | 3 - gpe-contacts | [] | 4 - gpe-edit | [] | 5 - gpe-login | [] | 5 - gpe-ownerinfo | [] | 7 - gpe-sketchbook | [] | 5 - gpe-timesheet | [] | 6 - gpe-today | [] | 6 - gpe-todo | [] | 6 - gphoto2 | [] [] | 9 - gprof | [] [] | 7 - gpsdrive | [] [] | 3 - grep | [] [] [] [] | 24 - gretl | | 2 - hello | [] [] [] [] [] | 33 - id-utils | [] [] [] | 11 - indent | [] [] [] [] | 19 - jpilot | [] [] [] [] [] | 10 - jwhois | () () [] [] | 10 - kbd | [] [] | 8 - ld | [] [] | 5 - libc | [] [] [] [] | 20 - libgpewidget | | 6 - libiconv | [] [] [] [] [] [] | 21 - lifelines | [] | 2 - lilypond | [] | 4 - lingoteach | | 2 - lingoteach_lessons | () | 0 - lynx | [] [] [] [] | 14 - m4 | [] [] [] | 15 - mailutils | | 2 - make | [] [] [] [] | 15 - man-db | [] | 6 - mysecretdiary | [] [] | 8 - nano | [] [] [] | 15 - nano_1_0 | [] [] [] | 15 - opcodes | [] [] | 9 - parted | [] [] | 13 - ptx | [] [] [] | 22 - python | | 0 - radius | | 0 - recode | [] [] [] [] | 19 - screem | [] | 1 - sed | [] [] [] [] [] | 20 - sh-utils | [] [] [] | 13 - sharutils | [] [] [] [] | 16 - sketch | [] | 5 - soundtracker | [] | 7 - sp | [] | 3 - tar | [] [] [] [] [] | 24 - texinfo | [] [] [] [] | 13 - textutils | [] [] [] [] [] | 15 - tin | | 1 - util-linux | [] [] | 14 - vorbis-tools | [] | 7 - wastesedge | | 0 - wdiff | [] [] [] [] | 17 - wget | [] [] [] [] [] [] [] | 25 - xchat | [] [] [] | 11 - xpad | | 1 - +-------------------------------------------+ - 50 teams ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW - 97 domains 32 19 16 0 56 0 48 10 1 1 12 23 913 - - 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 May 2003 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'. - -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/src/bin/flex/AUTHORS b/src/bin/flex/AUTHORS deleted file mode 100644 index ed510d04c3..0000000000 --- a/src/bin/flex/AUTHORS +++ /dev/null @@ -1,13 +0,0 @@ -Vern Paxson wrote flex with the help of many ideas and much -inspiration from Van Jacobson. Original version by Jef Poskanzer. - -The fast table representation is a partial implementation of a design -done by Van Jacobson. The implementation was done by Kevin Gong and -Vern Paxson. - -In 2001, W. L. Estes took over as maintainer of flex. - -John Millaway is a co-author of the current version of flex. He has -contributed a large number of new features, fixed a large number of -outstanding bugs and has made significant contributions to the flex -documentation. diff --git a/src/bin/flex/COPYING b/src/bin/flex/COPYING deleted file mode 100644 index 51a3636e9f..0000000000 --- a/src/bin/flex/COPYING +++ /dev/null @@ -1,42 +0,0 @@ -Flex carries the copyright used for BSD software, slightly modified -because it originated at the Lawrence Berkeley (not Livermore!) Laboratory, -which operates under a contract with the Department of Energy: - -Copyright (c) 2001 by W. L. Estes - -Copyright (c) 1990, 1997 The Regents of the University of California. -All rights reserved. - -This code is derived from software contributed to Berkeley by -Vern Paxson. - -The United States Government has rights in this work pursuant -to contract no. DE-AC03-76SF00098 between the United States -Department of Energy and the University of California. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -Neither the name of the University nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. - -This basically says "do whatever you please with this software except -remove this notice or take advantage of the University's (or the flex -authors') name". - -Note that the "flex.skl" scanner skeleton carries no copyright notice. -You are free to do whatever you please with scanners generated using flex; -for them, you are not even bound by the above copyright. diff --git a/src/bin/flex/ChangeLog b/src/bin/flex/ChangeLog deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/bin/flex/FlexLexer.h b/src/bin/flex/FlexLexer.h deleted file mode 100644 index 3a1025cf39..0000000000 --- a/src/bin/flex/FlexLexer.h +++ /dev/null @@ -1,204 +0,0 @@ -// -*-C++-*- -// FlexLexer.h -- define interfaces for lexical analyzer classes generated -// by flex - -// Copyright (c) 1993 The Regents of the University of California. -// All rights reserved. -// -// This code is derived from software contributed to Berkeley by -// Kent Williams and Tom Epperly. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: - -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. - -// Neither the name of the University nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. - -// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE. - -// This file defines FlexLexer, an abstract class which specifies the -// external interface provided to flex C++ lexer objects, and yyFlexLexer, -// which defines a particular lexer class. -// -// If you want to create multiple lexer classes, you use the -P flag -// to rename each yyFlexLexer to some other xxFlexLexer. You then -// include in your other sources once per lexer class: -// -// #undef yyFlexLexer -// #define yyFlexLexer xxFlexLexer -// #include -// -// #undef yyFlexLexer -// #define yyFlexLexer zzFlexLexer -// #include -// ... - -#ifndef __FLEX_LEXER_H -// Never included before - need to define base class. -#define __FLEX_LEXER_H - -#include -# ifndef FLEX_STD -# define FLEX_STD std:: -# endif - -extern "C++" { - -struct yy_buffer_state; -typedef int yy_state_type; - -class FlexLexer { -public: - virtual ~FlexLexer() { } - - const char* YYText() { return yytext; } - int YYLeng() { return yyleng; } - - virtual void - yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0; - virtual struct yy_buffer_state* - yy_create_buffer( FLEX_STD istream* s, int size ) = 0; - virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0; - virtual void yyrestart( FLEX_STD istream* s ) = 0; - - virtual int yylex() = 0; - - // Call yylex with new input/output sources. - int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 ) - { - switch_streams( new_in, new_out ); - return yylex(); - } - - // Switch to new input/output streams. A nil stream pointer - // indicates "keep the current one". - virtual void switch_streams( FLEX_STD istream* new_in = 0, - FLEX_STD ostream* new_out = 0 ) = 0; - - int lineno() const { return yylineno; } - - int debug() const { return yy_flex_debug; } - void set_debug( int flag ) { yy_flex_debug = flag; } - -protected: - char* yytext; - int yyleng; - int yylineno; // only maintained if you use %option yylineno - int yy_flex_debug; // only has effect with -d or "%option debug" -}; - -} -#endif - -#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce) -// Either this is the first time through (yyFlexLexerOnce not defined), -// or this is a repeated include to define a different flavor of -// yyFlexLexer, as discussed in the flex man page. -#define yyFlexLexerOnce - -extern "C++" { - -class yyFlexLexer : public FlexLexer { -public: - // arg_yyin and arg_yyout default to the cin and cout, but we - // only make that assignment when initializing in yylex(). - yyFlexLexer( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 ); - - virtual ~yyFlexLexer(); - - void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ); - struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size ); - void yy_delete_buffer( struct yy_buffer_state* b ); - void yyrestart( FLEX_STD istream* s ); - - void yypush_buffer_state( struct yy_buffer_state* new_buffer ); - void yypop_buffer_state(void); - - virtual int yylex(); - virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out ); - -protected: - virtual int LexerInput( char* buf, int max_size ); - virtual void LexerOutput( const char* buf, int size ); - virtual void LexerError( const char* msg ); - - void yyunput( int c, char* buf_ptr ); - int yyinput(); - - void yy_load_buffer_state(); - void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream* s ); - void yy_flush_buffer( struct yy_buffer_state* b ); - - int yy_start_stack_ptr; - int yy_start_stack_depth; - int* yy_start_stack; - - void yy_push_state( int new_state ); - void yy_pop_state(); - int yy_top_state(); - - yy_state_type yy_get_previous_state(); - yy_state_type yy_try_NUL_trans( yy_state_type current_state ); - int yy_get_next_buffer(); - - FLEX_STD istream* yyin; // input source for default LexerInput - FLEX_STD ostream* yyout; // output sink for default LexerOutput - - // yy_hold_char holds the character lost when yytext is formed. - char yy_hold_char; - - // Number of characters read into yy_ch_buf. - int yy_n_chars; - - // Points to current character in buffer. - char* yy_c_buf_p; - - int yy_init; // whether we need to initialize - int yy_start; // 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 ... - int yy_did_buffer_switch_on_eof; - - - size_t yy_buffer_stack_top; /**< index of top of stack. */ - size_t yy_buffer_stack_max; /**< capacity of stack. */ - struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */ - void yyensure_buffer_stack(void); - - // The following are not always needed, but may be depending - // on use of certain flex features (like REJECT or yymore()). - - yy_state_type yy_last_accepting_state; - char* yy_last_accepting_cpos; - - yy_state_type* yy_state_buf; - yy_state_type* yy_state_ptr; - - char* yy_full_match; - int* yy_full_state; - int yy_full_lp; - - int yy_lp; - int yy_looking_for_trail_begin; - - int yy_more_flag; - int yy_more_len; - int yy_more_offset; - int yy_prev_more_offset; -}; - -} - -#endif diff --git a/src/bin/flex/INSTALL b/src/bin/flex/INSTALL deleted file mode 100644 index 54caf7c190..0000000000 --- a/src/bin/flex/INSTALL +++ /dev/null @@ -1,229 +0,0 @@ -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software -Foundation, Inc. - - This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - - These are generic installation instructions. - - 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 only 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. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. 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. - -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=c89 CFLAGS=-O2 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 must use a version of `make' that -supports the `VPATH' variable, such as 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 `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have 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. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' 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. - -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 `--target=TYPE' option 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 - -will cause the specified gcc to be used as the C compiler (unless it is -overridden in the site shell script). - -`configure' Invocation -====================== - - `configure' recognizes the following options to control how it -operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--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. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/src/bin/flex/Jamfile b/src/bin/flex/Jamfile deleted file mode 100644 index 58bd23ef61..0000000000 --- a/src/bin/flex/Jamfile +++ /dev/null @@ -1,29 +0,0 @@ -SubDir HAIKU_TOP src bin flex ; - -SubDirCcFlags -DHAVE_CONFIG_H ; - -SUBDIRYACCFLAGS += d ; - -BinCommand flex : - ccl.c - dfa.c - ecs.c - gen.c - main.c - misc.c - nfa.c - parse.y - scan.l - skel.c - sym.c - tblcmp.c - yylex.c - options.c - scanopt.c - buf.c - tables.c - tables_shared.c - filter.c - regex.c - : - : flex.rdef ; diff --git a/src/bin/flex/Makefile.am b/src/bin/flex/Makefile.am deleted file mode 100644 index 4d419a1ca6..0000000000 --- a/src/bin/flex/Makefile.am +++ /dev/null @@ -1,229 +0,0 @@ -# This file is part of flex. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: - -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. - -# Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. - -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE. - -# Notes on building: - -# Possible values for DEFS: -# -# By default, flex generates 8-bit scanners when using table compression, -# and 7-bit scanners when using uncompressed tables (-f or -F options). -# For flex to always generate 8-bit scanners, add "-DDEFAULT_CSIZE=256" -# to DEFS. -# -# For Vax/VMS, add "-DVMS" to DEFS. -# -# For MS-DOS, add "-DMS_DOS" to DEFS. See the directory MISC/MSDOS for -# additional info. - -AM_YFLAGS = -d -ACLOCAL_AMFLAGS = -I m4 -m4 = @M4@ -indent = @INDENT@ - -AUTOMAKE_OPTIONS = \ - gnits \ - check-news \ - dist-bzip2 \ - 1.7 - -bin_PROGRAMS = flex -lib_LIBRARIES = libfl.a - -flex_SOURCES = \ - ccl.c \ - dfa.c \ - ecs.c \ - gen.c \ - main.c \ - misc.c \ - nfa.c \ - parse.y \ - scan.l \ - skel.c \ - sym.c \ - tblcmp.c \ - yylex.c \ - options.c \ - scanopt.c \ - buf.c \ - tables.c \ - tables_shared.c \ - filter.c \ - regex.c - -libfl_a_SOURCES = \ - libmain.c \ - libyywrap.c - -noinst_HEADERS = \ - flexdef.h \ - flexint.h \ - version.h \ - options.h \ - scanopt.h \ - tables.h \ - tables_shared.h - -include_HEADERS = \ - FlexLexer.h - -MAINTAINERCLEANFILES = \ - ABOUT-NLS \ - config.rpath \ - config.sub \ - config.guess \ - configure \ - config.sub \ - config.guess \ - depcomp \ - mkinstalldirs \ - install-sh \ - ABOUT-NLS \ - ChangeLog \ - INSTALL \ - conf.in \ - aclocal.m4 \ - Makefile.in \ - mdate-sh \ - missing - - - -EXTRA_DIST = \ - flex.spec.in \ - flex.spec \ - .indent.pro \ - AUTHORS \ - COPYING \ - INSTALL \ - NEWS \ - ONEWS \ - README \ - README.cvs-snapshot \ - THANKS \ - TODO \ - autogen.sh \ - flex.skl \ - mkskel.sh \ - ABOUT-NLS \ - config.rpath \ - gettext.h - -BUILT_SOURCES = \ - skel.c - -SUBDIRS = \ - . \ - doc \ - m4 \ - examples \ - po \ - tools \ - tests - -localedir = $(datadir)/locale -AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I@includedir@ -I$(top_srcdir)/intl -LIBS = @LIBINTL@ @LIBS@ - -skel.c: flex.skl mkskel.sh flexint.h tables_shared.h - sed 's/m4_/m4postproc_/g; s/m4preproc_/m4_/g' $(srcdir)/flex.skl | $(m4) -P -DFLEX_MAJOR_VERSION=`echo $(VERSION)|cut -f 1 -d .` -DFLEX_MINOR_VERSION=`echo $(VERSION)|cut -f 2 -d .` -DFLEX_SUBMINOR_VERSION=`echo $(VERSION)|cut -f 3 -d .` | sed 's/m4postproc_/m4_/g' | $(SHELL) $(srcdir)/mkskel.sh >skel.c - -# Explicitly describe dependencies. -# You can recreate this with `gcc -I. -MM *.c' -buf.o: buf.c flexdef.h flexint.h -ccl.o: ccl.c flexdef.h flexint.h -dfa.o: dfa.c flexdef.h flexint.h tables.h tables_shared.h -ecs.o: ecs.c flexdef.h flexint.h -gen.o: gen.c flexdef.h flexint.h tables.h tables_shared.h -libmain.o: libmain.c -libyywrap.o: libyywrap.c -main.o: main.c flexdef.h flexint.h version.h options.h scanopt.h \ - tables.h tables_shared.h -misc.o: misc.c flexdef.h flexint.h tables.h tables_shared.h -nfa.o: nfa.c flexdef.h flexint.h -options.o: options.c options.h scanopt.h flexdef.h flexint.h -parse.o: parse.c flexdef.h flexint.h tables.h tables_shared.h -scan.o: scan.c flexdef.h flexint.h parse.h -scanopt.o: scanopt.c flexdef.h flexint.h scanopt.h -skel.o: skel.c flexdef.h flexint.h -sym.o: sym.c flexdef.h flexint.h -tables.o: tables.c flexdef.h flexint.h tables.h tables_shared.h -tables_shared.o: tables_shared.c flexdef.h flexint.h tables.h \ - tables_shared.h -tblcmp.o: tblcmp.c flexdef.h flexint.h -yylex.o: yylex.c flexdef.h flexint.h parse.h -filter.o: filter.c flexdef.h flexint.h - -# Create a tags file. -tags: - ctags --c-types='defgmstuv' $(srcdir)/*.[ch] - -# Create the ChangeLog, but only if we're inside a cvs working directory - -ChangeLog: - if [ -d CVS ] ; then \ - sh $(srcdir)/tools/cvs2cl.pl -F trunk -U $(srcdir)/tools/cvsauthors \ - ; fi - -# Run GNU indent on sources. Don't run this unless all the sources compile cleanly. -# -# Whole idea: -# 1. Check for .indent.pro, otherwise indent will use unknown -# settings, or worse, the GNU defaults.) -# 2. Check that this is GNU indent. -# 3. Make sure to process only the NON-generated .c and .h files. -# 4. Run indent twice per file. The first time is a test. -# Otherwise, indent overwrites your file even if it fails! -indentfiles = \ - buf.c \ - ccl.c \ - dfa.c \ - ecs.c \ - filter.c \ - flexdef.h \ - gen.c \ - libmain.c \ - libyywrap.c \ - main.c \ - misc.c \ - nfa.c \ - options.c \ - options.h \ - regex.c \ - scanopt.c \ - scanopt.h \ - sym.c \ - tables.c \ - tables.h \ - tables_shared.c \ - tables_shared.h \ - tblcmp.c - -indent: - if [ -f .indent.pro ] ; then \ - for f in $(indentfiles);\ - do\ - echo indenting $$f ;\ - $(indent) < $$f >/dev/null && indent $$f || echo $$f FAILED to indent ;\ - done \ - fi - -.PHONY: ChangeLog tags indent diff --git a/src/bin/flex/Makefile.in b/src/bin/flex/Makefile.in deleted file mode 100644 index 7b7dcea25f..0000000000 --- a/src/bin/flex/Makefile.in +++ /dev/null @@ -1,1037 +0,0 @@ -# Makefile.in generated by automake 1.7.5 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# 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 file is part of flex. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: - -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. - -# Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. - -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE. - -# Notes on building: - -# Possible values for DEFS: -# -# By default, flex generates 8-bit scanners when using table compression, -# and 7-bit scanners when using uncompressed tables (-f or -F options). -# For flex to always generate 8-bit scanners, add "-DDEFAULT_CSIZE=256" -# to DEFS. -# -# For Vax/VMS, add "-DVMS" to DEFS. -# -# For MS-DOS, add "-DMS_DOS" to DEFS. See the directory MISC/MSDOS for -# additional info. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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 = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BISON = @BISON@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -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@ -EXEEXT = @EXEEXT@ -GMSGFMT = @GMSGFMT@ -HELP2MAN = @HELP2MAN@ -INDENT = @INDENT@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBINTL@ @LIBS@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -YACC = @YACC@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -AM_YFLAGS = -d -ACLOCAL_AMFLAGS = -I m4 -m4 = @M4@ -indent = @INDENT@ - -AUTOMAKE_OPTIONS = \ - gnits \ - check-news \ - dist-bzip2 \ - 1.7 - - -bin_PROGRAMS = flex -lib_LIBRARIES = libfl.a - -flex_SOURCES = \ - ccl.c \ - dfa.c \ - ecs.c \ - gen.c \ - main.c \ - misc.c \ - nfa.c \ - parse.y \ - scan.l \ - skel.c \ - sym.c \ - tblcmp.c \ - yylex.c \ - options.c \ - scanopt.c \ - buf.c \ - tables.c \ - tables_shared.c \ - filter.c \ - regex.c - - -libfl_a_SOURCES = \ - libmain.c \ - libyywrap.c - - -noinst_HEADERS = \ - flexdef.h \ - flexint.h \ - version.h \ - options.h \ - scanopt.h \ - tables.h \ - tables_shared.h - - -include_HEADERS = \ - FlexLexer.h - - -MAINTAINERCLEANFILES = \ - ABOUT-NLS \ - config.rpath \ - config.sub \ - config.guess \ - configure \ - config.sub \ - config.guess \ - depcomp \ - mkinstalldirs \ - install-sh \ - ABOUT-NLS \ - ChangeLog \ - INSTALL \ - conf.in \ - aclocal.m4 \ - Makefile.in \ - mdate-sh \ - missing - - -EXTRA_DIST = \ - flex.spec.in \ - flex.spec \ - .indent.pro \ - AUTHORS \ - COPYING \ - INSTALL \ - NEWS \ - ONEWS \ - README \ - README.cvs-snapshot \ - THANKS \ - TODO \ - autogen.sh \ - flex.skl \ - mkskel.sh \ - ABOUT-NLS \ - config.rpath \ - gettext.h - - -BUILT_SOURCES = \ - skel.c - - -SUBDIRS = \ - . \ - doc \ - m4 \ - examples \ - po \ - tools \ - tests - - -localedir = $(datadir)/locale -AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I@includedir@ -I$(top_srcdir)/intl - -# Run GNU indent on sources. Don't run this unless all the sources compile cleanly. -# -# Whole idea: -# 1. Check for .indent.pro, otherwise indent will use unknown -# settings, or worse, the GNU defaults.) -# 2. Check that this is GNU indent. -# 3. Make sure to process only the NON-generated .c and .h files. -# 4. Run indent twice per file. The first time is a test. -# Otherwise, indent overwrites your file even if it fails! -indentfiles = \ - buf.c \ - ccl.c \ - dfa.c \ - ecs.c \ - filter.c \ - flexdef.h \ - gen.c \ - libmain.c \ - libyywrap.c \ - main.c \ - misc.c \ - nfa.c \ - options.c \ - options.h \ - regex.c \ - scanopt.c \ - scanopt.h \ - sym.c \ - tables.c \ - tables.h \ - tables_shared.c \ - tables_shared.h \ - tblcmp.c - -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = flex.spec -LIBRARIES = $(lib_LIBRARIES) - -libfl_a_AR = $(AR) cru -libfl_a_LIBADD = -am_libfl_a_OBJECTS = libmain.$(OBJEXT) libyywrap.$(OBJEXT) -libfl_a_OBJECTS = $(am_libfl_a_OBJECTS) -bin_PROGRAMS = flex$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) - -am_flex_OBJECTS = ccl.$(OBJEXT) dfa.$(OBJEXT) ecs.$(OBJEXT) \ - gen.$(OBJEXT) main.$(OBJEXT) misc.$(OBJEXT) nfa.$(OBJEXT) \ - parse.$(OBJEXT) scan.$(OBJEXT) skel.$(OBJEXT) sym.$(OBJEXT) \ - tblcmp.$(OBJEXT) yylex.$(OBJEXT) options.$(OBJEXT) \ - scanopt.$(OBJEXT) buf.$(OBJEXT) tables.$(OBJEXT) \ - tables_shared.$(OBJEXT) filter.$(OBJEXT) regex.$(OBJEXT) -flex_OBJECTS = $(am_flex_OBJECTS) -flex_LDADD = $(LDADD) -flex_DEPENDENCIES = -flex_LDFLAGS = - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I. -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/buf.Po ./$(DEPDIR)/ccl.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/dfa.Po ./$(DEPDIR)/ecs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/filter.Po ./$(DEPDIR)/gen.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/libmain.Po ./$(DEPDIR)/libyywrap.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/misc.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/nfa.Po ./$(DEPDIR)/options.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/parse.Po ./$(DEPDIR)/regex.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/scan.Po ./$(DEPDIR)/scanopt.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/skel.Po ./$(DEPDIR)/sym.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/tables.Po ./$(DEPDIR)/tables_shared.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/tblcmp.Po ./$(DEPDIR)/yylex.Po -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) -YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) -DIST_SOURCES = $(libfl_a_SOURCES) $(flex_SOURCES) -HEADERS = $(include_HEADERS) $(noinst_HEADERS) - - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = README $(include_HEADERS) $(noinst_HEADERS) ABOUT-NLS \ - AUTHORS COPYING ChangeLog INSTALL Makefile.am Makefile.in NEWS \ - README-alpha THANKS TODO aclocal.m4 conf.in config.guess \ - config.rpath config.sub configure configure.in depcomp \ - flex.spec.in install-sh missing mkinstalldirs parse.c parse.h \ - scan.c -DIST_SUBDIRS = $(SUBDIRS) -SOURCES = $(libfl_a_SOURCES) $(flex_SOURCES) - -all: $(BUILT_SOURCES) config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -.SUFFIXES: .c .l .o .obj .y - -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnits Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) - -$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck -$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) - -$(ACLOCAL_M4): configure.in m4/codeset.m4 m4/gettext.m4 m4/glibc21.m4 m4/iconv.m4 m4/intdiv0.m4 m4/inttypes-pri.m4 m4/inttypes.m4 m4/inttypes_h.m4 m4/isc-posix.m4 m4/lcmessage.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/nls.m4 m4/po.m4 m4/progtest.m4 m4/stdint_h.m4 m4/uintmax_t.m4 m4/ulonglong.m4 - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) stamp-h1; \ - else :; fi - -stamp-h1: $(srcdir)/conf.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h - -$(srcdir)/conf.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOHEADER) - touch $(srcdir)/conf.in - -distclean-hdr: - -rm -f config.h stamp-h1 -flex.spec: $(top_builddir)/config.status flex.spec.in - cd $(top_builddir) && $(SHELL) ./config.status $@ - -AR = ar -libLIBRARIES_INSTALL = $(INSTALL_DATA) -install-libLIBRARIES: $(lib_LIBRARIES) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(libdir) - @list='$(lib_LIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - 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="`echo $$p | sed -e 's|^.*/||'`"; \ - 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="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(libdir)/$$p"; \ - rm -f $(DESTDIR)$(libdir)/$$p; \ - done - -clean-libLIBRARIES: - -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) -libfl.a: $(libfl_a_OBJECTS) $(libfl_a_DEPENDENCIES) - -rm -f libfl.a - $(libfl_a_AR) libfl.a $(libfl_a_OBJECTS) $(libfl_a_LIBADD) - $(RANLIB) libfl.a -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(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 \ - && test -n "`cat c$${pid}_.out`" \ - && test -z "`cat c$${pid}_.err`"; then :; \ - else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ - done; \ - done; rm -f c$${pid}_.???; exit $$bad -parse.h: parse.c - @if test ! -f $@; then \ - rm -f parse.c; \ - $(MAKE) parse.c; \ - else :; fi -flex$(EXEEXT): $(flex_OBJECTS) $(flex_DEPENDENCIES) - @rm -f flex$(EXEEXT) - $(LINK) $(flex_LDFLAGS) $(flex_OBJECTS) $(flex_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ccl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfa.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmain.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libyywrap.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nfa.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanopt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skel.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sym.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tables.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tables_shared.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tblcmp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yylex.Po@am__quote@ - -distclean-depend: - -rm -rf ./$(DEPDIR) - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -.l.c: - $(LEXCOMPILE) `test -f $< || echo '$(srcdir)/'`$< - sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|$@|' $(LEX_OUTPUT_ROOT).c >$@ - rm -f $(LEX_OUTPUT_ROOT).c - -.y.c: - $(YACCCOMPILE) `test -f '$<' || echo '$(srcdir)/'`$< - if test -f y.tab.h; then \ - to=`echo "$*_H" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ - sed "/^#/ s/Y_TAB_H/$$to/g" y.tab.h >$*.ht; \ - rm -f y.tab.h; \ - if cmp -s $*.ht $*.h; then \ - rm -f $*.ht ;\ - else \ - mv $*.ht $*.h; \ - fi; \ - fi - if test -f y.output; then \ - mv y.output $*.output; \ - fi - sed '/^#/ s|y\.tab\.c|$@|' y.tab.c >$@t && mv $@t $@ - rm -f y.tab.c -uninstall-info-am: -includeHEADERS_INSTALL = $(INSTALL_HEADER) -install-includeHEADERS: $(include_HEADERS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(includedir) - @list='$(include_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f"; \ - $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f; \ - done - -uninstall-includeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(include_HEADERS)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(includedir)/$$f"; \ - rm -f $(DESTDIR)$(includedir)/$$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): - @set fnord $$MAKEFLAGS; amf=$$2; \ - 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) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - 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) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - 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 - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -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; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: tags-recursive $(HEADERS) $(SOURCES) conf.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - else \ - include_option=--include; \ - 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) conf.in $(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; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) conf.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) conf.in $(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; } \ - END { 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 -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = . -distdir = $(PACKAGE)-$(VERSION) - -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } - -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print - -distdir: $(DISTFILES) - @case `sed 15q $(srcdir)/NEWS` in \ - *"$(VERSION)"*) : ;; \ - *) \ - echo "NEWS not updated; not releasing" 1>&2; \ - exit 1;; \ - esac - $(am__remove_distdir) - mkdir $(distdir) - $(mkinstalldirs) $(distdir)/. $(distdir)/po - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - 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='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ - distdir) \ - || exit 1; \ - fi; \ - done - -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 $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist dist-all: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(AMTAR) chof - $(distdir) | 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 - $(am__remove_distdir) - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - - 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 ../.. && $(mkinstalldirs) "$$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-gzip \ - && rm -f $(distdir).tar.gz \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @echo "$(distdir).tar.gz is ready for distribution" | \ - sed 'h;s/./=/g;p;x;p;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 $(LIBRARIES) $(PROGRAMS) $(HEADERS) config.h -installdirs: installdirs-recursive -installdirs-am: - $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) $(DESTDIR)$(includedir) - -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_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(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.h - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) - -rm -f scan.c - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) - -rm -f parse.c -clean: clean-recursive - -clean-am: clean-binPROGRAMS clean-generic clean-libLIBRARIES \ - mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-hdr distclean-tags - -dvi: dvi-recursive - -dvi-am: - -info: info-recursive - -info-am: - -install-data-am: install-includeHEADERS - -install-exec-am: install-binPROGRAMS install-libLIBRARIES - -install-info: install-info-recursive - -install-man: - -installcheck-am: installcheck-binPROGRAMS - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf autom4te.cache -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \ - uninstall-info-am uninstall-libLIBRARIES - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-binPROGRAMS clean-generic clean-libLIBRARIES \ - clean-recursive ctags ctags-recursive dist dist-all dist-bzip2 \ - dist-gzip distcheck distclean distclean-compile \ - distclean-depend distclean-generic distclean-hdr \ - distclean-recursive distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am dvi-recursive info info-am \ - info-recursive install install-am install-binPROGRAMS \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-includeHEADERS install-info install-info-am \ - install-info-recursive install-libLIBRARIES install-man \ - install-recursive install-strip installcheck installcheck-am \ - installcheck-binPROGRAMS installdirs installdirs-am \ - installdirs-recursive maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-recursive pdf pdf-am \ - pdf-recursive ps ps-am ps-recursive tags tags-recursive \ - uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-includeHEADERS uninstall-info-am \ - uninstall-info-recursive uninstall-libLIBRARIES \ - uninstall-recursive - - -skel.c: flex.skl mkskel.sh flexint.h tables_shared.h - sed 's/m4_/m4postproc_/g; s/m4preproc_/m4_/g' $(srcdir)/flex.skl | $(m4) -P -DFLEX_MAJOR_VERSION=`echo $(VERSION)|cut -f 1 -d .` -DFLEX_MINOR_VERSION=`echo $(VERSION)|cut -f 2 -d .` -DFLEX_SUBMINOR_VERSION=`echo $(VERSION)|cut -f 3 -d .` | sed 's/m4postproc_/m4_/g' | $(SHELL) $(srcdir)/mkskel.sh >skel.c - -# Explicitly describe dependencies. -# You can recreate this with `gcc -I. -MM *.c' -buf.o: buf.c flexdef.h flexint.h -ccl.o: ccl.c flexdef.h flexint.h -dfa.o: dfa.c flexdef.h flexint.h tables.h tables_shared.h -ecs.o: ecs.c flexdef.h flexint.h -gen.o: gen.c flexdef.h flexint.h tables.h tables_shared.h -libmain.o: libmain.c -libyywrap.o: libyywrap.c -main.o: main.c flexdef.h flexint.h version.h options.h scanopt.h \ - tables.h tables_shared.h -misc.o: misc.c flexdef.h flexint.h tables.h tables_shared.h -nfa.o: nfa.c flexdef.h flexint.h -options.o: options.c options.h scanopt.h flexdef.h flexint.h -parse.o: parse.c flexdef.h flexint.h tables.h tables_shared.h -scan.o: scan.c flexdef.h flexint.h parse.h -scanopt.o: scanopt.c flexdef.h flexint.h scanopt.h -skel.o: skel.c flexdef.h flexint.h -sym.o: sym.c flexdef.h flexint.h -tables.o: tables.c flexdef.h flexint.h tables.h tables_shared.h -tables_shared.o: tables_shared.c flexdef.h flexint.h tables.h \ - tables_shared.h -tblcmp.o: tblcmp.c flexdef.h flexint.h -yylex.o: yylex.c flexdef.h flexint.h parse.h -filter.o: filter.c flexdef.h flexint.h - -# Create a tags file. -tags: - ctags --c-types='defgmstuv' $(srcdir)/*.[ch] - -# Create the ChangeLog, but only if we're inside a cvs working directory - -ChangeLog: - if [ -d CVS ] ; then \ - sh $(srcdir)/tools/cvs2cl.pl -F trunk -U $(srcdir)/tools/cvsauthors \ - ; fi - -indent: - if [ -f .indent.pro ] ; then \ - for f in $(indentfiles);\ - do\ - echo indenting $$f ;\ - $(indent) < $$f >/dev/null && indent $$f || echo $$f FAILED to indent ;\ - done \ - fi - -.PHONY: ChangeLog tags indent -# 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/bin/flex/NEWS b/src/bin/flex/NEWS deleted file mode 100644 index 17b9c45316..0000000000 --- a/src/bin/flex/NEWS +++ /dev/null @@ -1,416 +0,0 @@ -This is the file NEWS for the flex package. It records user -visible -changes between releases of flex. - -See the file COPYING for copying conditions. - -* version 2.5.33 released 2006-2-20 - -** all flex resources are now to be found from the website at - http://flex.sourceforge.net/ - -** there was no release 2.5.32 published - -** numerous bug and security fixes - -** new nl, vi, sv, ro, po, ga, ca, fr, tr translations from the translation project - -** upgrade to use gettext 0.12 (this now makes the "pdf" and "ps" - targets in the build system able to be run successfully) - -* version 2.5.31 released 2003-4-1 - -** remove --enable-maintainer-mode configure option; none of the - Makefiles were using it and it can be unduely confusing - -* version 2.5.30 released 2003-4-1 - -** yylineno is per-buffer in reentrant scanners - -** added %top directive for placing code at the top of the generated - scanner; see manual for details - -** flex now uses m4 to generate scanners; while this means that - scanners are more readable, it means that flex requires m4 to be - installed; see manual for details - -* version 2.5.29 released 2003-3-5 - -** Automatic stack management for multiple input buffers in C and C++ scanners - -** moved the flex documentation to a new doc/ subdirectory - -** cleanups to the yy namespace - -* version 2.5.28 released 2003-2-12 - -** flex is now hosted at sourceforge - -** Fixed trailing slash bug in YY_INPUT macro def - -** Flex now warns if always-interactive is specified with fast or full - -* version 2.5.27 released 2003-1-21 - -** flex now works with recent bison versions - -** new pt_br translation from the translation project - -* version 2.5.26 released 2003-1-14 - -** Fixed table deserialization bug on big-endian archs. Patch sent from Bryce Nichols - -** yyleng has proper declarations now; this caused flex to generate - unusable scanners for some programs - -** the flex distribution now includes a spec file suitable for use - with rpm - -** some more c++ fixes - -** new es translation from the translation project - -** slight tweeks to the flex_int*_t types - -** flex now warns about pattern ranges that might be ambiguous when - generating a case-insensitive scanner - - -* version 2.5.25 released 2002-12-2 - -** flex now uses flex_int*_t types. For C99 systems, they are just the - int*_t types; for non-C99 systems, we just make some typedefs - -** new pt_br translation from the translation project - -* version 2.5.24 released 2002-11-25 - -* more portability fixes - -** the manual continues to be updated and edited, but it's still got a - ways to go - -** it is possible to have multiple c++ scanners in the same program again - -** new turkish translation from the translation project - -* version 2.5.23 released 2002-10-21 - -** more portability fixes - -** the manual includes a title page and a table-of-contents when printed - -** the test suite can be run with "make check" from the top-level - directory - -** configure now accepts the --enable-maintainer-mode option - -** gettext functionality is now only available externally - -** the constant FLEX_BETA is defined if flex is a beta release - -** the script create-test was not included in the distribution and it - should have been - -* version 2.5.22 released 2002-10-10 - -** more portability fixes around how we get ahold of the integral - types; there is a constant FLEX_NEED_INTEGRAL_TYPE_DEFINITIONS - which you should define if you don't have the header - file (after you complain to your C vendor for not providing a - reasonable C environment) - -** more test suite cleanups; in particular, the test suite should run - correctly when build from a different directory - -** upgraded automake to 1.7 and consequently autoconf to 2.54; this - means, among other things, that there is some support for -formatting the manual in postscript and pdf in the distributed - Makefile.in (and therefore in the Makefile built by configure) - -** the flex.1 manpage is generated by help2man; (this has been true - for quite a while but was not listed here) - -** flex now includes three defined constants to indicate which version - of flex generated a scanner (YY_FLEX_{MAJOR,MINOR,SUBMINOR}_VERSION) - -** flex tries its best to output only the relevant portions of the - skeleton when generating a scanner, thus avoiding as much - conditional compilation as possible - -* version 2.5.21 released 2002-9-17 - -** one of the tests in the test suite broke the dist target - -* version 2.5.20 released 2002-9-16 - -** A flex scanner has the ability to save the DFA tables to a file, - and load them at runtime when needed; see the manual for details - -** Added %option bison-bridge (--bison-bridge) - -** Removed %option reentrant-bison/--reentrant-bison/-Rb - -** yylineno is present in all scanners; Modified nasty performance - penalty warning with yylineno in documentation - -** test-table-opts is now run last in the test suite because it's so fat - -** flex can, to some extent, diagnose where internal problems occur - -** new translations from the translation project: fr, ca, de, ru, sv - -**Flex generates C99 defs now; see YY_TRADITIONAL_FUNC_DEFS in the - manual if that's not a good thing for you - -* version 2.5.19 released 2002-9-5 - -** prevent segfault on input lines which are longer than the allocated - space (problem report from Manoj Srivastava - ) - -** Changed option 'header' to 'header-file' - -* version 2.5.18 released 2002-9-4 - -** portability fixes for integer constants and in the way the test - suite reports its results - -** the test for bison was reporting bison missing when it was, in - fact, found - -** if we don't find GNU indent, we're more careful when we're not - finding it - -* version 2.5.17 released 2002-8-29 - -** more portability fixes - -** updated config.sub and config.guess - -** flex is indented by GNU indent (this was done earlier but not - explicitly documented) - -* version 2.5.16 released 2002-8-28 - -** c++ scanners compile again - -** there is now an indent target in the top-level Makefile; configure - checks for GNU indent which is required for proper operation of the - indent target - -** some more portability fixes were made - -** %options and invocation sections of manual merged - -** a c++ test was added to the test suite - -** we're trying to clean up more files in the test suite's make clean - targets - -* version 2.5.15 released 2002-8-21 - -** reject-state buffer is now dynamically allocated and REJECT buffer - variables are reentrant-safe - -** manual now discusses memory usage - -** skeleton now processed by m4 before mkskel.sh; (this only matters - if you want to change the skeleton or if you're doing flex development) - -** zh_cn translation added from translation project - -** a bug that caused a segfault has now been fixed - -** the test suite now respects the usual CFLAGS, etc. variables - -** removed some warnings which some tests trigggered with the -s option - -** the flex-generated header file now tries to be smarter about - conditionally including start conditions - -** tables code omitted from generated scanner when not used - -* version 2.5.14 released 2002-8-15 - -** the tests using the reentrant c scanner as c++ were reworked - slightly to be sure that the c++ was enforced - -** de translation now included in the distribution - -** various portability fixes regarding nls support, c++ include - headers, etc. - -* version 2.5.13 released 2002-8-15 - -** the header file output with %option header is now much smaller - -** Fixed type mismatch in printf in scanner skeleton - -** yylex_init now reports errors - -* version 2.5.12 released 2002-8-8 - -** updated gettext support to 0.11.5 - -** new fr translation from the translation project - -** bison is no longer needed to build flex; If you are building flex - from a release (i.e., not from a cvs snapshot), then you don't need - to have a pre-built lex around either (unless you modify scan.l, of - course); (This has been true for some time, but was not mentioned - here.) - -* version 2.5.11 released 2002-7-31 - -** Fixed bug where yyless did not consider yylineno - -** the yylineno performance hit is now gone - -** fixed some typos in the manual and we now include texinfo.tex in - the distribution - -** traditional prototypes output for C scanners, controlled by a - preprocessor symbol; see documentation for details - -* version 2.5.10 released 2002-7-24 - -** yy_globals renamed to yyscanner and yy_globals_t renamed to - yy_guts_t - -** added dist-bzip2 option to Makefile.am so we now produce a bzip2'd - archive in addition to the standard gzip archive - -* version 2.5.9 - -** new tests in test suite: test-mem-{nr,r}, test-posix, - test-posixly-correct, test-debug-{nr,r} - -** made changes to work with gcc-3.2 development code - -** ability to choose which memory functions are used in flex - -** new yylex_destroy() function for the non-reentrant scanner - -** new handling of POSIXLY_CORRECT environment variable - -** the test suite now has its copyrights explicitly described - -** new ca, de, fr, ru, sv, tr translations - -* version 2.5.8 - -** a new --posix option generates scanners with posix-style abc{1,3} - compatible parsing, see manual for the screwy details - -* version 2.5.7 - -** configure.in now includes a call to AC_PREREQ to enforce the - requirement for autoconf at least 2.50 (This only effects you if - you're doing flex development.) - -** configure now uses autoconf's versioning information and configure - --help reports the bug-reporting address for flex - -** test suite now only reports success versus failure; reporting - skipped is problematic under the current setup - -** compilation with --disable-nls now works - -** flex can now be built in a separate directory - -* version 2.5.6 - -** gettext support added (from gettext 0.11) - -*** translations for ca, da, de, es, fr, ko, ru, sv, tr included - -** distribution now built under automake 1.6 and autoconf 2.53 - -** command-line option parsing happens differently now: - -*** Added long option parsing - -*** Options -n and -c, previously deprecated, now simply do nothing - -*** Options are now parsed left to right - -** added a number of new options - -*** All positive %options are now accessible from the command line - -*** Added option -D, to define a preprocessor symbol - -*** Added option --header=FILE to specify a C .h file to generate - -*** added option --yywrap to call yywrap on EOF - -*** added option --yylineno to track line count in yylineno - -*** --yyclass=NAME name of C++ class when generating c++ scanners - -*** for long option names which are associated with existing short -options, see accompanying documentation - -*** new %option nounistd or command-line --nounistd added to prevent - flex from generating #include on systems that don't - have that include file - -** Support for reentrant C scanners has been added - -*** Updated the manual with the new reentrant API - -*** Two new options %option reentrant (-R) and -%option reentrant-bison (-Rb) - -*** All globals optionally placed into struct yyglobals_t - -*** All access to globals replaced by macro invocations - -*** All functions optionally take one additional -argument, yy_globals - -*** New style for invoking reentrant scanner: -yylex_init(void** scanner ); -yylex( scanner ); -yylex_destroy( scanner ); - -*** Added get/set functions for members of struct yy_globals_t -e.g., yyget_text, yyget_leng, etc - -*** Prefix substitution added for new functions - -*** Macro shortcuts to the lengthy get/set functions -provided for use in actions, e.g., yytext, yyleng, etc - -*** Arbitrary, user-defined data, "yyextra", may be added to scanner - -** %option nomain no longer implies %option yywrap -But the inverse is still true - -** Developer test suite added - -*** TESTS/ directory has been added. Users can -'make test' in the TESTS directory to execute the test suite - -** Support for bison variables yylval and yylloc added - -** automake support for the build process - -** manual is now in texinfo/info format - -*** flex.1 removed from distribution - -** flex no longer generates C-language scanners with C++-style - comments - -** flex now generates scanners in c++ which are compatible with - recent c++ compilers - -** flex input scanner now recognizes '\r' as an EOL character - -See the file ONEWS for changes in earlier releases. - -Local Variables: -mode: text -mode: outline-minor -end: diff --git a/src/bin/flex/ONEWS b/src/bin/flex/ONEWS deleted file mode 100644 index 3341577218..0000000000 --- a/src/bin/flex/ONEWS +++ /dev/null @@ -1,1233 +0,0 @@ -Changes between release 2.5.4 (11Sep96) and release 2.5.3: - - - Fixed a bug introduced in 2.5.3 that blew it when a call - to input() occurred at the end of an input file. - - - Fixed scanner skeleton so the example in the man page of - scanning strings using exclusive start conditions works. - - - Minor Makefile tweaks. - - -Changes between release 2.5.3 (29May96) and release 2.5.2: - - - Some serious bugs in yymore() have been fixed. In particular, - when using AT&T-lex-compatibility or %array, you can intermix - calls to input(), unput(), and yymore(). (This still doesn't - work for %pointer, and isn't likely to in the future.) - - - A bug in handling NUL's in the input stream of scanners using - REJECT has been fixed. - - - The default main() in libfl.a now repeatedly calls yylex() until - it returns 0, rather than just calling it once. - - - Minor tweak for Windows NT Makefile, MISC/NT/Makefile. - - -Changes between release 2.5.2 (25Apr95) and release 2.5.1: - - - The --prefix configuration option now works. - - - A bug that completely broke the "-Cf" table compression - option has been fixed. - - - A major headache involving "const" declarators and Solaris - systems has been fixed. - - - An octal escape sequence in a flex regular expression must - now contain only the digits 0-7. - - - You can now use "--" on the flex command line to mark the - end of flex options. - - - You can now specify the filename '-' as a synonym for stdin. - - - By default, the scanners generated by flex no longer - statically initialize yyin and yyout to stdin and stdout. - This change is necessary because in some ANSI environments, - stdin and stdout are not compile-time constant. You can - force the initialization using "%option stdinit" in the first - section of your flex input. - - - "%option nounput" now correctly omits the unput() routine - from the output. - - - "make clean" now removes config.log, config.cache, and the - flex binary. The fact that it removes the flex binary means - you should take care if making changes to scan.l, to make - sure you don't wind up in a bootstrap problem. - - - In general, the Makefile has been reworked somewhat (thanks - to Francois Pinard) for added flexibility - more changes will - follow in subsequent releases. - - - The .texi and .info files in MISC/texinfo/ have been updated, - thanks also to Francois Pinard. - - - The FlexLexer::yylex(istream* new_in, ostream* new_out) method - now does not have a default for the first argument, to disambiguate - it from FlexLexer::yylex(). - - - A bug in destructing a FlexLexer object before doing any scanning - with it has been fixed. - - - A problem with including FlexLexer.h multiple times has been fixed. - - - The alloca() chud necessary to accommodate bison has grown - even uglier, but hopefully more correct. - - - A portability tweak has been added to accommodate compilers that - use char* generic pointers. - - - EBCDIC contact information in the file MISC/EBCDIC has been updated. - - - An OS/2 Makefile and config.h for flex 2.5 is now available in - MISC/OS2/, contributed by Kai Uwe Rommel. - - - The descrip.mms file for building flex under VMS has been updated, - thanks to Pat Rankin. - - - The notes on building flex for the Amiga have been updated for - flex 2.5, contributed by Andreas Scherer. - - -Changes between release 2.5.1 (28Mar95) and release 2.4.7: - - - A new concept of "start condition" scope has been introduced. - A start condition scope is begun with: - - { - - where SCs is a list of one or more start conditions. Inside - the start condition scope, every rule automatically has the - prefix applied to it, until a '}' which matches the - initial '{'. So, for example: - - { - "\\n" return '\n'; - "\\r" return '\r'; - "\\f" return '\f'; - "\\0" return '\0'; - } - - is equivalent to: - - "\\n" return '\n'; - "\\r" return '\r'; - "\\f" return '\f'; - "\\0" return '\0'; - - As indicated in this example, rules inside start condition scopes - (and any rule, actually, other than the first) can be indented, - to better show the extent of the scope. - - Start condition scopes may be nested. - - - The new %option directive can be used in the first section of - a flex scanner to control scanner-generation options. Most - options are given simply as names, optionally preceded by the - word "no" (with no intervening whitespace) to negate their - meaning. Some are equivalent to flex flags, so putting them - in your scanner source is equivalent to always specifying - the flag (%option's take precedence over flags): - - 7bit -7 option - 8bit -8 option - align -Ca option - backup -b option - batch -B option - c++ -+ option - caseful opposite of -i option (caseful is the default); - case-sensitive same as above - caseless -i option; - case-insensitive same as above - debug -d option - default opposite of -s option - ecs -Ce option - fast -F option - full -f option - interactive -I option - lex-compat -l option - meta-ecs -Cm option - perf-report -p option - read -Cr option - stdout -t option - verbose -v option - warn opposite of -w option (so use "%option nowarn" for -w) - - array equivalent to "%array" - pointer equivalent to "%pointer" (default) - - Some provide new features: - - always-interactive generate a scanner which always - considers its input "interactive" (no call to isatty() - will be made when the scanner runs) - main supply a main program for the scanner, which - simply calls yylex(). Implies %option noyywrap. - never-interactive generate a scanner which never - considers its input "interactive" (no call to isatty() - will be made when the scanner runs) - stack if set, enable start condition stacks (see below) - stdinit if unset ("%option nostdinit"), initialize yyin - and yyout statically to nil FILE* pointers, instead - of stdin and stdout - yylineno if set, keep track of the current line - number in global yylineno (this option is expensive - in terms of performance). The line number is available - to C++ scanning objects via the new member function - lineno(). - yywrap if unset ("%option noyywrap"), scanner does not - call yywrap() upon EOF but simply assumes there - are no more files to scan - - Flex scans your rule actions to determine whether you use the - REJECT or yymore features (this is not new). Two %options can be - used to override its decision, either by setting them to indicate - the feature is indeed used, or unsetting them to indicate it - actually is not used: - - reject - yymore - - Three %option's take string-delimited values, offset with '=': - - outfile="" equivalent to -o - prefix="" equivalent to -P - yyclass="" set the name of the C++ scanning class - (see below) - - A number of %option's are available for lint purists who - want to suppress the appearance of unneeded routines in - the generated scanner. Each of the following, if unset, - results in the corresponding routine not appearing in the - generated scanner: - - input, unput - yy_push_state, yy_pop_state, yy_top_state - yy_scan_buffer, yy_scan_bytes, yy_scan_string - - You can specify multiple options with a single %option directive, - and multiple directives in the first section of your flex input file. - - - The new function: - - YY_BUFFER_STATE yy_scan_string( const char *str ) - - returns a YY_BUFFER_STATE (which also becomes the current input - buffer) for scanning the given string, which occurs starting - with the next call to yylex(). The string must be NUL-terminated. - A related function: - - YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len ) - - creates a buffer for scanning "len" bytes (including possibly NUL's) - starting at location "bytes". - - Note that both of these functions create and scan a *copy* of - the string/bytes. (This may be desirable, since yylex() modifies - the contents of the buffer it is scanning.) You can avoid the - copy by using: - - YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) - - which scans in place the buffer starting at "base", consisting - of "size" bytes, the last two bytes of which *must* be - YY_END_OF_BUFFER_CHAR (these bytes are not scanned; thus, scanning - consists of base[0] through base[size-2], inclusive). If you - fail to set up "base" in this manner, yy_scan_buffer returns a - nil pointer instead of creating a new input buffer. - - The type yy_size_t is an integral type to which you can cast - an integer expression reflecting the size of the buffer. - - - Three new routines are available for manipulating stacks of - start conditions: - - void yy_push_state( int new_state ) - - pushes the current start condition onto the top of the stack - and BEGIN's "new_state" (recall that start condition names are - also integers). - - void yy_pop_state() - - pops the top of the stack and BEGIN's to it, and - - int yy_top_state() - - returns the top of the stack without altering the stack's - contents. - - The start condition stack grows dynamically and so has no built-in - size limitation. If memory is exhausted, program execution - is aborted. - - To use start condition stacks, your scanner must include - a "%option stack" directive. - - - flex now supports POSIX character class expressions. These - are expressions enclosed inside "[:" and ":]" delimiters (which - themselves must appear between the '[' and ']' of a character - class; other elements may occur inside the character class, too). - The expressions flex recognizes are: - - [:alnum:] [:alpha:] [:blank:] [:cntrl:] [:digit:] [:graph:] - [:lower:] [:print:] [:punct:] [:space:] [:upper:] [:xdigit:] - - These expressions all designate a set of characters equivalent to - the corresponding isXXX function (for example, [:alnum:] designates - those characters for which isalnum() returns true - i.e., any - alphabetic or numeric). Some systems don't provide isblank(), - so flex defines [:blank:] as a blank or a tab. - - For example, the following character classes are all equivalent: - - [[:alnum:]] - [[:alpha:][:digit:] - [[:alpha:]0-9] - [a-zA-Z0-9] - - If your scanner is case-insensitive (-i flag), then [:upper:] - and [:lower:] are equivalent to [:alpha:]. - - - The promised rewrite of the C++ FlexLexer class has not yet - been done. Support for FlexLexer is limited at the moment to - fixing show-stopper bugs, so, for example, the new functions - yy_scan_string() & friends are not available to FlexLexer - objects. - - - The new macro - - yy_set_interactive(is_interactive) - - can be used to control whether the current buffer is considered - "interactive". An interactive buffer is processed more slowly, - but must be used when the scanner's input source is indeed - interactive to avoid problems due to waiting to fill buffers - (see the discussion of the -I flag in flex.1). A non-zero value - in the macro invocation marks the buffer as interactive, a zero - value as non-interactive. Note that use of this macro overrides - "%option always-interactive" or "%option never-interactive". - - yy_set_interactive() must be invoked prior to beginning to - scan the buffer. - - - The new macro - - yy_set_bol(at_bol) - - can be used to control whether the current buffer's scanning - context for the next token match is done as though at the - beginning of a line (non-zero macro argument; makes '^' anchored - rules active) or not at the beginning of a line (zero argument, - '^' rules inactive). - - - Related to this change, the mechanism for determining when a scan is - starting at the beginning of a line has changed. It used to be - that '^' was active iff the character prior to that at which the - scan started was a newline. The mechanism now is that '^' is - active iff the last token ended in a newline (or the last call to - input() returned a newline). For most users, the difference in - mechanisms is negligible. Where it will make a difference, - however, is if unput() or yyless() is used to alter the input - stream. When in doubt, use yy_set_bol(). - - - The new beginning-of-line mechanism involved changing some fairly - twisted code, so it may have introduced bugs - beware ... - - - The macro YY_AT_BOL() returns true if the next token scanned from - the current buffer will have '^' rules active, false otherwise. - - - The new function - - void yy_flush_buffer( struct yy_buffer_state* b ) - - flushes the contents of the current buffer (i.e., next time - the scanner attempts to match a token using b as the current - buffer, it will begin by invoking YY_INPUT to fill the buffer). - This routine is also available to C++ scanners (unlike some - of the other new routines). - - The related macro - - YY_FLUSH_BUFFER - - flushes the contents of the current buffer. - - - A new "-ooutput" option writes the generated scanner to "output". - If used with -t, the scanner is still written to stdout, but - its internal #line directives (see previous item) use "output". - - - Flex now generates #line directives relating the code it - produces to the output file; this means that error messages - in the flex-generated code should be correctly pinpointed. - - - When generating #line directives, filenames with embedded '\'s - have those characters escaped (i.e., turned into '\\'). This - feature helps with reporting filenames for some MS-DOS and OS/2 - systems. - - - The FlexLexer class includes two new public member functions: - - virtual void switch_streams( istream* new_in = 0, - ostream* new_out = 0 ) - - reassigns yyin to new_in (if non-nil) and yyout to new_out - (ditto), deleting the previous input buffer if yyin is - reassigned. It is used by: - - int yylex( istream* new_in = 0, ostream* new_out = 0 ) - - which first calls switch_streams() and then returns the value - of calling yylex(). - - - C++ scanners now have yy_flex_debug as a member variable of - FlexLexer rather than a global, and member functions for testing - and setting it. - - - When generating a C++ scanning class, you can now use - - %option yyclass="foo" - - to inform flex that you have derived "foo" as a subclass of - yyFlexLexer, so flex will place your actions in the member - function foo::yylex() instead of yyFlexLexer::yylex(). It also - generates a yyFlexLexer::yylex() member function that generates a - run-time error if called (by invoking yyFlexLexer::LexerError()). - This feature is necessary if your subclass "foo" introduces some - additional member functions or variables that you need to access - from yylex(). - - - Current texinfo files in MISC/texinfo, contributed by Francois - Pinard. - - - You can now change the name "flex" to something else (e.g., "lex") - by redefining $(FLEX) in the Makefile. - - - Two bugs (one serious) that could cause "bigcheck" to fail have - been fixed. - - - A number of portability/configuration changes have been made - for easier portability. - - - You can use "YYSTATE" in your scanner as an alias for YY_START - (for AT&T lex compatibility). - - - input() now maintains yylineno. - - - input() no longer trashes yytext. - - - interactive scanners now read characters in YY_INPUT up to a - newline, a large performance gain. - - - C++ scanner objects now work with the -P option. You include - once per scanner - see comments in - (or flex.1) for details. - - - C++ FlexLexer objects now use the "cerr" stream to report -d output - instead of stdio. - - - The -c flag now has its full glorious POSIX interpretation (do - nothing), rather than being interpreted as an old-style -C flag. - - - Scanners generated by flex now include two #define's giving - the major and minor version numbers (YY_FLEX_MAJOR_VERSION, - YY_FLEX_MINOR_VERSION). These can then be tested to see - whether certain flex features are available. - - - Scanners generated using -l lex compatibility now have the symbol - YY_FLEX_LEX_COMPAT #define'd. - - - When initializing (i.e., yy_init is non-zero on entry to yylex()), - generated scanners now set yy_init to zero before executing - YY_USER_INIT. This means that you can set yy_init back to a - non-zero value in YY_USER_INIT if you need the scanner to be - reinitialized on the next call. - - - You can now use "#line" directives in the first section of your - scanner specification. - - - When generating full-table scanners (-Cf), flex now puts braces - around each row of the 2-d array initialization, to silence warnings - on over-zealous compilers. - - - Improved support for MS-DOS. The flex sources have been successfully - built, unmodified, for Borland 4.02 (all that's required is a - Borland Makefile and config.h file, which are supplied in - MISC/Borland - contributed by Terrence O Kane). - - - Improved support for Macintosh using Think C - the sources should - build for this platform "out of the box". Contributed by Scott - Hofmann. - - - Improved support for VMS, in MISC/VMS/, contributed by Pat Rankin. - - - Support for the Amiga, in MISC/Amiga/, contributed by Andreas - Scherer. Note that the contributed files were developed for - flex 2.4 and have not been tested with flex 2.5. - - - Some notes on support for the NeXT, in MISC/NeXT, contributed - by Raf Schietekat. - - - The MISC/ directory now includes a preformatted version of flex.1 - in flex.man, and pre-yacc'd versions of parse.y in parse.{c,h}. - - - The flex.1 and flexdoc.1 manual pages have been merged. There - is now just one document, flex.1, which includes an overview - at the beginning to help you find the section you need. - - - Documentation now clarifies that start conditions persist across - switches to new input files or different input buffers. If you - want to e.g., return to INITIAL, you must explicitly do so. - - - The "Performance Considerations" section of the manual has been - updated. - - - Documented the "yy_act" variable, which when YY_USER_ACTION is - invoked holds the number of the matched rule, and added an - example of using yy_act to profile how often each rule is matched. - - - Added YY_NUM_RULES, a definition that gives the total number - of rules in the file, including the default rule (even if you - use -s). - - - Documentation now clarifies that you can pass a nil FILE* pointer - to yy_create_buffer() or yyrestart() if you've arrange YY_INPUT - to not need yyin. - - - Documentation now clarifies that YY_BUFFER_STATE is a pointer to - an opaque "struct yy_buffer_state". - - - Documentation now stresses that you gain the benefits of removing - backing-up states only if you remove *all* of them. - - - Documentation now points out that traditional lex allows you - to put the action on a separate line from the rule pattern if - the pattern has trailing whitespace (ugh!), but flex doesn't - support this. - - - A broken example in documentation of the difference between - inclusive and exclusive start conditions is now fixed. - - - Usage (-h) report now goes to stdout. - - - Version (-V) info now goes to stdout. - - - More #ifdef chud has been added to the parser in attempt to - deal with bison's use of alloca(). - - - "make clean" no longer deletes emacs backup files (*~). - - - Some memory leaks have been fixed. - - - A bug was fixed in which dynamically-expanded buffers were - reallocated a couple of bytes too small. - - - A bug was fixed which could cause flex to read and write beyond - the end of the input buffer. - - - -S will not be going away. - - -Changes between release 2.4.7 (03Aug94) and release 2.4.6: - - - Fixed serious bug in reading multiple files. - - - Fixed bug in scanning NUL's. - - - Fixed bug in input() returning 8-bit characters. - - - Fixed bug in matching text with embedded NUL's when - using %array or lex compatibility. - - - Fixed multiple invocations of YY_USER_ACTION when using '|' - continuation action. - - - Minor prototyping fixes. - -Changes between release 2.4.6 (04Jan94) and release 2.4.5: - - - Linking with -lfl no longer required if your program includes - its own yywrap() and main() functions. (This change will cause - problems if you have a non-ANSI compiler on a system for which - sizeof(int) != sizeof(void*) or sizeof(int) != sizeof(size_t).) - - - The use of 'extern "C++"' in FlexLexer.h has been modified to - get around an incompatibility with g++'s header files. - -Changes between release 2.4.5 (11Dec93) and release 2.4.4: - - - Fixed bug breaking C++ scanners that use REJECT or variable - trailing context. - - - Fixed serious input problem for interactive scanners on - systems for which char is unsigned. - - - Fixed bug in incorrectly treating '$' operator as variable - trailing context. - - - Fixed bug in -CF table representation that could lead to - corrupt tables. - - - Fixed fairly benign memory leak. - - - Added `extern "C++"' wrapper to FlexLexer.h header. This - should overcome the g++ 2.5.X problems mentioned in the - NEWS for release 2.4.3. - - - Changed #include of FlexLexer.h to use <> instead of "". - - - Added feature to control whether the scanner attempts to - refill the input buffer once it's exhausted. This feature - will be documented in the 2.5 release. - - -Changes between release 2.4.4 (07Dec93) and release 2.4.3: - - - Fixed two serious bugs in scanning 8-bit characters. - - - Fixed bug in YY_USER_ACTION that caused it to be executed - inappropriately (on the scanner's own internal actions, and - with incorrect yytext/yyleng values). - - - Fixed bug in pointing yyin at a new file and resuming scanning. - - - Portability fix regarding min/max/abs macros conflicting with - function definitions in standard header files. - - - Added a virtual LexerError() method to the C++ yyFlexLexer class - for reporting error messages instead of always using cerr. - - - Added warning in flexdoc that the C++ scanning class is presently - experimental and subject to considerable change between major - releases. - - -Changes between release 2.4.3 (03Dec93) and release 2.4.2: - - - Fixed bug causing fatal scanner messages to fail to print. - - - Fixed things so FlexLexer.h can be included in other C++ - sources. One side-effect of this change is that -+ and -CF - are now incompatible. - - - libfl.a now supplies private versions of the the / - string routines needed by flex and the scanners - it generates, to enhance portability to some BSD systems. - - - More robust solution to 2.4.2's flexfatal() bug fix. - - - Added ranlib of installed libfl.a. - - - Some lint tweaks. - - - NOTE: problems have been encountered attempting to build flex - C++ scanners using g++ version 2.5.X. The problem is due to an - unfortunate heuristic in g++ 2.5.X that attempts to discern between - C and C++ headers. Because FlexLexer.h is installed (by default) - in /usr/local/include and not /usr/local/lib/g++-include, g++ 2.5.X - decides that it's a C header :-(. So if you have problems, install - the header in /usr/local/lib/g++-include instead. - - -Changes between release 2.4.2 (01Dec93) and release 2.4.1: - - - Fixed bug in libfl.a referring to non-existent "flexfatal" function. - - - Modified to produce both compress'd and gzip'd tar files for - distributions (you probably don't care about this change!). - - -Changes between release 2.4.1 (30Nov93) and release 2.3.8: - - - The new '-+' flag instructs flex to generate a C++ scanner class - (thanks to Kent Williams). flex writes an implementation of the - class defined in FlexLexer.h to lex.yy.cc. You may include - multiple scanner classes in your program using the -P flag. Note - that the scanner class also provides a mechanism for creating - reentrant scanners. The scanner class uses C++ streams for I/O - instead of FILE*'s (thanks to Tom Epperly). If the flex executable's - name ends in '+' then the '-+' flag is automatically on, so creating - a symlink or copy of "flex" to "flex++" results in a version of - flex that can be used exclusively for C++ scanners. - - Note that without the '-+' flag, flex-generated scanners can still - be compiled using C++ compilers, though they use FILE*'s for I/O - instead of streams. - - See the "GENERATING C++ SCANNERS" section of flexdoc for details. - - - The new '-l' flag turns on maximum AT&T lex compatibility. In - particular, -l includes support for "yylineno" and makes yytext - be an array instead of a pointer. It does not, however, do away - with all incompatibilities. See the "INCOMPATIBILITIES WITH LEX - AND POSIX" section of flexdoc for details. - - - The new '-P' option specifies a prefix to use other than "yy" - for the scanner's globally-visible variables, and for the - "lex.yy.c" filename. Using -P you can link together multiple - flex scanners in the same executable. - - - The distribution includes a "texinfo" version of flexdoc.1, - contributed by Roland Pesch (thanks also to Marq Kole, who - contributed another version). It has not been brought up to - date, but reflects version 2.3. See MISC/flex.texinfo. - - The flex distribution will soon include G.T. Nicol's flex - manual; he is presently bringing it up-to-date for version 2.4. - - - yywrap() is now a function, and you now *must* link flex scanners - with libfl.a. - - - Site-configuration is now done via an autoconf-generated - "configure" script contributed by Francois Pinard. - - - Scanners now use fread() (or getc(), if interactive) and not - read() for input. A new "table compression" option, -Cr, - overrides this change and causes the scanner to use read() - (because read() is a bit faster than fread()). -f and -F - are now equivalent to -Cfr and -CFr; i.e., they imply the - -Cr option. - - - In the blessed name of POSIX compliance, flex supports "%array" - and "%pointer" directives in the definitions (first) section of - the scanner specification. The former specifies that yytext - should be an array (of size YYLMAX), the latter, that it should - be a pointer. The array version of yytext is universally slower - than the pointer version, but has the advantage that its contents - remain unmodified across calls to input() and unput() (the pointer - version of yytext is, still, trashed by such calls). - - "%array" cannot be used with the '-+' C++ scanner class option. - - - The new '-Ca' option directs flex to trade off memory for - natural alignment when generating a scanner's tables. In - particular, table entries that would otherwise be "short" - become "long". - - - The new '-h' option produces a summary of the flex flags. - - - The new '-V' option reports the flex version number and exits. - - - The new scanner macro YY_START returns an integer value - corresponding to the current start condition. You can return - to that start condition by passing the value to a subsequent - "BEGIN" action. You also can implement "start condition stacks" - by storing the values in an integer stack. - - - You can now redefine macros such as YY_INPUT by just #define'ing - them to some other value in the first section of the flex input; - no need to first #undef them. - - - flex now generates warnings for rules that can't be matched. - These warnings can be turned off using the new '-w' flag. If - your scanner uses REJECT then you will not get these warnings. - - - If you specify the '-s' flag but the default rule can be matched, - flex now generates a warning. - - - "yyleng" is now a global, and may be modified by the user (though - doing so and then using yymore() will yield weird results). - - - Name definitions in the first section of a scanner specification - can now include a leading '^' or trailing '$' operator. In this - case, the definition is *not* pushed back inside of parentheses. - - - Scanners with compressed tables are now "interactive" (-I option) - by default. You can suppress this attribute (which makes them - run slightly slower) using the new '-B' flag. - - - Flex now generates 8-bit scanners by default, unless you use the - -Cf or -CF compression options (-Cfe and -CFe result in 8-bit - scanners). You can force it to generate a 7-bit scanner using - the new '-7' flag. You can build flex to generate 8-bit scanners - for -Cf and -CF, too, by adding -DDEFAULT_CSIZE=256 to CFLAGS - in the Makefile. - - - You no longer need to call the scanner routine yyrestart() to - inform the scanner that you have switched to a new file after - having seen an EOF on the current input file. Instead, just - point yyin at the new file and continue scanning. - - - You no longer need to invoke YY_NEW_FILE in an <> action - to indicate you wish to continue scanning. Simply point yyin - at a new file. - - - A leading '#' no longer introduces a comment in a flex input. - - - flex no longer considers formfeed ('\f') a whitespace character. - - - %t, I'm happy to report, has been nuked. - - - The '-p' option may be given twice ('-pp') to instruct flex to - report minor performance problems as well as major ones. - - - The '-v' verbose output no longer includes start/finish time - information. - - - Newlines in flex inputs can optionally include leading or - trailing carriage-returns ('\r'), in support of several PC/Mac - run-time libraries that automatically include these. - - - A start condition of the form "<*>" makes the following rule - active in every start condition, whether exclusive or inclusive. - - - The following items have been corrected in the flex documentation: - - - '-C' table compression options *are* cumulative. - - - You may modify yytext but not lengthen it by appending - characters to the end. Modifying its final character - will affect '^' anchoring for the next rule matched - if the character is changed to or from a newline. - - - The term "backtracking" has been renamed "backing up", - since it is a one-time repositioning and not a repeated - search. What used to be the "lex.backtrack" file is now - "lex.backup". - - - Unindented "/* ... */" comments are allowed in the first - flex input section, but not in the second. - - - yyless() can only be used in the flex input source, not - externally. - - - You can use "yyrestart(yyin)" to throw away the - current contents of the input buffer. - - - To write high-speed scanners, attempt to match as much - text as possible with each rule. See MISC/fastwc/README - for more information. - - - Using the beginning-of-line operator ('^') is fairly - cheap. Using unput() is expensive. Using yyless() is - cheap. - - - An example of scanning strings with embedded escape - sequences has been added. - - - The example of backing-up in flexdoc was erroneous; it - has been corrected. - - - A flex scanner's internal buffer now dynamically grows if needed - to match large tokens. Note that growing the buffer presently - requires rescanning the (large) token, so consuming a lot of - text this way is a slow process. Also note that presently the - buffer does *not* grow if you unput() more text than can fit - into the buffer. - - - The MISC/ directory has been reorganized; see MISC/README for - details. - - - yyless() can now be used in the third (user action) section - of a scanner specification, thanks to Ceriel Jacobs. yyless() - remains a macro and cannot be used outside of the scanner source. - - - The skeleton file is no longer opened at run-time, but instead - compiled into a large string array (thanks to John Gilmore and - friends at Cygnus). You can still use the -S flag to point flex - at a different skeleton file. - - - flex no longer uses a temporary file to store the scanner's - actions. - - - A number of changes have been made to decrease porting headaches. - In particular, flex no longer uses memset() or ctime(), and - provides a single simple mechanism for dealing with C compilers - that still define malloc() as returning char* instead of void*. - - - Flex now detects if the scanner specification requires the -8 flag - but the flag was not given or on by default. - - - A number of table-expansion fencepost bugs have been fixed, - making flex more robust for generating large scanners. - - - flex more consistently identifies the location of errors in - its input. - - - YY_USER_ACTION is now invoked only for "real" actions, not for - internal actions used by the scanner for things like filling - the buffer or handling EOF. - - - The rule "[^]]" now matches any character other than a ']'; - formerly it matched any character at all followed by a ']'. - This change was made for compatibility with AT&T lex. - - - A large number of miscellaneous bugs have been found and fixed - thanks to Gerhard Wilhelms. - - - The source code has been heavily reformatted, making patches - relative to previous flex releases no longer accurate. - - -Changes between 2.3 Patch #8 (21Feb93) and 2.3 Patch #7: - - - Fixed bugs in dynamic memory allocation leading to grievous - fencepost problems when generating large scanners. - - Fixed bug causing infinite loops on character classes with 8-bit - characters in them. - - Fixed bug in matching repetitions with a lower bound of 0. - - Fixed bug in scanning NUL characters using an "interactive" scanner. - - Fixed bug in using yymore() at the end of a file. - - Fixed bug in misrecognizing rules with variable trailing context. - - Fixed bug compiling flex on Suns using gcc 2. - - Fixed bug in not recognizing that input files with the character - ASCII 128 in them require the -8 flag. - - Fixed bug that could cause an infinite loop writing out - error messages. - - Fixed bug in not recognizing old-style lex % declarations if - followed by a tab instead of a space. - - Fixed potential crash when flex terminated early (usually due - to a bad flag) and the -v flag had been given. - - Added some missing declarations of void functions. - - Changed to only use '\a' for __STDC__ compilers. - - Updated mailing addresses. - - -Changes between 2.3 Patch #7 (28Mar91) and 2.3 Patch #6: - - - Fixed out-of-bounds array access that caused bad tables - to be produced on machines where the bad reference happened - to yield a 1. This caused problems installing or running - flex on some Suns, in particular. - - -Changes between 2.3 Patch #6 (29Aug90) and 2.3 Patch #5: - - - Fixed a serious bug in yymore() which basically made it - completely broken. Thanks goes to Jean Christophe of - the Nethack development team for finding the problem - and passing along the fix. - - -Changes between 2.3 Patch #5 (16Aug90) and 2.3 Patch #4: - - - An up-to-date version of initscan.c so "make test" will - work after applying the previous patches - - -Changes between 2.3 Patch #4 (14Aug90) and 2.3 Patch #3: - - - Fixed bug in hexadecimal escapes which allowed only digits, - not letters, in escapes - - Fixed bug in previous "Changes" file! - - -Changes between 2.3 Patch #3 (03Aug90) and 2.3 Patch #2: - - - Correction to patch #2 for gcc compilation; thanks goes to - Paul Eggert for catching this. - - -Changes between 2.3 Patch #2 (02Aug90) and original 2.3 release: - - - Fixed (hopefully) headaches involving declaring malloc() - and free() for gcc, which defines __STDC__ but (often) doesn't - come with the standard include files such as . - Reordered #ifdef maze in the scanner skeleton in the hope of - getting the declarations right for cfront and g++, too. - - - Note that this patch supercedes patch #1 for release 2.3, - which was never announced but was available briefly for - anonymous ftp. - - -Changes between 2.3 (full) release of 28Jun90 and 2.2 (alpha) release: - -User-visible: - - - A lone <> rule (that is, one which is not qualified with - a list of start conditions) now specifies the EOF action for - *all* start conditions which haven't already had <> actions - given. To specify an end-of-file action for just the initial - state, use <>. - - - -d debug output is now contigent on the global yy_flex_debug - being set to a non-zero value, which it is by default. - - - A new macro, YY_USER_INIT, is provided for the user to specify - initialization action to be taken on the first call to the - scanner. This action is done before the scanner does its - own initialization. - - - yy_new_buffer() has been added as an alias for yy_create_buffer() - - - Comments beginning with '#' and extending to the end of the line - now work, but have been deprecated (in anticipation of making - flex recognize #line directives). - - - The funky restrictions on when semi-colons could follow the - YY_NEW_FILE and yyless macros have been removed. They now - behave identically to functions. - - - A bug in the sample redefinition of YY_INPUT in the documentation - has been corrected. - - - A bug in the sample simple tokener in the documentation has - been corrected. - - - The documentation on the incompatibilities between flex and - lex has been reordered so that the discussion of yylineno - and input() come first, as it's anticipated that these will - be the most common source of headaches. - - -Things which didn't used to be documented but now are: - - - flex interprets "^foo|bar" differently from lex. flex interprets - it as "match either a 'foo' or a 'bar', providing it comes at the - beginning of a line", whereas lex interprets it as "match either - a 'foo' at the beginning of a line, or a 'bar' anywhere". - - - flex initializes the global "yyin" on the first call to the - scanner, while lex initializes it at compile-time. - - - yy_switch_to_buffer() can be used in the yywrap() macro/routine. - - - flex scanners do not use stdio for their input, and hence when - writing an interactive scanner one must explictly call fflush() - after writing out a prompt. - - - flex scanner can be made reentrant (after a fashion) by using - "yyrestart( yyin );". This is useful for interactive scanners - which have interrupt handlers that long-jump out of the scanner. - - - a defense of why yylineno is not supported is included, along - with a suggestion on how to convert scanners which rely on it. - - -Other changes: - - - Prototypes and proper declarations of void routines have - been added to the flex source code, courtesy of Kevin B. Kenny. - - - Routines dealing with memory allocation now use void* pointers - instead of char* - see Makefile for porting implications. - - - Error-checking is now done when flex closes a file. - - - Various lint tweaks were added to reduce the number of gripes. - - - Makefile has been further parameterized to aid in porting. - - - Support for SCO Unix added. - - - Flex now sports the latest & greatest UC copyright notice - (which is only slightly different from the previous one). - - - A note has been added to flexdoc.1 mentioning work in progress - on modifying flex to generate straight C code rather than a - table-driven automaton, with an email address of whom to contact - if you are working along similar lines. - - -Changes between 2.2 Patch #3 (30Mar90) and 2.2 Patch #2: - - - fixed bug which caused -I scanners to bomb - - -Changes between 2.2 Patch #2 (27Mar90) and 2.2 Patch #1: - - - fixed bug writing past end of input buffer in yyunput() - - fixed bug detecting NUL's at the end of a buffer - - -Changes between 2.2 Patch #1 (23Mar90) and 2.2 (alpha) release: - - - Makefile fixes: definition of MAKE variable for systems - which don't have it; installation of flexdoc.1 along with - flex.1; fixed two bugs which could cause "bigtest" to fail. - - - flex.skel fix for compiling with g++. - - - README and flexdoc.1 no longer list an out-of-date BITNET address - for contacting me. - - - minor typos and formatting changes to flex.1 and flexdoc.1. - - -Changes between 2.2 (alpha) release of March '90 and previous release: - -User-visible: - - - Full user documentation now available. - - - Support for 8-bit scanners. - - - Scanners now accept NUL's. - - - A facility has been added for dealing with multiple - input buffers. - - - Two manual entries now. One which fully describes flex - (rather than just its differences from lex), and the - other for quick(er) reference. - - - A number of changes to bring flex closer into compliance - with the latest POSIX lex draft: - - %t support - flex now accepts multiple input files and concatenates - them together to form its input - previous -c (compress) flag renamed -C - do-nothing -c and -n flags added - Any indented code or code within %{}'s in section 2 is - now copied to the output - - - yyleng is now a bona fide global integer. - - - -d debug information now gives the line number of the - matched rule instead of which number rule it was from - the beginning of the file. - - - -v output now includes a summary of the flags used to generate - the scanner. - - - unput() and yyrestart() are now globally callable. - - - yyrestart() no longer closes the previous value of yyin. - - - C++ support; generated scanners can be compiled with C++ compiler. - - - Primitive -lfl library added, containing default main() - which calls yylex(). A number of routines currently living - in the scanner skeleton will probably migrate to here - in the future (in particular, yywrap() will probably cease - to be a macro and instead be a function in the -lfl library). - - - Hexadecimal (\x) escape sequences added. - - - Support for MS-DOS, VMS, and Turbo-C integrated. - - - The %used/%unused operators have been deprecated. They - may go away soon. - - -Other changes: - - - Makefile enhanced for easier testing and installation. - - The parser has been tweaked to detect some erroneous - constructions which previously were missed. - - Scanner input buffer overflow is now detected. - - Bugs with missing "const" declarations fixed. - - Out-of-date Minix/Atari patches provided. - - Scanners no longer require printf() unless FLEX_DEBUG is being used. - - A subtle input() bug has been fixed. - - Line numbers for "continued action" rules (those following - the special '|' action) are now correct. - - unput() bug fixed; had been causing problems porting flex to VMS. - - yymore() handling rewritten to fix bug with interaction - between yymore() and trailing context. - - EOF in actions now generates an error message. - - Bug involving -CFe and generating equivalence classes fixed. - - Bug which made -CF be treated as -Cf fixed. - - Support for SysV tmpnam() added. - - Unused #define's for scanner no longer generated. - - Error messages which are associated with a particular input - line are now all identified with their input line in standard - format. - - % directives which are valid to lex but not to flex are - now ignored instead of generating warnings. - - -DSYS_V flag can now also be specified -DUSG for System V - compilation. - - -Changes between 2.1 beta-test release of June '89 and previous release: - -User-visible: - - - -p flag generates a performance report to stderr. The report - consists of comments regarding features of the scanner rules - which result in slower scanners. - - - -b flag generates backtracking information to lex.backtrack. - This is a list of scanner states which require backtracking - and the characters on which they do so. By adding rules - one can remove backtracking states. If all backtracking states - are eliminated, the generated scanner will run faster. - Backtracking is not yet documented in the manual entry. - - - Variable trailing context now works, i.e., one can have - rules like "(foo)*/[ \t]*bletch". Some trailing context - patterns still cannot be properly matched and generate - error messages. These are patterns where the ending of the - first part of the rule matches the beginning of the second - part, such as "zx*/xy*", where the 'x*' matches the 'x' at - the beginning of the trailing context. Lex won't get these - patterns right either. - - - Faster scanners. - - - End-of-file rules. The special rule "<>" indicates - actions which are to be taken when an end-of-file is - encountered and yywrap() returns non-zero (i.e., indicates - no further files to process). See manual entry for example. - - - The -r (reject used) flag is gone. flex now scans the input - for occurrences of the string "REJECT" to determine if the - action is needed. It tries to be intelligent about this but - can be fooled. One can force the presence or absence of - REJECT by adding a line in the first section of the form - "%used REJECT" or "%unused REJECT". - - - yymore() has been implemented. Similarly to REJECT, flex - detects the use of yymore(), which can be overridden using - "%used" or "%unused". - - - Patterns like "x{0,3}" now work (i.e., with lower-limit == 0). - - - Removed '\^x' for ctrl-x misfeature. - - - Added '\a' and '\v' escape sequences. - - - \ now works for octal escape sequences; previously - \0 was required. - - - Better error reporting; line numbers are associated with rules. - - - yyleng is a macro; it cannot be accessed outside of the - scanner source file. - - - yytext and yyleng should not be modified within a flex action. - - - Generated scanners #define the name FLEX_SCANNER. - - - Rules are internally separated by YY_BREAK in lex.yy.c rather - than break, to allow redefinition. - - - The macro YY_USER_ACTION can be redefined to provide an action - which is always executed prior to the matched rule's action. - - - yyrestart() is a new action which can be used to restart - the scanner after it has seen an end-of-file (a "real" one, - that is, one for which yywrap() returned non-zero). It takes - a FILE* argument indicating a new file to scan and sets - things up so that a subsequent call to yylex() will start - scanning that file. - - - Internal scanner names all preceded by "yy_" - - - lex.yy.c is deleted if errors are encountered during processing. - - - Comments may be put in the first section of the input by preceding - them with '#'. - - - -Other changes: - - - Some portability-related bugs fixed, in particular for machines - with unsigned characters or sizeof( int* ) != sizeof( int ). - Also, tweaks for VMS and Microsoft C (MS-DOS), and identifiers all - trimmed to be 31 or fewer characters. Shortened file names - for dinosaur OS's. Checks for allocating > 64K memory - on 16 bit'ers. Amiga tweaks. Compiles using gcc on a Sun-3. - - Compressed and fast scanner skeletons merged. - - Skeleton header files done away with. - - Generated scanner uses prototypes and "const" for __STDC__. - - -DSV flag is now -DSYS_V for System V compilation. - - Removed all references to FTL language. - - Software now covered by BSD Copyright. - - flex will replace lex in subsequent BSD releases. diff --git a/src/bin/flex/README b/src/bin/flex/README deleted file mode 100644 index a27e531fdb..0000000000 --- a/src/bin/flex/README +++ /dev/null @@ -1,69 +0,0 @@ -This is flex, the fast lexical analyzer generator. - -flex is a tool for generating scanners: programs which recognize -lexical patterns in text. - -More information about flex as well as the latest official release of -flex can be found at: - -http://flex.sourceforge.net/ - -Of particular interest is the mailing list -flex-announce@lists.sourceforge.net as that is where posts will be made -announcing new releases of flex. - -Note that flex is distributed under a copyright very similar to that of -BSD Unix, and not under the GNU General Public License (GPL). - -This file is part of flex. - -This code is derived from software contributed to Berkeley by -Vern Paxson. - -The United States Government has rights in this work pursuant -to contract no. DE-AC03-76SF00098 between the United States -Department of Energy and the University of California. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -Neither the name of the University nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. - -Please send bug reports and feedback to flex-help@lists.sourceforge.net. - -The flex distribution contains the following files which may be of interest: - -README - This file. - -NEWS - current version number and list of user-visible changes. - -INSTALL - basic installation information. - -ABOUT-NLS - description of internationalization support in flex. - -COPYING - flex's copyright and license. - -doc/ - user documentation. - -examples/ - containing examples of some possible flex scanners and a -few other things. See the file examples/README for more details. - -TODO - outstanding bug reports, desired features, etc. - -tests/ - regression tests. See TESTS/README for details. - -po/ - internationalization support files. diff --git a/src/bin/flex/README-alpha b/src/bin/flex/README-alpha deleted file mode 100644 index ef3b82f2ae..0000000000 --- a/src/bin/flex/README-alpha +++ /dev/null @@ -1,2 +0,0 @@ -Beta versions and cvs snapshots of flex can be had at -ftp://ftp.uncg.edu/people/wlestes/. diff --git a/src/bin/flex/README.cvs-snapshot b/src/bin/flex/README.cvs-snapshot deleted file mode 100644 index 45c9edb6a4..0000000000 --- a/src/bin/flex/README.cvs-snapshot +++ /dev/null @@ -1,46 +0,0 @@ -This file gives information regarding cvs snapshots of flex. cvs -snapshots of flex contain the files which are under version control by -the flex maintainers for the flex project. These snapshots can be -found at: - -ftp://ftp.uncg.edu/people/wlestes/ - -If you are not interested in flex development or you are not in need -of the latest bleeding-edge features, then cvs snapshots of flex are -not for you. - -When you get a distribution of flex, a large number of intermediate -files needed to make building flex easy are included. You don't have -that in a cvs snapshot. - -You will need various external tools in order to build the distribution. Here is -a (possibly incomplete) list of the required tools. Always get the latest -version of each tool; we list the versions used in development of -flex, but the listed versions may not work for you. - -compiler suite; e.g., gcc -bash or some other fairly robust sh-style shell -GNU bison; to generate parse.c from parse.y -GNU m4 1.4; required by BNU autoconf (yes, it *must* be GNU m4) -GNU autoconf 2.54 and GNU automake 1.7; for generating Makefiles etc. -GNU gettext 0.11.5; for i18n -flex (latest beta release); for bootstrap of scan.l -help2man 1.27; to generate man page -tar, gzip, etc.; for packaging of the source distribution -GNU texinfo 4.3d; to build and test the flex manual -perl; GNU automake and GNU autoconf now depend on perl to run -GNU indent 2.8; for indenting the flex source the way we want it done - -ONce you have all the necessary tools installed, life becomes -simple. To prepare the flex tree for building, run the script: - -$ ./autogen.sh - -in the top level of the flex source tree. -This script calls the various tools needed to get flex ready for the -GNU-style configure script to be able to work. - -From this point on, building flex follows the usual configure, make, -make install routine, almost. When configuring the flex tree, pass the ---enable-maintainer-mode option to configure. If you forget, you will -see errors about a missing file `version.texi'. diff --git a/src/bin/flex/THANKS b/src/bin/flex/THANKS deleted file mode 100644 index ac91ef62f7..0000000000 --- a/src/bin/flex/THANKS +++ /dev/null @@ -1,53 +0,0 @@ -Vern had the following things to say: - -Many thanks to the 2.5 beta-testers for finding bugs and helping test and -increase portability: Stan Adermann, Scott David Daniels, Charles Elliott, -Joe Gayda, Chris Meier, James Nordby, Terrence O'Kane, Karsten Pahnke, -Francois Pinard, Pat Rankin, Andreas Scherer, Marc Wiese, Nathan Zelle. - -Thanks to the many flex beta-testers, feedbackers, and contributors, -especially Francois Pinard, Casey Leedom, Robert Abramovitz, Stan -Adermann, Terry Allen, David Barker-Plummer, John Basrai, Neal Becker, -Nelson H.F. Beebe, benson@odi.com, Karl Berry, Peter A. Bigot, Simon -Blanchard, Keith Bostic, Frederic Brehm, Ian Brockbank, Kin Cho, Nick -Christopher, Brian Clapper, J.T. Conklin, Jason Coughlin, Bill Cox, -Nick Cropper, Dave Curtis, Scott David Daniels, Chris G. Demetriou, -Theo Deraadt, Mike Donahue, Chuck Doucette, Tom Epperly, Leo Eskin, -Chris Faylor, Chris Flatters, Jon Forrest, Jeffrey Friedl, Joe Gayda, -Kaveh R. Ghazi, Wolfgang Glunz, Eric Goldman, Christopher M. Gould, -Ulrich Grepel, Peer Griebel, Jan Hajic, Charles Hemphill, NORO Hideo, -Jarkko Hietaniemi, Scott Hofmann, Jeff Honig, Dana Hudes, Eric Hughes, -John Interrante, Ceriel Jacobs, Michal Jaegermann, Sakari Jalovaara, -Jeffrey R. Jones, Henry Juengst, Klaus Kaempf, Jonathan I. Kamens, -Terrence O Kane, Amir Katz, ken@ken.hilco.com, Kevin B. Kenny, Steve -Kirsch, Winfried Koenig, Marq Kole, Ronald Lamprecht, Greg Lee, Rohan -Lenard, Craig Leres, John Levine, Steve Liddle, David Loffredo, Mike -Long, Mohamed el Lozy, Brian Madsen, Malte, Joe Marshall, Bengt -Martensson, Chris Metcalf, Luke Mewburn, Jim Meyering, R. Alexander -Milowski, Erik Naggum, G.T. Nicol, Landon Noll, James Nordby, Marc -Nozell, Richard Ohnemus, Karsten Pahnke, Sven Panne, Roland Pesch, -Walter Pelissero, Gaumond Pierre, Esmond Pitt, Jef Poskanzer, Joe -Rahmeh, Jarmo Raiha, Frederic Raimbault, Pat Rankin, Rick Richardson, -Kevin Rodgers, Kai Uwe Rommel, Jim Roskind, Alberto Santini, Andreas -Scherer, Darrell Schiebel, Raf Schietekat, Doug Schmidt, Philippe -Schnoebelen, Andreas Schwab, Larry Schwimmer, Alex Siegel, Eckehard -Stolz, Jan-Erik Strvmquist, Mike Stump, Paul Stuart, Dave Tallman, Ian -Lance Taylor, Chris Thewalt, Richard M. Timoney, Jodi Tsai, Paul -Tuinenga, Gary Weik, Frank Whaley, Gerhard Wilhelms, Kent Williams, -Ken Yap, Ron Zellar, Nathan Zelle, David Zuhn, and those whose names -have slipped my marginal mail-archiving skills but whose contributions -are appreciated all the same. - -Thanks to Keith Bostic, Jon Forrest, Noah Friedman, -John Gilmore, Craig Leres, John Levine, Bob Mulcahy, G.T. -Nicol, Francois Pinard, Rich Salz, and Richard Stallman for help with various -distribution headaches. - -Thanks to Esmond Pitt and Earle Horton for 8-bit character support; to -Benson Margulies and Fred Burke for C++ support; to Kent Williams and Tom -Epperly for C++ class support; to Ove Ewerlid for support of NUL's; and to -Eric Hughes for support of multiple buffers. - -This work was primarily done when I was with the Real Time Systems Group -at the Lawrence Berkeley Laboratory in Berkeley, CA. Many thanks to all there -for the support I received. diff --git a/src/bin/flex/TODO b/src/bin/flex/TODO deleted file mode 100644 index 0ab33f1cef..0000000000 --- a/src/bin/flex/TODO +++ /dev/null @@ -1,101 +0,0 @@ -* sourceforge migration - -** Move CVS to sourceforge (estes) %% - -** test the mailing lists (estes) %% - -** inform GNU folks about changeover (estes) %% - -* resolve the items in the to.do directory - -** expand the above into individual requests and handle those requests - -** transfer to.do/Wishlist contents to top level TODO file - -* the manual: - -** do an end-to-end proofread of the manual (this is under way, but is - going slowly) - -** pretty up the dvi output; overflows, etc. - -** faq - -*** clean up the faqs section. The information is good; the texinfo - could use some touching up. - -*** index the faq entries - -*** mention that it's possible to use a variable to scan matching - brackets, nested comments etc. - -*** include something about lexing/parsing fortran - -** create a section on flex design, features, etc. - -* address lex-replacement: document or provide an option through - configure for creating lex and libl.a files (but remember this has - posix implications) - -* getext - -** make sure all flex modules use gettext translation facilities - -*subdirectories - -** in examples/manual, integrate the Makefile.examples into the - Makefile.am - -* test suite - -** integrate the test suite into automake's framework (note that the - test suite can be run from the top level directory with "make - check". Still, we want to get it completely under automake's control.) - -** make test suite more complete - -* generic coding - -** move as much skeleton code as possible out of gen.c and into - flex.skl - -** figure out whether we want to add the capability to have - auto-generated backout rules - -** token-type and token buffer support - -** check if we still need to #undef macros at the end of a header - -** merge yylineno into support for location tracking - -** bug where yylineno is not decremented on REJECT - -** bug where yylineno is counted in trailing context - -* C++ - -** have a separate skeleton for c++ - -** c++ is getting so broken and different from C, that we need to - reevaluate the usefuleness of c++ in flex - -** revisit the C++ API. We get requests to make it more complete. - -* distribution - -** use bootstrapper - -** remove texinfo.tex from the cvs tree; it only needs to be present - on the system where the flex release is put together - -** use clcommit to manage ChangeLog - -Legend: - -*, **, ***: outline depth -%% at end of item: must be adressed before next major release - -Local Variables: -Mode: text -mode: outline-minor -End: diff --git a/src/bin/flex/aclocal.m4 b/src/bin/flex/aclocal.m4 deleted file mode 100644 index 76aa2debbf..0000000000 --- a/src/bin/flex/aclocal.m4 +++ /dev/null @@ -1,2898 +0,0 @@ -# generated automatically by aclocal 1.7.5 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 -# 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. - -# Do all the work for Automake. -*- Autoconf -*- - -# 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. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 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 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 10 - -AC_PREREQ([2.54]) - -# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow -# the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl - -# 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_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl - AC_REQUIRE([AC_PROG_INSTALL])dnl -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi - -# 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 - 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_MISSING_PROG(AMTAR, tar) -AM_PROG_INSTALL_SH -AM_PROG_INSTALL_STRIP -# 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([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 -]) -]) - - -# 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_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $1 | $1:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) - -# Copyright 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 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - -# 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. -AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"]) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.7.5])]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright 2001, 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 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - -# _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. -# - -# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -# 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)]) - -# -*- Autoconf -*- - - -# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -# 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 -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 -]) - -# AM_AUX_DIR_EXPAND - -# Copyright 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# 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. - -# Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50]) - -AC_DEFUN([AM_AUX_DIR_EXPAND], [ -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. - -# Copyright 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) - -# AM_PROG_INSTALL_STRIP - -# Copyright 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# 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="\${SHELL} \$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# -*- Autoconf -*- -# 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 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 - -# 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])]) - -# serial 5 -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 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 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - - -# 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], 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 - - 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 - # 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. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}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=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \ - >/dev/null 2>conftest.err && - grep conftest.h 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 - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' 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 builds - --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]) -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright 1999, 2000, 2001, 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 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -#serial 2 - -# _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. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` - test -z "$DEPDIR" && continue - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # 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 -e ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //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"]) -]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 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 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - -# 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 -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 5 - -AC_PREREQ(2.52) - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE]) -AC_SUBST([$1_FALSE]) -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])]) - -# gettext.m4 serial 20 (gettext-0.12) -dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -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. - -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], [no], [yes])) - define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) - - 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 test "$gt_cv_func_gnugettext_libc" != "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 Set USE_NLS. - AM_NLS - - ifelse(gt_included_intl, yes, [ - BUILD_INCLUDED_LIBINTL=no - USE_INCLUDED_LIBINTL=no - ]) - LIBINTL= - LTLIBINTL= - POSUB= - - 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. - - dnl Add a version number to the cache macros. - define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) - define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) - define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) - - AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, - [AC_TRY_LINK([#include -]ifelse([$2], [need-formatstring-macros], -[#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 -], [])[extern int _nl_msg_cat_cntr; -extern int *_nl_domain_bindings;], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], - gt_cv_func_gnugettext_libc=yes, - gt_cv_func_gnugettext_libc=no)]) - - if test "$gt_cv_func_gnugettext_libc" != "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_cv_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 -]ifelse([$2], [need-formatstring-macros], -[#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 -], [])[extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias ();], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], - gt_cv_func_gnugettext_libintl=yes, - gt_cv_func_gnugettext_libintl=no) - dnl Now see whether libintl exists and depends on libiconv. - if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then - LIBS="$LIBS $LIBICONV" - AC_TRY_LINK([#include -]ifelse([$2], [need-formatstring-macros], -[#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 -], [])[extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias ();], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], - [LIBINTL="$LIBINTL $LIBICONV" - LTLIBINTL="$LTLIBINTL $LTLIBICONV" - gt_cv_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 test "$gt_cv_func_gnugettext_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext_libintl" = "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" - LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` - fi - - 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 "$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 test "$gt_cv_func_gnugettext_libintl" = "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 test "$gt_cv_func_gnugettext_libintl" = "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. - 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 Checks for all prerequisites of the intl subdirectory, -dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, -dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. -AC_DEFUN([AM_INTL_SUBDIR], -[ - AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AM_MKINSTALLDIRS])dnl - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - AC_REQUIRE([AC_PROG_RANLIB])dnl - AC_REQUIRE([AC_ISC_POSIX])dnl - AC_REQUIRE([AC_HEADER_STDC])dnl - AC_REQUIRE([AC_C_CONST])dnl - AC_REQUIRE([AC_C_INLINE])dnl - AC_REQUIRE([AC_TYPE_OFF_T])dnl - AC_REQUIRE([AC_TYPE_SIZE_T])dnl - AC_REQUIRE([AC_FUNC_ALLOCA])dnl - AC_REQUIRE([AC_FUNC_MMAP])dnl - AC_REQUIRE([jm_GLIBC21])dnl - AC_REQUIRE([gt_INTDIV0])dnl - AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl - AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl - AC_REQUIRE([gt_INTTYPES_PRI])dnl - - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ -stdlib.h string.h unistd.h sys/param.h]) - AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ -geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ -strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \ -__fsetlocking]) - - AM_ICONV - AM_LANGINFO_CODESET - if test $ac_cv_header_locale_h = yes; then - AM_LC_MESSAGES - fi - - dnl intl/plural.c is generated from intl/plural.y. It requires bison, - dnl because plural.y uses bison specific features. It requires at least - dnl bison-1.26 because earlier versions generate a plural.c that doesn't - dnl compile. - dnl bison is only needed for the maintainer (who touches plural.y). But in - dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put - dnl the rule in general Makefile. Now, some people carelessly touch the - dnl files or have a broken "make" program, hence the plural.c rule will - dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not - dnl present or too old. - AC_CHECK_PROGS([INTLBISON], [bison]) - if test -z "$INTLBISON"; then - ac_verc_fail=yes - else - dnl Found it, now check the version. - AC_MSG_CHECKING([version of bison]) -changequote(<<,>>)dnl - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) -changequote([,])dnl - ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; - *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; - esac - AC_MSG_RESULT([$ac_prog_version]) - fi - if test $ac_verc_fail = yes; then - INTLBISON=: - fi -]) - - -dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) -AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) - -# po.m4 serial 1 (gettext-0.12) -dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -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. - -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_MKINSTALLDIRS])dnl - AC_REQUIRE([AM_NLS])dnl - - 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 >/dev/null 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 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 >/dev/null 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 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 >/dev/null 2>&1], :) - - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU msgfmt. - if test "$GMSGFMT" != ":"; then - dnl If it is no GNU msgfmt we define it as : so that the - dnl Makefiles still can work. - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && - (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` - AC_MSG_RESULT( - [found $GMSGFMT program is not GNU msgfmt; ignore it]) - GMSGFMT=":" - fi - fi - - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU xgettext. - if test "$XGETTEXT" != ":"; then - dnl If it is no GNU xgettext we define it as : so that the - dnl Makefiles still can work. - if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && - (if $XGETTEXT --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 - : ; - else - AC_MSG_RESULT( - [found xgettext program is not GNU xgettext; ignore it]) - XGETTEXT=":" - fi - dnl Remove leftover from FreeBSD xgettext call. - rm -f messages.po - fi - - AC_OUTPUT_COMMANDS([ - 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 - 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, GMOFILES, UPDATEPOFILES, DUMMYPOFILES 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" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake. - eval 'ALL_LINGUAS''=$ALL_LINGUAS_' - POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" - else - # The set of available languages was given in configure.in. - eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' - fi - case "$ac_given_srcdir" in - .) srcdirpre= ;; - *) srcdirpre='$(srcdir)/' ;; - esac - POFILES= - GMOFILES= - UPDATEPOFILES= - DUMMYPOFILES= - for lang in $ALL_LINGUAS; do - POFILES="$POFILES $srcdirpre$lang.po" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" - DUMMYPOFILES="$DUMMYPOFILES $lang.nop" - 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|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|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, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it - # from automake. - eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' - # Capture the value of LINGUAS because we need it to compute CATALOGS. - LINGUAS="${LINGUAS-%UNSET%}" - ]) -]) - -# nls.m4 serial 1 (gettext-0.12) -dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -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_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) -]) - -AC_DEFUN([AM_MKINSTALLDIRS], -[ - dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly - dnl find the mkinstalldirs script in another subdir but $(top_srcdir). - dnl Try to locate it. - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - case "$ac_aux_dir" in - /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; - *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; - esac - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - AC_SUBST(MKINSTALLDIRS) -]) - -# progtest.m4 serial 3 (gettext-0.12) -dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -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 , 1996. - -# 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 - 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 -]) - -# lib-prefix.m4 serial 2 (gettext-0.12) -dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -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_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/lib" - 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*) 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/lib"; 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/lib"; 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" -]) - -# lib-link.m4 serial 4 (gettext-0.12) -dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -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. -AC_DEFUN([AC_LIB_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([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" - ]) - LIB[]NAME="$ac_cv_lib[]Name[]_libs" - LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" - INC[]NAME="$ac_cv_lib[]Name[]_cppflags" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - 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 - undefine([Name]) - undefine([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. -AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([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= - fi - AC_SUBST([HAVE_LIB]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - undefine([Name]) - undefine([NAME]) -]) - -dnl Determine the platform dependent parameters needed to use rpath: -dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, -dnl hardcode_direct, hardcode_minus_L. -AC_DEFUN([AC_LIB_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" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - 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_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. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - 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$1-prefix], -[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib - --without-lib$1-prefix don't search for lib$1 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/lib" - 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= - 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= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - 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//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - 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/lib"; 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 "$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 "$hardcode_libdir_flag_spec" && test "$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 "$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 $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 - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - 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*) 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/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) 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 "$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:+$hardcode_libdir_separator}$found_dir" - done - dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$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=\"$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 -]) - -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 -]) - -# lib-ld.m4 serial 2 (gettext-0.12) -dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -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. -if $LD -v 2>&1 &5; then - acl_cv_prog_gnu_ld=yes -else - acl_cv_prog_gnu_ld=no -fi]) -with_gnu_ld=$acl_cv_prog_gnu_ld -]) - -dnl From libtool-1.4. Sets the variable LD. -AC_DEFUN([AC_LIB_PROG_LD], -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -# 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. - 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. - if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - 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 -]) - -# iconv.m4 serial AM4 (gettext-0.11.3) -dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -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). - - 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_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) - 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 -]) - -# isc-posix.m4 serial 2 (gettext-0.11.2) -dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. - -# This test replaces the one in autoconf. -# Currently this macro should have the same name as the autoconf macro -# because gettext's gettext.m4 (distributed in the automake package) -# still uses it. Otherwise, the use in gettext.m4 makes autoheader -# give these diagnostics: -# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX -# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX - -undefine([AC_ISC_POSIX]) - -AC_DEFUN([AC_ISC_POSIX], - [ - dnl This test replaces the obsolescent AC_ISC_POSIX kludge. - AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) - ] -) - -# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40) -dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -# Test for the GNU C Library, version 2.1 or newer. -# From Bruno Haible. - -AC_DEFUN([jm_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" - ] -) - -# intdiv0.m4 serial 1 (gettext-0.11.3) -dnl Copyright (C) 2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -AC_DEFUN([gt_INTDIV0], -[ - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - - AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], - gt_cv_int_divbyzero_sigfpe, - [ - AC_TRY_RUN([ -#include -#include - -static void -#ifdef __cplusplus -sigfpe_handler (int sig) -#else -sigfpe_handler (sig) int sig; -#endif -{ - /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ - exit (sig != SIGFPE); -} - -int x = 1; -int y = 0; -int z; -int nan; - -int main () -{ - signal (SIGFPE, sigfpe_handler); -/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ -#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) - signal (SIGTRAP, sigfpe_handler); -#endif -/* Linux/SPARC yields signal SIGILL. */ -#if defined (__sparc__) && defined (__linux__) - signal (SIGILL, sigfpe_handler); -#endif - - z = x / y; - nan = y / y; - exit (1); -} -], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, - [ - # Guess based on the CPU. - case "$host_cpu" in - alpha* | i[34567]86 | m68k | s390*) - gt_cv_int_divbyzero_sigfpe="guessing yes";; - *) - gt_cv_int_divbyzero_sigfpe="guessing no";; - esac - ]) - ]) - case "$gt_cv_int_divbyzero_sigfpe" in - *yes) value=1;; - *) value=0;; - esac - AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, - [Define if integer division by zero raises signal SIGFPE.]) -]) - -# uintmax_t.m4 serial 7 (gettext-0.12) -dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Paul Eggert. - -AC_PREREQ(2.13) - -# Define uintmax_t to 'unsigned long' or 'unsigned long long' -# if it is not already defined in or . - -AC_DEFUN([jm_AC_TYPE_UINTMAX_T], -[ - AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) - AC_REQUIRE([jm_AC_HEADER_STDINT_H]) - if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then - AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) - test $ac_cv_type_unsigned_long_long = yes \ - && ac_type='unsigned long long' \ - || ac_type='unsigned long' - AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, - [Define to unsigned long or unsigned long long - if and don't define.]) - else - AC_DEFINE(HAVE_UINTMAX_T, 1, - [Define if you have the 'uintmax_t' type in or .]) - fi -]) - -# inttypes_h.m4 serial 5 (gettext-0.12) -dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Paul Eggert. - -# Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, -# doesn't clash with , and declares uintmax_t. - -AC_DEFUN([jm_AC_HEADER_INTTYPES_H], -[ - AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, - [AC_TRY_COMPILE( - [#include -#include ], - [uintmax_t i = (uintmax_t) -1;], - jm_ac_cv_header_inttypes_h=yes, - jm_ac_cv_header_inttypes_h=no)]) - if test $jm_ac_cv_header_inttypes_h = yes; then - AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, - [Define if exists, doesn't clash with , - and declares uintmax_t. ]) - fi -]) - -# stdint_h.m4 serial 3 (gettext-0.12) -dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Paul Eggert. - -# Define HAVE_STDINT_H_WITH_UINTMAX if exists, -# doesn't clash with , and declares uintmax_t. - -AC_DEFUN([jm_AC_HEADER_STDINT_H], -[ - AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h, - [AC_TRY_COMPILE( - [#include -#include ], - [uintmax_t i = (uintmax_t) -1;], - jm_ac_cv_header_stdint_h=yes, - jm_ac_cv_header_stdint_h=no)]) - if test $jm_ac_cv_header_stdint_h = yes; then - AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, - [Define if exists, doesn't clash with , - and declares uintmax_t. ]) - fi -]) - -# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40) -dnl Copyright (C) 1999-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Paul Eggert. - -AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG], -[ - AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, - [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], - [unsigned long long ullmax = (unsigned long long) -1; - return ull << i | ull >> i | ullmax / ull | ullmax % ull;], - ac_cv_type_unsigned_long_long=yes, - ac_cv_type_unsigned_long_long=no)]) - if test $ac_cv_type_unsigned_long_long = yes; then - AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, - [Define if you have the unsigned long long type.]) - fi -]) - -# inttypes.m4 serial 1 (gettext-0.11.4) -dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Paul Eggert. - -# Define HAVE_INTTYPES_H if exists and doesn't clash with -# . - -AC_DEFUN([gt_HEADER_INTTYPES_H], -[ - AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, - [ - AC_TRY_COMPILE( - [#include -#include ], - [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) - ]) - if test $gt_cv_header_inttypes_h = yes; then - AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, - [Define if exists and doesn't clash with .]) - fi -]) - -# inttypes-pri.m4 serial 1 (gettext-0.11.4) -dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -# 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_REQUIRE([gt_HEADER_INTTYPES_H]) - if test $gt_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.]) - fi -]) - -# codeset.m4 serial AM1 (gettext-0.10.40) -dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -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);], - 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 -]) - -# lcmessage.m4 serial 3 (gettext-0.11.3) -dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -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. - -# Check whether LC_MESSAGES is available in . - -AC_DEFUN([AM_LC_MESSAGES], -[ - AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, - [AC_TRY_LINK([#include ], [return LC_MESSAGES], - am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) - if test $am_cv_val_LC_MESSAGES = yes; then - AC_DEFINE(HAVE_LC_MESSAGES, 1, - [Define if your file defines LC_MESSAGES.]) - fi -]) - - -# Copyright 1998, 1999, 2000, 2001, 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 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -AC_PREREQ(2.50) - -# AM_PROG_LEX -# ----------- -# Autoconf leaves LEX=: if lex or flex can't be found. Change that to a -# "missing" invocation, for better error output. -AC_DEFUN([AM_PROG_LEX], -[AC_REQUIRE([AM_MISSING_HAS_RUN])dnl -AC_REQUIRE([AC_PROG_LEX])dnl -if test "$LEX" = :; then - LEX=${am_missing_run}flex -fi]) - diff --git a/src/bin/flex/autogen.sh b/src/bin/flex/autogen.sh deleted file mode 100755 index 20e82fdb06..0000000000 --- a/src/bin/flex/autogen.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -# This file is part of flex. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: - -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. - -# Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. - -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE. - -# If you see no configure script, then run ./autogen.sh to create it -# and procede with the "normal" build procedures. - -#if we pretend to have a ChangeLog, then automake is less -#worried. (Don't worry, we *do* have a ChangeLog, we just need the -#Makefile first.) - -touch ChangeLog -autoreconf --install --verbose diff --git a/src/bin/flex/buf.c b/src/bin/flex/buf.c deleted file mode 100644 index fb3bbd1e0e..0000000000 --- a/src/bin/flex/buf.c +++ /dev/null @@ -1,254 +0,0 @@ -/* flex - tool to generate fast lexical analyzers */ - -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -#include "flexdef.h" - -/* Take note: The buffer object is sometimes used as a String buffer (one - * continuous string), and sometimes used as a list of strings, usually line by - * line. - * - * The type is specified in buf_init by the elt_size. If the elt_size is - * sizeof(char), then the buffer should be treated as string buffer. If the - * elt_size is sizeof(char*), then the buffer should be treated as a list of - * strings. - * - * Certain functions are only appropriate for one type or the other. - */ - -/* global buffers. */ -struct Buf userdef_buf; /**< for user #definitions triggered by cmd-line. */ -struct Buf defs_buf; /**< for #define's autogenerated. List of strings. */ -struct Buf yydmap_buf; /**< string buffer to hold yydmap elements */ -struct Buf m4defs_buf; /**< m4 definitions. List of strings. */ -struct Buf top_buf; /**< contains %top code. String buffer. */ - -struct Buf *buf_print_strings(struct Buf * buf, FILE* out) -{ - int i; - - if(!buf || !out) - return buf; - - for (i=0; i < buf->nelts; i++){ - const char * s = ((char**)buf->elts)[i]; - if(s) - fprintf(out, "%s", s); - } - return buf; -} - -/* Append a "%s" formatted string to a string buffer */ -struct Buf *buf_prints (struct Buf *buf, const char *fmt, const char *s) -{ - char *t; - - t = flex_alloc (strlen (fmt) + strlen (s) + 1); - sprintf (t, fmt, s); - buf = buf_strappend (buf, t); - flex_free (t); - return buf; -} - -/** Append a line directive to the string buffer. - * @param buf A string buffer. - * @param filename file name - * @param lineno line number - * @return buf - */ -struct Buf *buf_linedir (struct Buf *buf, const char* filename, int lineno) -{ - char *t, *fmt = "#line %d \"%s\"\n"; - - t = flex_alloc (strlen (fmt) + strlen (filename) + (int)(1 + log10(lineno>=0?lineno:-lineno)) + 1); - sprintf (t, fmt, lineno, filename); - buf = buf_strappend (buf, t); - flex_free (t); - return buf; -} - - -/** Append the contents of @a src to @a dest. - * @param @a dest the destination buffer - * @param @a dest the source buffer - * @return @a dest - */ -struct Buf *buf_concat(struct Buf* dest, const struct Buf* src) -{ - buf_append(dest, src->elts, src->nelts); - return dest; -} - - -/* Appends n characters in str to buf. */ -struct Buf *buf_strnappend (buf, str, n) - struct Buf *buf; - const char *str; - int n; -{ - buf_append (buf, str, n + 1); - - /* "undo" the '\0' character that buf_append() already copied. */ - buf->nelts--; - - return buf; -} - -/* Appends characters in str to buf. */ -struct Buf *buf_strappend (buf, str) - struct Buf *buf; - const char *str; -{ - return buf_strnappend (buf, str, strlen (str)); -} - -/* appends "#define str def\n" */ -struct Buf *buf_strdefine (buf, str, def) - struct Buf *buf; - const char *str; - const char *def; -{ - buf_strappend (buf, "#define "); - buf_strappend (buf, " "); - buf_strappend (buf, str); - buf_strappend (buf, " "); - buf_strappend (buf, def); - buf_strappend (buf, "\n"); - return buf; -} - -/** Pushes "m4_define( [[def]], [[val]])m4_dnl" to end of buffer. - * @param buf A buffer as a list of strings. - * @param def The m4 symbol to define. - * @param val The definition; may be NULL. - * @return buf - */ -struct Buf *buf_m4_define (struct Buf *buf, const char* def, const char* val) -{ - const char * fmt = "m4_define( [[%s]], [[%s]])m4_dnl\n"; - char * str; - - val = val?val:""; - str = (char*)flex_alloc(strlen(fmt) + strlen(def) + strlen(val) + 2); - - sprintf(str, fmt, def, val); - buf_append(buf, &str, 1); - return buf; -} - -/** Pushes "m4_undefine([[def]])m4_dnl" to end of buffer. - * @param buf A buffer as a list of strings. - * @param def The m4 symbol to undefine. - * @return buf - */ -struct Buf *buf_m4_undefine (struct Buf *buf, const char* def) -{ - const char * fmt = "m4_undefine( [[%s]])m4_dnl\n"; - char * str; - - str = (char*)flex_alloc(strlen(fmt) + strlen(def) + 2); - - sprintf(str, fmt, def); - buf_append(buf, &str, 1); - return buf; -} - -/* create buf with 0 elements, each of size elem_size. */ -void buf_init (buf, elem_size) - struct Buf *buf; - size_t elem_size; -{ - buf->elts = (void *) 0; - buf->nelts = 0; - buf->elt_size = elem_size; - buf->nmax = 0; -} - -/* frees memory */ -void buf_destroy (buf) - struct Buf *buf; -{ - if (buf && buf->elts) - flex_free (buf->elts); - buf->elts = (void *) 0; -} - - -/* appends ptr[] to buf, grow if necessary. - * n_elem is number of elements in ptr[], NOT bytes. - * returns buf. - * We grow by mod(512) boundaries. - */ - -struct Buf *buf_append (buf, ptr, n_elem) - struct Buf *buf; - const void *ptr; - int n_elem; -{ - int n_alloc = 0; - - if (!ptr || n_elem == 0) - return buf; - - /* May need to alloc more. */ - if (n_elem + buf->nelts > buf->nmax) { - - /* exact amount needed... */ - n_alloc = (n_elem + buf->nelts) * buf->elt_size; - - /* ...plus some extra */ - if (((n_alloc * buf->elt_size) % 512) != 0 - && buf->elt_size < 512) - n_alloc += - (512 - - ((n_alloc * buf->elt_size) % 512)) / - buf->elt_size; - - if (!buf->elts) - buf->elts = - allocate_array (n_alloc, buf->elt_size); - else - buf->elts = - reallocate_array (buf->elts, n_alloc, - buf->elt_size); - - buf->nmax = n_alloc; - } - - memcpy ((char *) buf->elts + buf->nelts * buf->elt_size, ptr, - n_elem * buf->elt_size); - buf->nelts += n_elem; - - return buf; -} - -/* vim:set tabstop=8 softtabstop=4 shiftwidth=4: */ diff --git a/src/bin/flex/ccl.c b/src/bin/flex/ccl.c deleted file mode 100644 index 1e3c0bbbe3..0000000000 --- a/src/bin/flex/ccl.c +++ /dev/null @@ -1,199 +0,0 @@ -/* ccl - routines for character classes */ - -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ - /* Department of Energy and the University of California. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -#include "flexdef.h" - -/* ccladd - add a single character to a ccl */ - -void ccladd (cclp, ch) - int cclp; - int ch; -{ - int ind, len, newpos, i; - - check_char (ch); - - len = ccllen[cclp]; - ind = cclmap[cclp]; - - /* check to see if the character is already in the ccl */ - - for (i = 0; i < len; ++i) - if (ccltbl[ind + i] == ch) - return; - - /* mark newlines */ - if (ch == nlch) - ccl_has_nl[cclp] = true; - - newpos = ind + len; - - if (newpos >= current_max_ccl_tbl_size) { - current_max_ccl_tbl_size += MAX_CCL_TBL_SIZE_INCREMENT; - - ++num_reallocs; - - ccltbl = reallocate_Character_array (ccltbl, - current_max_ccl_tbl_size); - } - - ccllen[cclp] = len + 1; - ccltbl[newpos] = ch; -} - - -/* cclinit - return an empty ccl */ - -int cclinit () -{ - if (++lastccl >= current_maxccls) { - current_maxccls += MAX_CCLS_INCREMENT; - - ++num_reallocs; - - cclmap = - reallocate_integer_array (cclmap, current_maxccls); - ccllen = - reallocate_integer_array (ccllen, current_maxccls); - cclng = reallocate_integer_array (cclng, current_maxccls); - ccl_has_nl = - reallocate_bool_array (ccl_has_nl, - current_maxccls); - } - - if (lastccl == 1) - /* we're making the first ccl */ - cclmap[lastccl] = 0; - - else - /* The new pointer is just past the end of the last ccl. - * Since the cclmap points to the \first/ character of a - * ccl, adding the length of the ccl to the cclmap pointer - * will produce a cursor to the first free space. - */ - cclmap[lastccl] = - cclmap[lastccl - 1] + ccllen[lastccl - 1]; - - ccllen[lastccl] = 0; - cclng[lastccl] = 0; /* ccl's start out life un-negated */ - ccl_has_nl[lastccl] = false; - - return lastccl; -} - - -/* cclnegate - negate the given ccl */ - -void cclnegate (cclp) - int cclp; -{ - cclng[cclp] = 1; - ccl_has_nl[cclp] = !ccl_has_nl[cclp]; -} - - -/* list_character_set - list the members of a set of characters in CCL form - * - * Writes to the given file a character-class representation of those - * characters present in the given CCL. A character is present if it - * has a non-zero value in the cset array. - */ - -void list_character_set (file, cset) - FILE *file; - int cset[]; -{ - register int i; - - putc ('[', file); - - for (i = 0; i < csize; ++i) { - if (cset[i]) { - register int start_char = i; - - putc (' ', file); - - fputs (readable_form (i), file); - - while (++i < csize && cset[i]) ; - - if (i - 1 > start_char) - /* this was a run */ - fprintf (file, "-%s", - readable_form (i - 1)); - - putc (' ', file); - } - } - - putc (']', file); -} - -/** Determines if the range [c1-c2] is unambiguous in a case-insensitive - * scanner. Specifically, if a lowercase or uppercase character, x, is in the - * range [c1-c2], then we require that UPPERCASE(x) and LOWERCASE(x) must also - * be in the range. If not, then this range is ambiguous, and the function - * returns false. For example, [@-_] spans [a-z] but not [A-Z]. Beware that - * [a-z] will be labeled ambiguous because it does not include [A-Z]. - * - * @param c1 the lower end of the range - * @param c2 the upper end of the range - * @return true if [c1-c2] is not ambiguous for a caseless scanner. - */ -bool range_covers_case (int c1, int c2) -{ - int i, o; - - for (i = c1; i <= c2; i++) { - if (has_case (i)) { - o = reverse_case (i); - if (o < c1 || c2 < o) - return false; - } - } - return true; -} - -/** Reverse the case of a character, if possible. - * @return c if case-reversal does not apply. - */ -int reverse_case (int c) -{ - return isupper (c) ? tolower (c) : (islower (c) ? toupper (c) : c); -} - -/** Return true if c is uppercase or lowercase. */ -bool has_case (int c) -{ - return (isupper (c) || islower (c)) ? true : false; -} diff --git a/src/bin/flex/conf.in b/src/bin/flex/conf.in deleted file mode 100644 index 92b67133f1..0000000000 --- a/src/bin/flex/conf.in +++ /dev/null @@ -1,110 +0,0 @@ -/* conf.in. Generated from configure.in by autoheader. */ - -/* Define to 1 if translation of program messages to the user's native - language is requested. */ -#undef ENABLE_NLS - -/* Define to 1 if you have the header file. */ -#undef HAVE_CUNISTD - -/* Define if the GNU dcgettext() function is already present or preinstalled. - */ -#undef HAVE_DCGETTEXT - -/* Define to 1 if you have the declaration of `__func__', and to 0 if you - don't. */ -#undef HAVE_DECL___FUNC__ - -/* Define if the GNU gettext() function is already present or preinstalled. */ -#undef HAVE_GETTEXT - -/* Define if you have the iconv() function. */ -#undef HAVE_ICONV - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBINTL_H - -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_REGEX_H - -/* Define to 1 if you have the header file. */ -#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 header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAMS_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_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_WAIT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the GNU M4 executable name. */ -#undef M4 - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* 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 to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION - -/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a - `char[]'. */ -#undef YYTEXT_POINTER - -/* Define to `unsigned' if does not define. */ -#undef size_t diff --git a/src/bin/flex/config.guess b/src/bin/flex/config.guess deleted file mode 100755 index 6bdac8d7b6..0000000000 --- a/src/bin/flex/config.guess +++ /dev/null @@ -1,1388 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -timestamp='2003-05-09' - -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 -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 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # 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 -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { 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 ;' - -# 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 ;; - *) 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 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi - # 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 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/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - 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 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit 0;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - 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 0 ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - 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 0 ;; - 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 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - 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 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - # 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 0 ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - 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 \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit 0 ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - 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 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????: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 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - 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 0 ;; - *: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 - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 - 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 0 ;; - *:AIX:*:[45]) - 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 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 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 - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; - 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 && $dummy && exit 0 - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - 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 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - 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 0 ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*|*:GNU/FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:3*) - echo i586-pc-interix3 - exit 0 ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; - 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 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - 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 | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - 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 | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit 0 ;; - 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 0 ;; - 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 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit 0 ;; - 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 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; - "") - # 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 0 ;; - 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 - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; - 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 0 ;; - 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 0 ;; - 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 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; - 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 0 ;; - i*86:*:5:[78]*) - 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 0 ;; - 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 0 ;; - 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 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - 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 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit 0 ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*: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) - 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 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *: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 0 ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit 0 ;; - 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 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Darwin:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; - *: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 0 ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit 0 ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit 0 ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; - *: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 0 ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit 0 ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit 0 ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit 0 ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit 0 ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit 0 ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit 0 ;; -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"); 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 && $dummy && exit 0 - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# 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 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - 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/src/bin/flex/config.h b/src/bin/flex/config.h deleted file mode 100644 index ace9256a75..0000000000 --- a/src/bin/flex/config.h +++ /dev/null @@ -1,111 +0,0 @@ -/* config.h. Generated by configure. */ -/* conf.in. Generated from configure.in by autoheader. */ - -/* Define to 1 if translation of program messages to the user's native - language is requested. */ -/* #undef ENABLE_NLS */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_CUNISTD */ - -/* Define if the GNU dcgettext() function is already present or preinstalled. - */ -/* #undef HAVE_DCGETTEXT */ - -/* Define to 1 if you have the declaration of `__func__', and to 0 if you - don't. */ -#define HAVE_DECL___FUNC__ 1 - -/* Define if the GNU gettext() function is already present or preinstalled. */ -/* #undef HAVE_GETTEXT */ - -/* Define if you have the iconv() function. */ -/* #undef HAVE_ICONV */ - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIBINTL_H 1 - -/* Define to 1 if you have the `m' library (-lm). */ -#define HAVE_LIBM 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_NETINET_IN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_REGEX_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDBOOL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_PARAMS_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the GNU M4 executable name. */ -#define M4 "/bin/m4" - -/* Name of package */ -#define PACKAGE "flex" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "flex-help@lists.sourceforge.net" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "flex" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "flex 2.5.33" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "flex" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.5.33" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "2.5.33" - -/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a - `char[]'. */ -#define YYTEXT_POINTER 1 - -/* Define to `unsigned' if does not define. */ -/* #undef size_t */ diff --git a/src/bin/flex/config.rpath b/src/bin/flex/config.rpath deleted file mode 100755 index fa24bfc2d7..0000000000 --- a/src/bin/flex/config.rpath +++ /dev/null @@ -1,548 +0,0 @@ -#! /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-2003 Free Software Foundation, Inc. -# Taken from GNU libtool, 2001 -# Originally by Gordon Matzigkeit , 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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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. -# -# 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 M$VC, -# 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 AC_LIBTOOL_PROG_COMPILER_PIC. - -wl= -if test "$GCC" = yes; then - wl='-Wl,' -else - case "$host_os" in - aix*) - wl='-Wl,' - ;; - mingw* | pw32* | os2*) - ;; - hpux9* | hpux10* | hpux11*) - wl='-Wl,' - ;; - irix5* | irix6* | nonstopux*) - wl='-Wl,' - ;; - newsos6) - ;; - linux*) - case $CC in - icc|ecc) - wl='-Wl,' - ;; - ccc) - wl='-Wl,' - ;; - esac - ;; - osf3* | osf4* | osf5*) - wl='-Wl,' - ;; - sco3.2v5*) - ;; - solaris*) - wl='-Wl,' - ;; - sunos4*) - wl='-Qoption ld ' - ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - wl='-Wl,' - ;; - sysv4*MP*) - ;; - uts4*) - ;; - esac -fi - -# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. - -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no - -case "$host_os" in - cygwin* | mingw* | pw32*) - # 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 - ;; - openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - case "$host_os" in - aix3* | aix4* | aix5*) - # 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 can use - # them. - ld_shlibs=no - ;; - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - cygwin* | mingw* | pw32*) - # 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 - ;; - netbsd*) - ;; - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - sunos4*) - hardcode_direct=yes - ;; - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - esac - if test "$ld_shlibs" = yes; then - # 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' - 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 - ;; - aix4* | aix5*) - 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].*|aix5*) - 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 - hardcode_direct=yes - 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 - ;; - bsdi4*) - ;; - cygwin* | mingw* | pw32*) - # 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*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - hardcode_direct=no - 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*) - 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* | hpux11*) - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=no - ;; - ia64*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=no - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - *) - 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 - ;; - 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*) - 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 - ;; - 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=: - ;; - sco3.2v5*) - ;; - 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.2uw2*) - hardcode_direct=yes - hardcode_minus_L=no - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - ;; - sysv5*) - hardcode_libdir_flag_spec= - ;; - uts4*) - hardcode_libdir_flag_spec='-L$libdir' - ;; - *) - ld_shlibs=no - ;; - esac -fi - -# Check dynamic linker characteristics -# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. -libname_spec='lib$name' -case "$host_os" in - aix3*) - ;; - aix4* | aix5*) - ;; - amigaos*) - ;; - beos*) - ;; - bsdi4*) - ;; - cygwin* | mingw* | pw32*) - shrext=.dll - ;; - darwin* | rhapsody*) - shrext=.dylib - ;; - dgux*) - ;; - freebsd1*) - ;; - freebsd*) - ;; - gnu*) - ;; - hpux9* | hpux10* | hpux11*) - case "$host_cpu" in - ia64*) - shrext=.so - ;; - hppa*64*) - shrext=.sl - ;; - *) - shrext=.sl - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - 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*) - ;; - netbsd*) - ;; - newsos6) - ;; - nto-qnx) - ;; - openbsd*) - ;; - os2*) - libname_spec='$name' - shrext=.dll - ;; - osf3* | osf4* | osf5*) - ;; - sco3.2v5*) - ;; - solaris*) - ;; - sunos4*) - ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - ;; - sysv4*MP*) - ;; - uts4*) - ;; -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_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` - -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 -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 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # 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 0;; - - * ) - 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* | freebsd*-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) - 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 - ;; - -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/'` - ;; - -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] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | msp430 \ - | ns16k | ns32k \ - | openrisc | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xstormy16 | xtensa \ - | z8k) - 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) - ;; - - # 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-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # 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 - ;; - 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 - ;; - 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 - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - 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 - ;; - crds | unos) - basic_machine=m68k-crds - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - 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 - ;; - 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 - ;; - 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 - ;; - 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 - ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - 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 - ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - or32 | or32-*) - basic_machine=or32-unknown - os=-coff - ;; - 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 - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i686-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-*) - basic_machine=i686-`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 - ;; - 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 - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - 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 - ;; - tic4x | c4x*) - basic_machine=tic4x-unknown - os=-coff - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - 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 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-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 - ;; - 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 - ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) - 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* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -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*) - # 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* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -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 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -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 - ;; - -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 - ;; - -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 - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - # 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 - ;; - 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 - ;; - *-ibm) - os=-aix - ;; - *-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 - ;; - -ptx*) - vendor=sequent - ;; - -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 0 - -# 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/src/bin/flex/configure b/src/bin/flex/configure deleted file mode 100644 index 7429efd9f7..0000000000 --- a/src/bin/flex/configure +++ /dev/null @@ -1,9101 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for flex 2.5.33. -# -# Report bugs to . -# -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# 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 Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; 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 || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# 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 - -# 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 - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - 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 - - ;; - 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 - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - 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=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # 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 before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, 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 - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { 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 sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# 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` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME='flex' -PACKAGE_TARNAME='flex' -PACKAGE_VERSION='2.5.33' -PACKAGE_STRING='flex 2.5.33' -PACKAGE_BUGREPORT='flex-help@lists.sourceforge.net' - -ac_unique_file="scan.l" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_STAT_H -# include -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif -#if HAVE_UNISTD_H -# include -#endif" - -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 datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE 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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB YACC LEX LEXLIB LEX_OUTPUT_ROOT CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE LN_S RANLIB ac_ct_RANLIB BISON HELP2MAN M4 INDENT CPP EGREP LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# 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. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -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 - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -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 | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$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 ;; - - -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 ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - 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 ;; - - -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=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 ;; - - -*) { 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 && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - 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'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -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 - 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 - - -# 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 its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - 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 - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CXX_set=${CXX+set} -ac_env_CXX_value=$CXX -ac_cv_env_CXX_set=${CXX+set} -ac_cv_env_CXX_value=$CXX -ac_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_env_CXXFLAGS_value=$CXXFLAGS -ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_cv_env_CXXFLAGS_value=$CXXFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP - -# -# 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 flex 2.5.33 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 \`..'] - -_ACEOF - - cat <<_ACEOF -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] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --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] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_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 flex 2.5.33:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-nls do not use Native Language Support - --disable-dependency-tracking Speeds up one-time builds - --enable-dependency-tracking Do not reject slow dependency extractors - --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-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 - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CPP C preprocessor - -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 -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style 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 - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF -flex configure 2.5.33 -generated by GNU Autoconf 2.57 - -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -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 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by flex $as_me 2.5.33, which was -generated by GNU Autoconf 2.57. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -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` -hostinfo = `(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=. - echo "PATH: $as_dir" -done - -} >&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_sep= -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=`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_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - 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: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -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, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core core.* *.core && - rm -rf 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 -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >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 explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -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 - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -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 - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`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 - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -am__api_version="1.7" -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; 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 - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - -# 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" -# ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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/* | \ - /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 $as_executable_p "$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 - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done - - -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. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$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' - -echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&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". - { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -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 - { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}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 $. echo might interpret backslashes. -# By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm conftest.sed - - -# 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= - { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$AWK" && break -done - -echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.make <<\_ACEOF -all: - @echo 'ac_maketemp="$(MAKE)"' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftest.make -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - SET_MAKE= -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 - - # test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } -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='flex' - VERSION='2.5.33' - - -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"} - - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -install_sh=${install_sh-"$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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - STRIP=$ac_ct_STRIP -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. - - - - ac_config_headers="$ac_config_headers config.h:conf.in" - - - - - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - case "$ac_aux_dir" in - /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; - *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; - esac - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - - - - echo "$as_me:$LINENO: checking whether NLS is requested" >&5 -echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 - # Check whether --enable-nls or --disable-nls was given. -if test "${enable_nls+set}" = set; then - enableval="$enable_nls" - USE_NLS=$enableval -else - USE_NLS=yes -fi; - echo "$as_me:$LINENO: result: $USE_NLS" >&5 -echo "${ECHO_T}$USE_NLS" >&6 - - - - - - -# 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 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 - echo "$as_me:$LINENO: result: $MSGFMT" >&5 -echo "${ECHO_T}$MSGFMT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_GMSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT=$ac_cv_path_GMSGFMT - -if test -n "$GMSGFMT"; then - echo "$as_me:$LINENO: result: $GMSGFMT" >&5 -echo "${ECHO_T}$GMSGFMT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -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 - -# 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_XGETTEXT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 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 - echo "$as_me:$LINENO: result: $XGETTEXT" >&5 -echo "${ECHO_T}$XGETTEXT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - rm -f messages.po - - -# 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MSGMERGE+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 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 - echo "$as_me:$LINENO: result: $MSGMERGE" >&5 -echo "${ECHO_T}$MSGMERGE" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - if test "$GMSGFMT" != ":"; then - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && - (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` - echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 -echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 - GMSGFMT=":" - fi - fi - - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && - (if $XGETTEXT --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 - : ; - else - echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 -echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 - XGETTEXT=":" - fi - rm -f messages.po - fi - - ac_config_commands="$ac_config_commands default-1" - - - - 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" - -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. -echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&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 - - -echo "$as_me:$LINENO: result: $_am_result" >&5 -echo "${ECHO_T}$_am_result" >&6 -rm -f confinc confmf - -# Check whether --enable-dependency-tracking or --disable-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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$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" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -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 - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -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. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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.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. -echo "$as_me:$LINENO: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -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 -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&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' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - 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 - { { 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 -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 -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - 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 | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -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 -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -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 -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$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 -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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; -} -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 -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - ''\ - '#include ' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f 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 - -depcc="$CC" am_compiler_list= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - - 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 - # 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. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}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=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \ - >/dev/null 2>conftest.err && - grep conftest.h 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 - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' 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 -echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$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 - - -# Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } - -echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6 -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 -build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 -host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - - -# Check whether --with-gnu-ld or --without-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. - echo "$as_me:$LINENO: checking for ld used by GCC" >&5 -echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&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 - echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 -else - echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 -fi -if test "${acl_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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. - if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - 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 - echo "$as_me:$LINENO: result: $LD" >&5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 -if test "${acl_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - acl_cv_prog_gnu_ld=yes -else - acl_cv_prog_gnu_ld=no -fi -fi -echo "$as_me:$LINENO: result: $acl_cv_prog_gnu_ld" >&5 -echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6 -with_gnu_ld=$acl_cv_prog_gnu_ld - - - - echo "$as_me:$LINENO: checking for shared library run path origin" >&5 -echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6 -if test "${acl_cv_rpath+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 -echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5 -echo "${ECHO_T}$acl_cv_rpath" >&6 - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - # Check whether --enable-rpath or --disable-rpath was given. -if test "${enable_rpath+set}" = set; then - enableval="$enable_rpath" - : -else - enable_rpath=yes -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-libiconv-prefix or --without-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/lib" - fi - fi - -fi; - LIBICONV= - LTLIBICONV= - INCICONV= - 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= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - 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 "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - 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/lib"; 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 "$hardcode_direct" = yes; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$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 "$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 - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - 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*) 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/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) 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 "$hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$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=\"$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 - - - - - - - - - - - - - - - - - - - - echo "$as_me:$LINENO: checking whether NLS is requested" >&5 -echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 - # Check whether --enable-nls or --disable-nls was given. -if test "${enable_nls+set}" = set; then - enableval="$enable_nls" - USE_NLS=$enableval -else - USE_NLS=yes -fi; - echo "$as_me:$LINENO: result: $USE_NLS" >&5 -echo "${ECHO_T}$USE_NLS" >&6 - - - - - LIBINTL= - LTLIBINTL= - POSUB= - - if test "$USE_NLS" = "yes"; then - gt_use_preinstalled_gnugettext=no - - - - - - - echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 -echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6 -if test "${gt_cv_func_gnugettext1_libc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -extern int _nl_msg_cat_cntr; -extern int *_nl_domain_bindings; -int -main () -{ -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gt_cv_func_gnugettext1_libc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gt_cv_func_gnugettext1_libc=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5 -echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6 - - if test "$gt_cv_func_gnugettext1_libc" != "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 - - - echo "$as_me:$LINENO: checking for iconv" >&5 -echo $ECHO_N "checking for iconv... $ECHO_C" >&6 -if test "${am_cv_func_iconv+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_func_iconv=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext 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 -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_lib_iconv=yes - am_cv_func_iconv=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS="$am_save_LIBS" - fi - -fi -echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 -echo "${ECHO_T}$am_cv_func_iconv" >&6 - if test "$am_cv_func_iconv" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ICONV 1 -_ACEOF - - fi - if test "$am_cv_lib_iconv" = yes; then - echo "$as_me:$LINENO: checking how to link with libiconv" >&5 -echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $LIBICONV" >&5 -echo "${ECHO_T}$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 or --without-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/lib" - fi - fi - -fi; - LIBINTL= - LTLIBINTL= - INCINTL= - 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= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - 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 "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - 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/lib"; 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 "$hardcode_direct" = yes; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$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 "$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 - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - 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*) 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/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) 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 "$hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$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=\"$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 - - echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 -echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6 -if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gt_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCINTL" - gt_save_LIBS="$LIBS" - LIBS="$LIBS $LIBINTL" - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias (); -int -main () -{ -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gt_cv_func_gnugettext1_libintl=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gt_cv_func_gnugettext1_libintl=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then - LIBS="$LIBS $LIBICONV" - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias (); -int -main () -{ -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - LIBINTL="$LIBINTL $LIBICONV" - LTLIBINTL="$LTLIBINTL $LTLIBICONV" - gt_cv_func_gnugettext1_libintl=yes - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi - CPPFLAGS="$gt_save_CPPFLAGS" - LIBS="$gt_save_LIBS" -fi -echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5 -echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6 - fi - - if test "$gt_cv_func_gnugettext1_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ - && test "$PACKAGE" != gettext-runtime \ - && test "$PACKAGE" != gettext-tools; }; then - gt_use_preinstalled_gnugettext=yes - else - LIBINTL= - LTLIBINTL= - INCINTL= - 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 - - echo "$as_me:$LINENO: checking whether to use NLS" >&5 -echo $ECHO_N "checking whether to use NLS... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $USE_NLS" >&5 -echo "${ECHO_T}$USE_NLS" >&6 - if test "$USE_NLS" = "yes"; then - echo "$as_me:$LINENO: checking where the gettext function comes from" >&5 -echo $ECHO_N "checking where the gettext function comes from... $ECHO_C" >&6 - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then - gt_source="external libintl" - else - gt_source="libc" - fi - else - gt_source="included intl directory" - fi - echo "$as_me:$LINENO: result: $gt_source" >&5 -echo "${ECHO_T}$gt_source" >&6 - fi - - if test "$USE_NLS" = "yes"; then - - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then - echo "$as_me:$LINENO: checking how to link with libintl" >&5 -echo $ECHO_N "checking how to link with libintl... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $LIBINTL" >&5 -echo "${ECHO_T}$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" - - - - - - - - -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_YACC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_YACC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -YACC=$ac_cv_prog_YACC -if test -n "$YACC"; then - echo "$as_me:$LINENO: result: $YACC" >&5 -echo "${ECHO_T}$YACC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$YACC" && break -done -test -n "$YACC" || YACC="yacc" - -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_LEX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LEX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -LEX=$ac_cv_prog_LEX -if test -n "$LEX"; then - echo "$as_me:$LINENO: result: $LEX" >&5 -echo "${ECHO_T}$LEX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$LEX" && break -done -test -n "$LEX" || LEX=":" - -if test -z "$LEXLIB" -then - echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 -echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 -if test "${ac_cv_lib_fl_yywrap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lfl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap (); -int -main () -{ -yywrap (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_fl_yywrap=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_fl_yywrap=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 -echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 -if test $ac_cv_lib_fl_yywrap = yes; then - LEXLIB="-lfl" -else - echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 -echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 -if test "${ac_cv_lib_l_yywrap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ll $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap (); -int -main () -{ -yywrap (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_l_yywrap=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_l_yywrap=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 -echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 -if test $ac_cv_lib_l_yywrap = yes; then - LEXLIB="-ll" -fi - -fi - -fi - -if test "x$LEX" != "x:"; then - echo "$as_me:$LINENO: checking lex output file root" >&5 -echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 -if test "${ac_cv_prog_lex_root+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # The minimal lex program is just a single line: %%. But some broken lexes -# (Solaris, I think it was) want two %% lines, so accommodate them. -cat >conftest.l <<_ACEOF -%% -%% -_ACEOF -{ (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 - (eval $LEX conftest.l) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -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 - { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 -echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} - { (exit 1); exit 1; }; } -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 -echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 -rm -f conftest.l -LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root - -echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 -echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 -if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 -echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c -ac_save_LIBS=$LIBS -LIBS="$LIBS $LEXLIB" -cat >conftest.$ac_ext <<_ACEOF -`cat $LEX_OUTPUT_ROOT.c` -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_lex_yytext_pointer=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_save_LIBS -rm -f "${LEX_OUTPUT_ROOT}.c" - -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 -echo "${ECHO_T}$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 - -fi -if test "$LEX" = :; then - LEX=${am_missing_run}flex -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$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" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -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 - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -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. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$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 -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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; -} -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 -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - ''\ - '#include ' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f 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 - -depcc="$CC" am_compiler_list= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - - 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 - # 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. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}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=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \ - >/dev/null 2>conftest.err && - grep conftest.h 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 - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' 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 -echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$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 - - -ac_ext=cc -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 -n "$ac_tool_prefix"; then - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CXX" && break -done -test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - - CXX=$ac_ct_CXX -fi - - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C++ compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cxx_g=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$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 -for ac_declaration in \ - ''\ - '#include ' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -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= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 - - 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 - # 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. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}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=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \ - >/dev/null 2>conftest.err && - grep conftest.h 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 - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' 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 -echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$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 - - -echo "$as_me:$LINENO: checking whether ln -s works" >&5 -echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no, using $LN_S" >&5 -echo "${ECHO_T}no, using $LN_S" >&6 -fi - -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - RANLIB=$ac_ct_RANLIB -else - RANLIB="$ac_cv_prog_RANLIB" -fi - - -# Extract the first word of "bison", so it can be a program name with args. -set dummy bison; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_BISON+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $BISON in - [\\/]* | ?:[\\/]*) - ac_cv_path_BISON="$BISON" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_BISON="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_BISON" && ac_cv_path_BISON="bison" - ;; -esac -fi -BISON=$ac_cv_path_BISON - -if test -n "$BISON"; then - echo "$as_me:$LINENO: result: $BISON" >&5 -echo "${ECHO_T}$BISON" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -# Extract the first word of "help2man", so it can be a program name with args. -set dummy help2man; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_HELP2MAN+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $HELP2MAN in - [\\/]* | ?:[\\/]*) - ac_cv_path_HELP2MAN="$HELP2MAN" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_HELP2MAN="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_HELP2MAN" && ac_cv_path_HELP2MAN="help2man" - ;; -esac -fi -HELP2MAN=$ac_cv_path_HELP2MAN - -if test -n "$HELP2MAN"; then - echo "$as_me:$LINENO: result: $HELP2MAN" >&5 -echo "${ECHO_T}$HELP2MAN" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - -# Check for a GNU m4 that supports --prefix-builtins -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_M4+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_M4="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -M4=$ac_cv_path_M4 - -if test -n "$M4"; then - echo "$as_me:$LINENO: result: $M4" >&5 -echo "${ECHO_T}$M4" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$M4" && break -done -test -n "$M4" || M4="m4" - -if test x"$M4" != x; then - echo "$as_me:$LINENO: checking for GNU m4" >&5 -echo $ECHO_N "checking for GNU m4... $ECHO_C" >&6 - case `$M4 --help < /dev/null 2>&1` in - *prefix-builtins*) echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 ;; - *) echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 ; - { { echo "$as_me:$LINENO: error: GNU M4 1.4 is required" >&5 -echo "$as_me: error: GNU M4 1.4 is required" >&2;} - { (exit 1); exit 1; }; } ;; - esac -else - { { echo "$as_me:$LINENO: error: GNU M4 1.4 is required" >&5 -echo "$as_me: error: GNU M4 1.4 is required" >&2;} - { (exit 1); exit 1; }; } ; -fi - -cat >>confdefs.h <<_ACEOF -#define M4 "$M4" -_ACEOF - - -# Extract the first word of "indent", so it can be a program name with args. -set dummy indent; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_INDENT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $INDENT in - [\\/]* | ?:[\\/]*) - ac_cv_path_INDENT="$INDENT" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_INDENT="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_INDENT" && ac_cv_path_INDENT="indent" - ;; -esac -fi -INDENT=$ac_cv_path_INDENT - -if test -n "$INDENT"; then - echo "$as_me:$LINENO: result: $INDENT" >&5 -echo "${ECHO_T}$INDENT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test "$INDENT" != indent ; then - echo "$as_me:$LINENO: checking if $INDENT is GNU indent" >&5 -echo $ECHO_N "checking if $INDENT is GNU indent... $ECHO_C" >&6 - if $INDENT --version 2>/dev/null | head -n 1|grep "GNU indent" > /dev/null ; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - { echo "$as_me:$LINENO: WARNING: $INDENT does not appear to be GNU indent." >&5 -echo "$as_me: WARNING: $INDENT does not appear to be GNU indent." >&2;} - fi -else - { echo "$as_me:$LINENO: WARNING: no indent program found: make indent target will not function" >&5 -echo "$as_me: WARNING: no indent program found: make indent target will not function" >&2;} -fi - - -echo "$as_me:$LINENO: checking for log in -lm" >&5 -echo $ECHO_N "checking for log in -lm... $ECHO_C" >&6 -if test "${ac_cv_lib_m_log+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char log (); -int -main () -{ -log (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_m_log=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_m_log=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_m_log" >&5 -echo "${ECHO_T}$ac_cv_lib_m_log" >&6 -if test $ac_cv_lib_m_log = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBM 1 -_ACEOF - - LIBS="-lm $LIBS" - -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 -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&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 - echo $ECHO_N "(cached) $ECHO_C" >&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 -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - 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 non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - 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 -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$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 -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - 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 non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - 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 - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -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 - - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no -fi -rm -f 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 -#line $LINENO "configure" -/* 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 -#line $LINENO "configure" -/* 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 -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#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)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$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=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - - - -for ac_header in unistd.h stdbool.h netinet/in.h limits.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -for ac_header in sys/wait.h sys/params.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in cunistd -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -for ac_header in locale.h libintl.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in regex.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -echo "$as_me:$LINENO: checking for size_t" >&5 -echo $ECHO_N "checking for size_t... $ECHO_C" >&6 -if test "${ac_cv_type_size_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((size_t *) 0) - return 0; -if (sizeof (size_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_size_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_size_t=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -echo "${ECHO_T}$ac_cv_type_size_t" >&6 -if test $ac_cv_type_size_t = yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned -_ACEOF - -fi - - - -echo "$as_me:$LINENO: checking whether __func__ is declared" >&5 -echo $ECHO_N "checking whether __func__ is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl___func__+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef __func__ - char *p = (char *) __func__; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl___func__=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl___func__=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl___func__" >&5 -echo "${ECHO_T}$ac_cv_have_decl___func__" >&6 -if test $ac_cv_have_decl___func__ = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___FUNC__ 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___FUNC__ 0 -_ACEOF - - -fi - - - - ac_config_files="$ac_config_files flex.spec Makefile doc/Makefile examples/Makefile examples/fastwc/Makefile examples/manual/Makefile m4/Makefile po/Makefile.in tools/Makefile tests/Makefile tests/TEMPLATE/Makefile tests/test-array-nr/Makefile tests/test-array-r/Makefile tests/test-basic-nr/Makefile tests/test-basic-r/Makefile tests/test-bison-yylloc/Makefile tests/test-bison-yylval/Makefile tests/test-c-cpp-nr/Makefile tests/test-c-cpp-r/Makefile tests/test-header-nr/Makefile tests/test-header-r/Makefile tests/test-include-by-buffer/Makefile tests/test-include-by-push/Makefile tests/test-include-by-reentrant/Makefile tests/test-multiple-scanners-nr/Makefile tests/test-multiple-scanners-r/Makefile tests/test-noansi-nr/Makefile tests/test-noansi-r/Makefile tests/test-prefix-nr/Makefile tests/test-prefix-r/Makefile tests/test-pthread/Makefile tests/test-string-nr/Makefile tests/test-string-r/Makefile tests/test-yyextra/Makefile tests/test-lineno-nr/Makefile tests/test-lineno-r/Makefile tests/test-linedir-r/Makefile tests/test-debug-r/Makefile tests/test-debug-nr/Makefile tests/test-mem-nr/Makefile tests/test-mem-r/Makefile tests/test-posix/Makefile tests/test-posixly-correct/Makefile tests/test-table-opts/Makefile tests/test-c++-basic/Makefile tests/test-bison-nr/Makefile tests/test-reject/Makefile tests/test-c++-multiple-scanners/Makefile tests/test-top/Makefile tests/test-rescan-nr/Makefile tests/test-rescan-r/Makefile" - - -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, don't put newlines in cache variables' values. -# 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. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *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 \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!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" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - 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}' - -# 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 - -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_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -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 - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -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 "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -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 "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -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 - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $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 -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; 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 || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# 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 - -# 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 - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - 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 - - ;; - 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 - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - 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=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # 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 before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, 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 - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -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 sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by flex $as_me 2.5.33, which was -generated by GNU Autoconf 2.57. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -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, 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 commands: -$config_commands - -Report bugs to ." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -flex config.status 2.5.33 -configured by $0, generated by GNU Autoconf 2.57, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -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 - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -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" ;; - - 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 -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS section. -# - -# Capture the value of obsolete ALL_LINGUAS because we need it to compute - # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it - # from automake. - eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' - # Capture the value of LINGUAS because we need it to compute CATALOGS. - LINGUAS="${LINGUAS-%UNSET%}" - -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - -_ACEOF - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "flex.spec" ) CONFIG_FILES="$CONFIG_FILES flex.spec" ;; - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; - "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; - "examples/fastwc/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/fastwc/Makefile" ;; - "examples/manual/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/manual/Makefile" ;; - "m4/Makefile" ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; - "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; - "tools/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; - "tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; - "tests/TEMPLATE/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/TEMPLATE/Makefile" ;; - "tests/test-array-nr/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-array-nr/Makefile" ;; - "tests/test-array-r/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-array-r/Makefile" ;; - "tests/test-basic-nr/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-basic-nr/Makefile" ;; - "tests/test-basic-r/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-basic-r/Makefile" ;; - "tests/test-bison-yylloc/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-bison-yylloc/Makefile" ;; - "tests/test-bison-yylval/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-bison-yylval/Makefile" ;; - "tests/test-c-cpp-nr/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-c-cpp-nr/Makefile" ;; - "tests/test-c-cpp-r/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-c-cpp-r/Makefile" ;; - "tests/test-header-nr/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-header-nr/Makefile" ;; - "tests/test-header-r/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-header-r/Makefile" ;; - "tests/test-include-by-buffer/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-include-by-buffer/Makefile" ;; - "tests/test-include-by-push/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-include-by-push/Makefile" ;; - "tests/test-include-by-reentrant/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-include-by-reentrant/Makefile" ;; - "tests/test-multiple-scanners-nr/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-multiple-scanners-nr/Makefile" ;; - "tests/test-multiple-scanners-r/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-multiple-scanners-r/Makefile" ;; - "tests/test-noansi-nr/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-noansi-nr/Makefile" ;; - "tests/test-noansi-r/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-noansi-r/Makefile" ;; - "tests/test-prefix-nr/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-prefix-nr/Makefile" ;; - "tests/test-prefix-r/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-prefix-r/Makefile" ;; - "tests/test-pthread/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-pthread/Makefile" ;; - "tests/test-string-nr/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-string-nr/Makefile" ;; - "tests/test-string-r/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-string-r/Makefile" ;; - "tests/test-yyextra/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-yyextra/Makefile" ;; - "tests/test-lineno-nr/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-lineno-nr/Makefile" ;; - "tests/test-lineno-r/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-lineno-r/Makefile" ;; - "tests/test-linedir-r/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-linedir-r/Makefile" ;; - "tests/test-debug-r/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-debug-r/Makefile" ;; - "tests/test-debug-nr/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-debug-nr/Makefile" ;; - "tests/test-mem-nr/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-mem-nr/Makefile" ;; - "tests/test-mem-r/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-mem-r/Makefile" ;; - "tests/test-posix/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-posix/Makefile" ;; - "tests/test-posixly-correct/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-posixly-correct/Makefile" ;; - "tests/test-table-opts/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-table-opts/Makefile" ;; - "tests/test-c++-basic/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-c++-basic/Makefile" ;; - "tests/test-bison-nr/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-bison-nr/Makefile" ;; - "tests/test-reject/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-reject/Makefile" ;; - "tests/test-c++-multiple-scanners/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-c++-multiple-scanners/Makefile" ;; - "tests/test-top/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-top/Makefile" ;; - "tests/test-rescan-nr/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-rescan-nr/Makefile" ;; - "tests/test-rescan-r/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/test-rescan-r/Makefile" ;; - "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; - "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:conf.in" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -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_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 to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $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 -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@CYGPATH_W@,$CYGPATH_W,;t t -s,@PACKAGE@,$PACKAGE,;t t -s,@VERSION@,$VERSION,;t t -s,@ACLOCAL@,$ACLOCAL,;t t -s,@AUTOCONF@,$AUTOCONF,;t t -s,@AUTOMAKE@,$AUTOMAKE,;t t -s,@AUTOHEADER@,$AUTOHEADER,;t t -s,@MAKEINFO@,$MAKEINFO,;t t -s,@AMTAR@,$AMTAR,;t t -s,@install_sh@,$install_sh,;t t -s,@STRIP@,$STRIP,;t t -s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t -s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t -s,@AWK@,$AWK,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@am__leading_dot@,$am__leading_dot,;t t -s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t -s,@USE_NLS@,$USE_NLS,;t t -s,@MSGFMT@,$MSGFMT,;t t -s,@GMSGFMT@,$GMSGFMT,;t t -s,@XGETTEXT@,$XGETTEXT,;t t -s,@MSGMERGE@,$MSGMERGE,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@DEPDIR@,$DEPDIR,;t t -s,@am__include@,$am__include,;t t -s,@am__quote@,$am__quote,;t t -s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t -s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t -s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t -s,@CCDEPMODE@,$CCDEPMODE,;t t -s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t -s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t -s,@LIBICONV@,$LIBICONV,;t t -s,@LTLIBICONV@,$LTLIBICONV,;t t -s,@INTLLIBS@,$INTLLIBS,;t t -s,@LIBINTL@,$LIBINTL,;t t -s,@LTLIBINTL@,$LTLIBINTL,;t t -s,@POSUB@,$POSUB,;t t -s,@YACC@,$YACC,;t t -s,@LEX@,$LEX,;t t -s,@LEXLIB@,$LEXLIB,;t t -s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t -s,@CXX@,$CXX,;t t -s,@CXXFLAGS@,$CXXFLAGS,;t t -s,@ac_ct_CXX@,$ac_ct_CXX,;t t -s,@CXXDEPMODE@,$CXXDEPMODE,;t t -s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t -s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t -s,@LN_S@,$LN_S,;t t -s,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@BISON@,$BISON,;t t -s,@HELP2MAN@,$HELP2MAN,;t t -s,@M4@,$M4,;t t -s,@INDENT@,$INDENT,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # 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. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;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,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #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. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # 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. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -# Compute $ac_file's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $ac_file | $ac_file:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || -$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X$ac_file | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'`/stamp-h$_am_stamp_count -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - default-1 ) - 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 - 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, GMOFILES, UPDATEPOFILES, DUMMYPOFILES 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" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake. - eval 'ALL_LINGUAS''=$ALL_LINGUAS_' - POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" - else - # The set of available languages was given in configure.in. - eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' - fi - case "$ac_given_srcdir" in - .) srcdirpre= ;; - *) srcdirpre='$(srcdir)/' ;; - esac - POFILES= - GMOFILES= - UPDATEPOFILES= - DUMMYPOFILES= - for lang in $ALL_LINGUAS; do - POFILES="$POFILES $srcdirpre$lang.po" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" - DUMMYPOFILES="$DUMMYPOFILES $lang.nop" - 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|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|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 ;; - depfiles ) 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. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`(dirname "$mf") 2>/dev/null || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -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 - grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` - test -z "$DEPDIR" && continue - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # 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 -e ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //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=`(dirname "$file") 2>/dev/null || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p $dirpart/$fdir - else - as_dir=$dirpart/$fdir - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 -echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} - { (exit 1); exit 1; }; }; } - - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - esac -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# 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 - diff --git a/src/bin/flex/configure.in b/src/bin/flex/configure.in deleted file mode 100644 index 354b6c992f..0000000000 --- a/src/bin/flex/configure.in +++ /dev/null @@ -1,151 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -dnl This file is part of flex. - -dnl Redistribution and use in source and binary forms, with or without -dnl modification, are permitted provided that the following conditions -dnl are met: - -dnl 1. Redistributions of source code must retain the above copyright -dnl notice, this list of conditions and the following disclaimer. -dnl 2. Redistributions in binary form must reproduce the above copyright -dnl notice, this list of conditions and the following disclaimer in the -dnl documentation and/or other materials provided with the distribution. - -dnl Neither the name of the University nor the names of its contributors -dnl may be used to endorse or promote products derived from this software -dnl without specific prior written permission. - -dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -dnl PURPOSE. - -dnl autoconf requirements and initialization - -AC_PREREQ(2.54) -AC_INIT(flex,2.5.33,flex-help@lists.sourceforge.net) -AC_CONFIG_SRCDIR(scan.l) -AM_INIT_AUTOMAKE -AC_CONFIG_HEADER(config.h:conf.in) - -dnl checks for programs - -AM_GNU_GETTEXT([external]) -AM_GNU_GETTEXT_VERSION(0.12) - -AC_PROG_YACC -AM_PROG_LEX -AC_PROG_CC -AC_PROG_CXX -AC_PROG_LN_S -AC_PROG_RANLIB - -AC_PATH_PROG(BISON, bison,bison) -AC_PATH_PROG(HELP2MAN, help2man, help2man) - - -# Check for a GNU m4 that supports --prefix-builtins -AC_PATH_PROGS(M4, gm4 gnum4 m4, m4) -if test x"$M4" != x; then - AC_MSG_CHECKING([for GNU m4]) - case `$M4 --help < /dev/null 2>&1` in - *prefix-builtins*) AC_MSG_RESULT(yes) ;; - *) AC_MSG_RESULT(no) ; - AC_MSG_ERROR([GNU M4 1.4 is required]) ;; - esac -else - AC_MSG_ERROR([GNU M4 1.4 is required]) ; -fi -AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.]) - -AC_PATH_PROG(INDENT, indent, indent) -dnl if INDENT is set to 'indent' then we didn't find indent -if test "$INDENT" != indent ; then - AC_MSG_CHECKING(if $INDENT is GNU indent) - if $INDENT --version 2>/dev/null | head -n 1|grep "GNU indent" > /dev/null ; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - AC_MSG_WARN($INDENT does not appear to be GNU indent.) - fi -else - AC_MSG_WARN(no indent program found: make indent target will not function) -fi - -dnl checks for libraries -AC_CHECK_LIB(m, log) - -dnl checks for header files - -AC_HEADER_STDC -AC_CHECK_HEADERS(unistd.h stdbool.h netinet/in.h limits.h) -AC_CHECK_HEADERS( sys/wait.h sys/params.h) -AC_CHECK_HEADERS(cunistd) -AC_CHECK_HEADERS(locale.h libintl.h) -AC_CHECK_HEADERS(regex.h) - -dnl checks for types - -AC_TYPE_SIZE_T - -dnl checks for functions - -AC_CHECK_DECLS(__func__) - -AC_CONFIG_FILES( -flex.spec -Makefile -doc/Makefile -examples/Makefile -examples/fastwc/Makefile -examples/manual/Makefile -m4/Makefile -po/Makefile.in -tools/Makefile -tests/Makefile -tests/TEMPLATE/Makefile -tests/test-array-nr/Makefile -tests/test-array-r/Makefile -tests/test-basic-nr/Makefile -tests/test-basic-r/Makefile -tests/test-bison-yylloc/Makefile -tests/test-bison-yylval/Makefile -tests/test-c-cpp-nr/Makefile -tests/test-c-cpp-r/Makefile -tests/test-header-nr/Makefile -tests/test-header-r/Makefile -tests/test-include-by-buffer/Makefile -tests/test-include-by-push/Makefile -tests/test-include-by-reentrant/Makefile -tests/test-multiple-scanners-nr/Makefile -tests/test-multiple-scanners-r/Makefile -tests/test-noansi-nr/Makefile -tests/test-noansi-r/Makefile -tests/test-prefix-nr/Makefile -tests/test-prefix-r/Makefile -tests/test-pthread/Makefile -tests/test-string-nr/Makefile -tests/test-string-r/Makefile -tests/test-yyextra/Makefile -tests/test-lineno-nr/Makefile -tests/test-lineno-r/Makefile -tests/test-linedir-r/Makefile -tests/test-debug-r/Makefile -tests/test-debug-nr/Makefile -tests/test-mem-nr/Makefile -tests/test-mem-r/Makefile -tests/test-posix/Makefile -tests/test-posixly-correct/Makefile -tests/test-table-opts/Makefile -tests/test-c++-basic/Makefile -tests/test-bison-nr/Makefile -tests/test-reject/Makefile -tests/test-c++-multiple-scanners/Makefile -tests/test-top/Makefile -tests/test-rescan-nr/Makefile -tests/test-rescan-r/Makefile -dnl --new-test-here-- This line is processed by tests/create-test. -) - -AC_OUTPUT diff --git a/src/bin/flex/depcomp b/src/bin/flex/depcomp deleted file mode 100755 index 51606f8c46..0000000000 --- a/src/bin/flex/depcomp +++ /dev/null @@ -1,464 +0,0 @@ -#! /bin/sh - -# depcomp - compile a program generating dependencies as side-effects -# Copyright 1999, 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 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# 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 . - -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 -# `libtool' can also be set to `yes' or `no'. - -if test -z "$depfile"; then - base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` - dir=`echo "$object" | sed 's,/.*$,/,'` - if test "$dir" = "$object"; then - dir= - fi - # FIXME: should be _deps on DOS. - depfile="$dir.deps/$base" -fi - -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. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - 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. 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. - stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - outname="$stripped.o" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - 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,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$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) - # Must come before tru64. - - # Intel's C compiler understands `-MD -MF file'. However - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # 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: - - "$@" -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'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - rm -f "$tmpdepfile" - ;; - -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 - tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir.libs/$base.d" - "$@" -Wc,-MD - else - tmpdepfile1="$dir$base.o.d" - tmpdepfile2="$dir$base.d" - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - else - tmpdepfile="$tmpdepfile2" - fi - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a space and a tab 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 proprocessed 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 proprocessed 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 '/^# [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 proprocessed 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 diff --git a/src/bin/flex/dfa.c b/src/bin/flex/dfa.c deleted file mode 100644 index f3064c9f66..0000000000 --- a/src/bin/flex/dfa.c +++ /dev/null @@ -1,1118 +0,0 @@ -/* dfa - DFA construction routines */ - -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -#include "flexdef.h" -#include "tables.h" - -/* declare functions that have forward references */ - -void dump_associated_rules PROTO ((FILE *, int)); -void dump_transitions PROTO ((FILE *, int[])); -void sympartition PROTO ((int[], int, int[], int[])); -int symfollowset PROTO ((int[], int, int, int[])); - - -/* check_for_backing_up - check a DFA state for backing up - * - * synopsis - * void check_for_backing_up( int ds, int state[numecs] ); - * - * ds is the number of the state to check and state[] is its out-transitions, - * indexed by equivalence class. - */ - -void check_for_backing_up (ds, state) - int ds; - int state[]; -{ - if ((reject && !dfaacc[ds].dfaacc_set) || (!reject && !dfaacc[ds].dfaacc_state)) { /* state is non-accepting */ - ++num_backing_up; - - if (backing_up_report) { - fprintf (backing_up_file, - _("State #%d is non-accepting -\n"), ds); - - /* identify the state */ - dump_associated_rules (backing_up_file, ds); - - /* Now identify it further using the out- and - * jam-transitions. - */ - dump_transitions (backing_up_file, state); - - putc ('\n', backing_up_file); - } - } -} - - -/* check_trailing_context - check to see if NFA state set constitutes - * "dangerous" trailing context - * - * synopsis - * void check_trailing_context( int nfa_states[num_states+1], int num_states, - * int accset[nacc+1], int nacc ); - * - * NOTES - * Trailing context is "dangerous" if both the head and the trailing - * part are of variable size \and/ there's a DFA state which contains - * both an accepting state for the head part of the rule and NFA states - * which occur after the beginning of the trailing context. - * - * When such a rule is matched, it's impossible to tell if having been - * in the DFA state indicates the beginning of the trailing context or - * further-along scanning of the pattern. In these cases, a warning - * message is issued. - * - * nfa_states[1 .. num_states] is the list of NFA states in the DFA. - * accset[1 .. nacc] is the list of accepting numbers for the DFA state. - */ - -void check_trailing_context (nfa_states, num_states, accset, nacc) - int *nfa_states, num_states; - int *accset; - int nacc; -{ - register int i, j; - - for (i = 1; i <= num_states; ++i) { - int ns = nfa_states[i]; - register int type = state_type[ns]; - register int ar = assoc_rule[ns]; - - if (type == STATE_NORMAL || rule_type[ar] != RULE_VARIABLE) { /* do nothing */ - } - - else if (type == STATE_TRAILING_CONTEXT) { - /* Potential trouble. Scan set of accepting numbers - * for the one marking the end of the "head". We - * assume that this looping will be fairly cheap - * since it's rare that an accepting number set - * is large. - */ - for (j = 1; j <= nacc; ++j) - if (accset[j] & YY_TRAILING_HEAD_MASK) { - line_warning (_ - ("dangerous trailing context"), - rule_linenum[ar]); - return; - } - } - } -} - - -/* dump_associated_rules - list the rules associated with a DFA state - * - * Goes through the set of NFA states associated with the DFA and - * extracts the first MAX_ASSOC_RULES unique rules, sorts them, - * and writes a report to the given file. - */ - -void dump_associated_rules (file, ds) - FILE *file; - int ds; -{ - register int i, j; - register int num_associated_rules = 0; - int rule_set[MAX_ASSOC_RULES + 1]; - int *dset = dss[ds]; - int size = dfasiz[ds]; - - for (i = 1; i <= size; ++i) { - register int rule_num = rule_linenum[assoc_rule[dset[i]]]; - - for (j = 1; j <= num_associated_rules; ++j) - if (rule_num == rule_set[j]) - break; - - if (j > num_associated_rules) { /* new rule */ - if (num_associated_rules < MAX_ASSOC_RULES) - rule_set[++num_associated_rules] = - rule_num; - } - } - - bubble (rule_set, num_associated_rules); - - fprintf (file, _(" associated rule line numbers:")); - - for (i = 1; i <= num_associated_rules; ++i) { - if (i % 8 == 1) - putc ('\n', file); - - fprintf (file, "\t%d", rule_set[i]); - } - - putc ('\n', file); -} - - -/* dump_transitions - list the transitions associated with a DFA state - * - * synopsis - * dump_transitions( FILE *file, int state[numecs] ); - * - * Goes through the set of out-transitions and lists them in human-readable - * form (i.e., not as equivalence classes); also lists jam transitions - * (i.e., all those which are not out-transitions, plus EOF). The dump - * is done to the given file. - */ - -void dump_transitions (file, state) - FILE *file; - int state[]; -{ - register int i, ec; - int out_char_set[CSIZE]; - - for (i = 0; i < csize; ++i) { - ec = ABS (ecgroup[i]); - out_char_set[i] = state[ec]; - } - - fprintf (file, _(" out-transitions: ")); - - list_character_set (file, out_char_set); - - /* now invert the members of the set to get the jam transitions */ - for (i = 0; i < csize; ++i) - out_char_set[i] = !out_char_set[i]; - - fprintf (file, _("\n jam-transitions: EOF ")); - - list_character_set (file, out_char_set); - - putc ('\n', file); -} - - -/* epsclosure - construct the epsilon closure of a set of ndfa states - * - * synopsis - * int *epsclosure( int t[num_states], int *numstates_addr, - * int accset[num_rules+1], int *nacc_addr, - * int *hashval_addr ); - * - * NOTES - * The epsilon closure is the set of all states reachable by an arbitrary - * number of epsilon transitions, which themselves do not have epsilon - * transitions going out, unioned with the set of states which have non-null - * accepting numbers. t is an array of size numstates of nfa state numbers. - * Upon return, t holds the epsilon closure and *numstates_addr is updated. - * accset holds a list of the accepting numbers, and the size of accset is - * given by *nacc_addr. t may be subjected to reallocation if it is not - * large enough to hold the epsilon closure. - * - * hashval is the hash value for the dfa corresponding to the state set. - */ - -int *epsclosure (t, ns_addr, accset, nacc_addr, hv_addr) - int *t, *ns_addr, accset[], *nacc_addr, *hv_addr; -{ - register int stkpos, ns, tsp; - int numstates = *ns_addr, nacc, hashval, transsym, nfaccnum; - int stkend, nstate; - static int did_stk_init = false, *stk; - -#define MARK_STATE(state) \ -do{ trans1[state] = trans1[state] - MARKER_DIFFERENCE;} while(0) - -#define IS_MARKED(state) (trans1[state] < 0) - -#define UNMARK_STATE(state) \ -do{ trans1[state] = trans1[state] + MARKER_DIFFERENCE;} while(0) - -#define CHECK_ACCEPT(state) \ -do{ \ -nfaccnum = accptnum[state]; \ -if ( nfaccnum != NIL ) \ -accset[++nacc] = nfaccnum; \ -}while(0) - -#define DO_REALLOCATION() \ -do { \ -current_max_dfa_size += MAX_DFA_SIZE_INCREMENT; \ -++num_reallocs; \ -t = reallocate_integer_array( t, current_max_dfa_size ); \ -stk = reallocate_integer_array( stk, current_max_dfa_size ); \ -}while(0) \ - -#define PUT_ON_STACK(state) \ -do { \ -if ( ++stkend >= current_max_dfa_size ) \ -DO_REALLOCATION(); \ -stk[stkend] = state; \ -MARK_STATE(state); \ -}while(0) - -#define ADD_STATE(state) \ -do { \ -if ( ++numstates >= current_max_dfa_size ) \ -DO_REALLOCATION(); \ -t[numstates] = state; \ -hashval += state; \ -}while(0) - -#define STACK_STATE(state) \ -do { \ -PUT_ON_STACK(state); \ -CHECK_ACCEPT(state); \ -if ( nfaccnum != NIL || transchar[state] != SYM_EPSILON ) \ -ADD_STATE(state); \ -}while(0) - - - if (!did_stk_init) { - stk = allocate_integer_array (current_max_dfa_size); - did_stk_init = true; - } - - nacc = stkend = hashval = 0; - - for (nstate = 1; nstate <= numstates; ++nstate) { - ns = t[nstate]; - - /* The state could be marked if we've already pushed it onto - * the stack. - */ - if (!IS_MARKED (ns)) { - PUT_ON_STACK (ns); - CHECK_ACCEPT (ns); - hashval += ns; - } - } - - for (stkpos = 1; stkpos <= stkend; ++stkpos) { - ns = stk[stkpos]; - transsym = transchar[ns]; - - if (transsym == SYM_EPSILON) { - tsp = trans1[ns] + MARKER_DIFFERENCE; - - if (tsp != NO_TRANSITION) { - if (!IS_MARKED (tsp)) - STACK_STATE (tsp); - - tsp = trans2[ns]; - - if (tsp != NO_TRANSITION - && !IS_MARKED (tsp)) - STACK_STATE (tsp); - } - } - } - - /* Clear out "visit" markers. */ - - for (stkpos = 1; stkpos <= stkend; ++stkpos) { - if (IS_MARKED (stk[stkpos])) - UNMARK_STATE (stk[stkpos]); - else - flexfatal (_ - ("consistency check failed in epsclosure()")); - } - - *ns_addr = numstates; - *hv_addr = hashval; - *nacc_addr = nacc; - - return t; -} - - -/* increase_max_dfas - increase the maximum number of DFAs */ - -void increase_max_dfas () -{ - current_max_dfas += MAX_DFAS_INCREMENT; - - ++num_reallocs; - - base = reallocate_integer_array (base, current_max_dfas); - def = reallocate_integer_array (def, current_max_dfas); - dfasiz = reallocate_integer_array (dfasiz, current_max_dfas); - accsiz = reallocate_integer_array (accsiz, current_max_dfas); - dhash = reallocate_integer_array (dhash, current_max_dfas); - dss = reallocate_int_ptr_array (dss, current_max_dfas); - dfaacc = reallocate_dfaacc_union (dfaacc, current_max_dfas); - - if (nultrans) - nultrans = - reallocate_integer_array (nultrans, - current_max_dfas); -} - - -/* ntod - convert an ndfa to a dfa - * - * Creates the dfa corresponding to the ndfa we've constructed. The - * dfa starts out in state #1. - */ - -void ntod () -{ - int *accset, ds, nacc, newds; - int sym, hashval, numstates, dsize; - int num_full_table_rows=0; /* used only for -f */ - int *nset, *dset; - int targptr, totaltrans, i, comstate, comfreq, targ; - int symlist[CSIZE + 1]; - int num_start_states; - int todo_head, todo_next; - - struct yytbl_data *yynxt_tbl = 0; - flex_int32_t *yynxt_data = 0, yynxt_curr = 0; - - /* Note that the following are indexed by *equivalence classes* - * and not by characters. Since equivalence classes are indexed - * beginning with 1, even if the scanner accepts NUL's, this - * means that (since every character is potentially in its own - * equivalence class) these arrays must have room for indices - * from 1 to CSIZE, so their size must be CSIZE + 1. - */ - int duplist[CSIZE + 1], state[CSIZE + 1]; - int targfreq[CSIZE + 1], targstate[CSIZE + 1]; - - /* accset needs to be large enough to hold all of the rules present - * in the input, *plus* their YY_TRAILING_HEAD_MASK variants. - */ - accset = allocate_integer_array ((num_rules + 1) * 2); - nset = allocate_integer_array (current_max_dfa_size); - - /* The "todo" queue is represented by the head, which is the DFA - * state currently being processed, and the "next", which is the - * next DFA state number available (not in use). We depend on the - * fact that snstods() returns DFA's \in increasing order/, and thus - * need only know the bounds of the dfas to be processed. - */ - todo_head = todo_next = 0; - - for (i = 0; i <= csize; ++i) { - duplist[i] = NIL; - symlist[i] = false; - } - - for (i = 0; i <= num_rules; ++i) - accset[i] = NIL; - - if (trace) { - dumpnfa (scset[1]); - fputs (_("\n\nDFA Dump:\n\n"), stderr); - } - - inittbl (); - - /* Check to see whether we should build a separate table for - * transitions on NUL characters. We don't do this for full-speed - * (-F) scanners, since for them we don't have a simple state - * number lying around with which to index the table. We also - * don't bother doing it for scanners unless (1) NUL is in its own - * equivalence class (indicated by a positive value of - * ecgroup[NUL]), (2) NUL's equivalence class is the last - * equivalence class, and (3) the number of equivalence classes is - * the same as the number of characters. This latter case comes - * about when useecs is false or when it's true but every character - * still manages to land in its own class (unlikely, but it's - * cheap to check for). If all these things are true then the - * character code needed to represent NUL's equivalence class for - * indexing the tables is going to take one more bit than the - * number of characters, and therefore we won't be assured of - * being able to fit it into a YY_CHAR variable. This rules out - * storing the transitions in a compressed table, since the code - * for interpreting them uses a YY_CHAR variable (perhaps it - * should just use an integer, though; this is worth pondering ... - * ###). - * - * Finally, for full tables, we want the number of entries in the - * table to be a power of two so the array references go fast (it - * will just take a shift to compute the major index). If - * encoding NUL's transitions in the table will spoil this, we - * give it its own table (note that this will be the case if we're - * not using equivalence classes). - */ - - /* Note that the test for ecgroup[0] == numecs below accomplishes - * both (1) and (2) above - */ - if (!fullspd && ecgroup[0] == numecs) { - /* NUL is alone in its equivalence class, which is the - * last one. - */ - int use_NUL_table = (numecs == csize); - - if (fulltbl && !use_NUL_table) { - /* We still may want to use the table if numecs - * is a power of 2. - */ - int power_of_two; - - for (power_of_two = 1; power_of_two <= csize; - power_of_two *= 2) - if (numecs == power_of_two) { - use_NUL_table = true; - break; - } - } - - if (use_NUL_table) - nultrans = - allocate_integer_array (current_max_dfas); - - /* From now on, nultrans != nil indicates that we're - * saving null transitions for later, separate encoding. - */ - } - - - if (fullspd) { - for (i = 0; i <= numecs; ++i) - state[i] = 0; - - place_state (state, 0, 0); - dfaacc[0].dfaacc_state = 0; - } - - else if (fulltbl) { - if (nultrans) - /* We won't be including NUL's transitions in the - * table, so build it for entries from 0 .. numecs - 1. - */ - num_full_table_rows = numecs; - - else - /* Take into account the fact that we'll be including - * the NUL entries in the transition table. Build it - * from 0 .. numecs. - */ - num_full_table_rows = numecs + 1; - - /* Begin generating yy_nxt[][] - * This spans the entire LONG function. - * This table is tricky because we don't know how big it will be. - * So we'll have to realloc() on the way... - * we'll wait until we can calculate yynxt_tbl->td_hilen. - */ - yynxt_tbl = - (struct yytbl_data *) calloc (1, - sizeof (struct - yytbl_data)); - yytbl_data_init (yynxt_tbl, YYTD_ID_NXT); - yynxt_tbl->td_hilen = 1; - yynxt_tbl->td_lolen = num_full_table_rows; - yynxt_tbl->td_data = yynxt_data = - (flex_int32_t *) calloc (yynxt_tbl->td_lolen * - yynxt_tbl->td_hilen, - sizeof (flex_int32_t)); - yynxt_curr = 0; - - buf_prints (&yydmap_buf, - "\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n", - long_align ? "flex_int32_t" : "flex_int16_t"); - - /* Unless -Ca, declare it "short" because it's a real - * long-shot that that won't be large enough. - */ - if (gentables) - out_str_dec - ("static yyconst %s yy_nxt[][%d] =\n {\n", - long_align ? "flex_int32_t" : "flex_int16_t", - num_full_table_rows); - else { - out_dec ("#undef YY_NXT_LOLEN\n#define YY_NXT_LOLEN (%d)\n", num_full_table_rows); - out_str ("static yyconst %s *yy_nxt =0;\n", - long_align ? "flex_int32_t" : "flex_int16_t"); - } - - - if (gentables) - outn (" {"); - - /* Generate 0 entries for state #0. */ - for (i = 0; i < num_full_table_rows; ++i) { - mk2data (0); - yynxt_data[yynxt_curr++] = 0; - } - - dataflush (); - if (gentables) - outn (" },\n"); - } - - /* Create the first states. */ - - num_start_states = lastsc * 2; - - for (i = 1; i <= num_start_states; ++i) { - numstates = 1; - - /* For each start condition, make one state for the case when - * we're at the beginning of the line (the '^' operator) and - * one for the case when we're not. - */ - if (i % 2 == 1) - nset[numstates] = scset[(i / 2) + 1]; - else - nset[numstates] = - mkbranch (scbol[i / 2], scset[i / 2]); - - nset = epsclosure (nset, &numstates, accset, &nacc, - &hashval); - - if (snstods (nset, numstates, accset, nacc, hashval, &ds)) { - numas += nacc; - totnst += numstates; - ++todo_next; - - if (variable_trailing_context_rules && nacc > 0) - check_trailing_context (nset, numstates, - accset, nacc); - } - } - - if (!fullspd) { - if (!snstods (nset, 0, accset, 0, 0, &end_of_buffer_state)) - flexfatal (_ - ("could not create unique end-of-buffer state")); - - ++numas; - ++num_start_states; - ++todo_next; - } - - - while (todo_head < todo_next) { - targptr = 0; - totaltrans = 0; - - for (i = 1; i <= numecs; ++i) - state[i] = 0; - - ds = ++todo_head; - - dset = dss[ds]; - dsize = dfasiz[ds]; - - if (trace) - fprintf (stderr, _("state # %d:\n"), ds); - - sympartition (dset, dsize, symlist, duplist); - - for (sym = 1; sym <= numecs; ++sym) { - if (symlist[sym]) { - symlist[sym] = 0; - - if (duplist[sym] == NIL) { - /* Symbol has unique out-transitions. */ - numstates = - symfollowset (dset, dsize, - sym, nset); - nset = epsclosure (nset, - &numstates, - accset, &nacc, - &hashval); - - if (snstods - (nset, numstates, accset, nacc, - hashval, &newds)) { - totnst = totnst + - numstates; - ++todo_next; - numas += nacc; - - if (variable_trailing_context_rules && nacc > 0) - check_trailing_context - (nset, - numstates, - accset, - nacc); - } - - state[sym] = newds; - - if (trace) - fprintf (stderr, - "\t%d\t%d\n", sym, - newds); - - targfreq[++targptr] = 1; - targstate[targptr] = newds; - ++numuniq; - } - - else { - /* sym's equivalence class has the same - * transitions as duplist(sym)'s - * equivalence class. - */ - targ = state[duplist[sym]]; - state[sym] = targ; - - if (trace) - fprintf (stderr, - "\t%d\t%d\n", sym, - targ); - - /* Update frequency count for - * destination state. - */ - - i = 0; - while (targstate[++i] != targ) ; - - ++targfreq[i]; - ++numdup; - } - - ++totaltrans; - duplist[sym] = NIL; - } - } - - if (caseins && !useecs) { - register int j; - - for (i = 'A', j = 'a'; i <= 'Z'; ++i, ++j) { - if (state[i] == 0 && state[j] != 0) - /* We're adding a transition. */ - ++totaltrans; - - else if (state[i] != 0 && state[j] == 0) - /* We're taking away a transition. */ - --totaltrans; - - state[i] = state[j]; - } - } - - numsnpairs += totaltrans; - - if (ds > num_start_states) - check_for_backing_up (ds, state); - - if (nultrans) { - nultrans[ds] = state[NUL_ec]; - state[NUL_ec] = 0; /* remove transition */ - } - - if (fulltbl) { - - /* Each time we hit here, it's another td_hilen, so we realloc. */ - yynxt_tbl->td_hilen++; - yynxt_tbl->td_data = yynxt_data = - (flex_int32_t *) realloc (yynxt_data, - yynxt_tbl->td_hilen * - yynxt_tbl->td_lolen * - sizeof (flex_int32_t)); - - - if (gentables) - outn (" {"); - - /* Supply array's 0-element. */ - if (ds == end_of_buffer_state) { - mk2data (-end_of_buffer_state); - yynxt_data[yynxt_curr++] = - -end_of_buffer_state; - } - else { - mk2data (end_of_buffer_state); - yynxt_data[yynxt_curr++] = - end_of_buffer_state; - } - - for (i = 1; i < num_full_table_rows; ++i) { - /* Jams are marked by negative of state - * number. - */ - mk2data (state[i] ? state[i] : -ds); - yynxt_data[yynxt_curr++] = - state[i] ? state[i] : -ds; - } - - dataflush (); - if (gentables) - outn (" },\n"); - } - - else if (fullspd) - place_state (state, ds, totaltrans); - - else if (ds == end_of_buffer_state) - /* Special case this state to make sure it does what - * it's supposed to, i.e., jam on end-of-buffer. - */ - stack1 (ds, 0, 0, JAMSTATE); - - else { /* normal, compressed state */ - - /* Determine which destination state is the most - * common, and how many transitions to it there are. - */ - - comfreq = 0; - comstate = 0; - - for (i = 1; i <= targptr; ++i) - if (targfreq[i] > comfreq) { - comfreq = targfreq[i]; - comstate = targstate[i]; - } - - bldtbl (state, ds, totaltrans, comstate, comfreq); - } - } - - if (fulltbl) { - dataend (); - if (tablesext) { - yytbl_data_compress (yynxt_tbl); - if (yytbl_data_fwrite (&tableswr, yynxt_tbl) < 0) - flexerror (_ - ("Could not write yynxt_tbl[][]")); - } - if (yynxt_tbl) { - yytbl_data_destroy (yynxt_tbl); - yynxt_tbl = 0; - } - } - - else if (!fullspd) { - cmptmps (); /* create compressed template entries */ - - /* Create tables for all the states with only one - * out-transition. - */ - while (onesp > 0) { - mk1tbl (onestate[onesp], onesym[onesp], - onenext[onesp], onedef[onesp]); - --onesp; - } - - mkdeftbl (); - } - - flex_free ((void *) accset); - flex_free ((void *) nset); -} - - -/* snstods - converts a set of ndfa states into a dfa state - * - * synopsis - * is_new_state = snstods( int sns[numstates], int numstates, - * int accset[num_rules+1], int nacc, - * int hashval, int *newds_addr ); - * - * On return, the dfa state number is in newds. - */ - -int snstods (sns, numstates, accset, nacc, hashval, newds_addr) - int sns[], numstates, accset[], nacc, hashval, *newds_addr; -{ - int didsort = 0; - register int i, j; - int newds, *oldsns; - - for (i = 1; i <= lastdfa; ++i) - if (hashval == dhash[i]) { - if (numstates == dfasiz[i]) { - oldsns = dss[i]; - - if (!didsort) { - /* We sort the states in sns so we - * can compare it to oldsns quickly. - * We use bubble because there probably - * aren't very many states. - */ - bubble (sns, numstates); - didsort = 1; - } - - for (j = 1; j <= numstates; ++j) - if (sns[j] != oldsns[j]) - break; - - if (j > numstates) { - ++dfaeql; - *newds_addr = i; - return 0; - } - - ++hshcol; - } - - else - ++hshsave; - } - - /* Make a new dfa. */ - - if (++lastdfa >= current_max_dfas) - increase_max_dfas (); - - newds = lastdfa; - - dss[newds] = allocate_integer_array (numstates + 1); - - /* If we haven't already sorted the states in sns, we do so now, - * so that future comparisons with it can be made quickly. - */ - - if (!didsort) - bubble (sns, numstates); - - for (i = 1; i <= numstates; ++i) - dss[newds][i] = sns[i]; - - dfasiz[newds] = numstates; - dhash[newds] = hashval; - - if (nacc == 0) { - if (reject) - dfaacc[newds].dfaacc_set = (int *) 0; - else - dfaacc[newds].dfaacc_state = 0; - - accsiz[newds] = 0; - } - - else if (reject) { - /* We sort the accepting set in increasing order so the - * disambiguating rule that the first rule listed is considered - * match in the event of ties will work. We use a bubble - * sort since the list is probably quite small. - */ - - bubble (accset, nacc); - - dfaacc[newds].dfaacc_set = - allocate_integer_array (nacc + 1); - - /* Save the accepting set for later */ - for (i = 1; i <= nacc; ++i) { - dfaacc[newds].dfaacc_set[i] = accset[i]; - - if (accset[i] <= num_rules) - /* Who knows, perhaps a REJECT can yield - * this rule. - */ - rule_useful[accset[i]] = true; - } - - accsiz[newds] = nacc; - } - - else { - /* Find lowest numbered rule so the disambiguating rule - * will work. - */ - j = num_rules + 1; - - for (i = 1; i <= nacc; ++i) - if (accset[i] < j) - j = accset[i]; - - dfaacc[newds].dfaacc_state = j; - - if (j <= num_rules) - rule_useful[j] = true; - } - - *newds_addr = newds; - - return 1; -} - - -/* symfollowset - follow the symbol transitions one step - * - * synopsis - * numstates = symfollowset( int ds[current_max_dfa_size], int dsize, - * int transsym, int nset[current_max_dfa_size] ); - */ - -int symfollowset (ds, dsize, transsym, nset) - int ds[], dsize, transsym, nset[]; -{ - int ns, tsp, sym, i, j, lenccl, ch, numstates, ccllist; - - numstates = 0; - - for (i = 1; i <= dsize; ++i) { /* for each nfa state ns in the state set of ds */ - ns = ds[i]; - sym = transchar[ns]; - tsp = trans1[ns]; - - if (sym < 0) { /* it's a character class */ - sym = -sym; - ccllist = cclmap[sym]; - lenccl = ccllen[sym]; - - if (cclng[sym]) { - for (j = 0; j < lenccl; ++j) { - /* Loop through negated character - * class. - */ - ch = ccltbl[ccllist + j]; - - if (ch == 0) - ch = NUL_ec; - - if (ch > transsym) - /* Transsym isn't in negated - * ccl. - */ - break; - - else if (ch == transsym) - /* next 2 */ - goto bottom; - } - - /* Didn't find transsym in ccl. */ - nset[++numstates] = tsp; - } - - else - for (j = 0; j < lenccl; ++j) { - ch = ccltbl[ccllist + j]; - - if (ch == 0) - ch = NUL_ec; - - if (ch > transsym) - break; - else if (ch == transsym) { - nset[++numstates] = tsp; - break; - } - } - } - - else if (sym >= 'A' && sym <= 'Z' && caseins) - flexfatal (_ - ("consistency check failed in symfollowset")); - - else if (sym == SYM_EPSILON) { /* do nothing */ - } - - else if (ABS (ecgroup[sym]) == transsym) - nset[++numstates] = tsp; - - bottom:; - } - - return numstates; -} - - -/* sympartition - partition characters with same out-transitions - * - * synopsis - * sympartition( int ds[current_max_dfa_size], int numstates, - * int symlist[numecs], int duplist[numecs] ); - */ - -void sympartition (ds, numstates, symlist, duplist) - int ds[], numstates; - int symlist[], duplist[]; -{ - int tch, i, j, k, ns, dupfwd[CSIZE + 1], lenccl, cclp, ich; - - /* Partitioning is done by creating equivalence classes for those - * characters which have out-transitions from the given state. Thus - * we are really creating equivalence classes of equivalence classes. - */ - - for (i = 1; i <= numecs; ++i) { /* initialize equivalence class list */ - duplist[i] = i - 1; - dupfwd[i] = i + 1; - } - - duplist[1] = NIL; - dupfwd[numecs] = NIL; - - for (i = 1; i <= numstates; ++i) { - ns = ds[i]; - tch = transchar[ns]; - - if (tch != SYM_EPSILON) { - if (tch < -lastccl || tch >= csize) { - flexfatal (_ - ("bad transition character detected in sympartition()")); - } - - if (tch >= 0) { /* character transition */ - int ec = ecgroup[tch]; - - mkechar (ec, dupfwd, duplist); - symlist[ec] = 1; - } - - else { /* character class */ - tch = -tch; - - lenccl = ccllen[tch]; - cclp = cclmap[tch]; - mkeccl (ccltbl + cclp, lenccl, dupfwd, - duplist, numecs, NUL_ec); - - if (cclng[tch]) { - j = 0; - - for (k = 0; k < lenccl; ++k) { - ich = ccltbl[cclp + k]; - - if (ich == 0) - ich = NUL_ec; - - for (++j; j < ich; ++j) - symlist[j] = 1; - } - - for (++j; j <= numecs; ++j) - symlist[j] = 1; - } - - else - for (k = 0; k < lenccl; ++k) { - ich = ccltbl[cclp + k]; - - if (ich == 0) - ich = NUL_ec; - - symlist[ich] = 1; - } - } - } - } -} diff --git a/src/bin/flex/ecs.c b/src/bin/flex/ecs.c deleted file mode 100644 index e2abbe4862..0000000000 --- a/src/bin/flex/ecs.c +++ /dev/null @@ -1,219 +0,0 @@ -/* ecs - equivalence class routines */ - -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* This file is part of flex */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - - -#include "flexdef.h" - -/* ccl2ecl - convert character classes to set of equivalence classes */ - -void ccl2ecl () -{ - int i, ich, newlen, cclp, ccls, cclmec; - - for (i = 1; i <= lastccl; ++i) { - /* We loop through each character class, and for each character - * in the class, add the character's equivalence class to the - * new "character" class we are creating. Thus when we are all - * done, character classes will really consist of collections - * of equivalence classes - */ - - newlen = 0; - cclp = cclmap[i]; - - for (ccls = 0; ccls < ccllen[i]; ++ccls) { - ich = ccltbl[cclp + ccls]; - cclmec = ecgroup[ich]; - - if (cclmec > 0) { - ccltbl[cclp + newlen] = cclmec; - ++newlen; - } - } - - ccllen[i] = newlen; - } -} - - -/* cre8ecs - associate equivalence class numbers with class members - * - * fwd is the forward linked-list of equivalence class members. bck - * is the backward linked-list, and num is the number of class members. - * - * Returned is the number of classes. - */ - -int cre8ecs (fwd, bck, num) - int fwd[], bck[], num; -{ - int i, j, numcl; - - numcl = 0; - - /* Create equivalence class numbers. From now on, ABS( bck(x) ) - * is the equivalence class number for object x. If bck(x) - * is positive, then x is the representative of its equivalence - * class. - */ - for (i = 1; i <= num; ++i) - if (bck[i] == NIL) { - bck[i] = ++numcl; - for (j = fwd[i]; j != NIL; j = fwd[j]) - bck[j] = -numcl; - } - - return numcl; -} - - -/* mkeccl - update equivalence classes based on character class xtions - * - * synopsis - * Char ccls[]; - * int lenccl, fwd[llsiz], bck[llsiz], llsiz, NUL_mapping; - * void mkeccl( Char ccls[], int lenccl, int fwd[llsiz], int bck[llsiz], - * int llsiz, int NUL_mapping ); - * - * ccls contains the elements of the character class, lenccl is the - * number of elements in the ccl, fwd is the forward link-list of equivalent - * characters, bck is the backward link-list, and llsiz size of the link-list. - * - * NUL_mapping is the value which NUL (0) should be mapped to. - */ - -void mkeccl (ccls, lenccl, fwd, bck, llsiz, NUL_mapping) - Char ccls[]; - int lenccl, fwd[], bck[], llsiz, NUL_mapping; -{ - int cclp, oldec, newec; - int cclm, i, j; - static unsigned char cclflags[CSIZE]; /* initialized to all '\0' */ - - /* Note that it doesn't matter whether or not the character class is - * negated. The same results will be obtained in either case. - */ - - cclp = 0; - - while (cclp < lenccl) { - cclm = ccls[cclp]; - - if (NUL_mapping && cclm == 0) - cclm = NUL_mapping; - - oldec = bck[cclm]; - newec = cclm; - - j = cclp + 1; - - for (i = fwd[cclm]; i != NIL && i <= llsiz; i = fwd[i]) { /* look for the symbol in the character class */ - for (; j < lenccl; ++j) { - register int ccl_char; - - if (NUL_mapping && ccls[j] == 0) - ccl_char = NUL_mapping; - else - ccl_char = ccls[j]; - - if (ccl_char > i) - break; - - if (ccl_char == i && !cclflags[j]) { - /* We found an old companion of cclm - * in the ccl. Link it into the new - * equivalence class and flag it as - * having been processed. - */ - - bck[i] = newec; - fwd[newec] = i; - newec = i; - /* Set flag so we don't reprocess. */ - cclflags[j] = 1; - - /* Get next equivalence class member. */ - /* continue 2 */ - goto next_pt; - } - } - - /* Symbol isn't in character class. Put it in the old - * equivalence class. - */ - - bck[i] = oldec; - - if (oldec != NIL) - fwd[oldec] = i; - - oldec = i; - - next_pt:; - } - - if (bck[cclm] != NIL || oldec != bck[cclm]) { - bck[cclm] = NIL; - fwd[oldec] = NIL; - } - - fwd[newec] = NIL; - - /* Find next ccl member to process. */ - - for (++cclp; cclflags[cclp] && cclp < lenccl; ++cclp) { - /* Reset "doesn't need processing" flag. */ - cclflags[cclp] = 0; - } - } -} - - -/* mkechar - create equivalence class for single character */ - -void mkechar (tch, fwd, bck) - int tch, fwd[], bck[]; -{ - /* If until now the character has been a proper subset of - * an equivalence class, break it away to create a new ec - */ - - if (fwd[tch] != NIL) - bck[fwd[tch]] = bck[tch]; - - if (bck[tch] != NIL) - fwd[bck[tch]] = fwd[tch]; - - fwd[tch] = NIL; - bck[tch] = NIL; -} diff --git a/src/bin/flex/filter.c b/src/bin/flex/filter.c deleted file mode 100644 index 5e09ec603c..0000000000 --- a/src/bin/flex/filter.c +++ /dev/null @@ -1,405 +0,0 @@ -/* filter - postprocessing of flex output through filters */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -#include "flexdef.h" -static const char * check_4_gnu_m4 = - "m4_dnl ifdef(`__gnu__', ," - "`errprint(Flex requires GNU M4. Set the PATH or set the M4 environment variable to its path name.)" - " m4exit(2)')\n"; - - -/** global chain. */ -struct filter *output_chain = NULL; - -/* Allocate and initialize an external filter. - * @param chain the current chain or NULL for new chain - * @param cmd the command to execute. - * @param ... a NULL terminated list of (const char*) arguments to command, - * not including argv[0]. - * @return newest filter in chain - */ -struct filter *filter_create_ext (struct filter *chain, const char *cmd, - ...) -{ - struct filter *f; - int max_args; - const char *s; - va_list ap; - - /* allocate and initialize new filter */ - f = (struct filter *) flex_alloc (sizeof (struct filter)); - memset (f, 0, sizeof (*f)); - f->filter_func = NULL; - f->extra = NULL; - f->next = NULL; - f->argc = 0; - - if (chain != NULL) { - /* append f to end of chain */ - while (chain->next) - chain = chain->next; - chain->next = f; - } - - - /* allocate argv, and populate it with the argument list. */ - max_args = 8; - f->argv = - (const char **) flex_alloc (sizeof (char *) * - (max_args + 1)); - f->argv[f->argc++] = cmd; - - va_start (ap, cmd); - while ((s = va_arg (ap, const char *)) != NULL) { - if (f->argc >= max_args) { - max_args += 8; - f->argv = - (const char **) flex_realloc (f->argv, - sizeof (char - *) * - (max_args + - 1)); - } - f->argv[f->argc++] = s; - } - f->argv[f->argc] = NULL; - - va_end (ap); - return f; -} - -/* Allocate and initialize an internal filter. - * @param chain the current chain or NULL for new chain - * @param filter_func The function that will perform the filtering. - * filter_func should return 0 if successful, and -1 - * if an error occurs -- or it can simply exit(). - * @param extra optional user-defined data to pass to the filter. - * @return newest filter in chain - */ -struct filter *filter_create_int (struct filter *chain, - int (*filter_func) (struct filter *), - void *extra) -{ - struct filter *f; - - /* allocate and initialize new filter */ - f = (struct filter *) flex_alloc (sizeof (struct filter)); - memset (f, 0, sizeof (*f)); - f->next = NULL; - f->argc = 0; - f->argv = NULL; - - f->filter_func = filter_func; - f->extra = extra; - - if (chain != NULL) { - /* append f to end of chain */ - while (chain->next) - chain = chain->next; - chain->next = f; - } - - return f; -} - -/** Fork and exec entire filter chain. - * @param chain The head of the chain. - * @return true on success. - */ -bool filter_apply_chain (struct filter * chain) -{ - int pid, pipes[2]; - - /* Tricky recursion, since we want to begin the chain - * at the END. Why? Because we need all the forked processes - * to be children of the main flex process. - */ - if (chain) - filter_apply_chain (chain->next); - else - return true; - - /* Now we are the right-most unprocessed link in the chain. - */ - - fflush (stdout); - fflush (stderr); - - if (pipe (pipes) == -1) - flexerror (_("pipe failed")); - - if ((pid = fork ()) == -1) - flexerror (_("fork failed")); - - if (pid == 0) { - /* child */ - close (pipes[1]); - if (dup2 (pipes[0], 0) == -1) - flexfatal (_("dup2(pipes[0],0)")); - close (pipes[0]); - - /* run as a filter, either internally or by exec */ - if (chain->filter_func) { - int r; - - /* setup streams again */ - if ( ! fdopen (0, "r")) - flexfatal (_("fdopen(0) failed")); - if (!fdopen (1, "w")) - flexfatal (_("fdopen(1) failed")); - - if ((r = chain->filter_func (chain)) == -1) - flexfatal (_("filter_func failed")); - exit (0); - } - else { - execvp (chain->argv[0], - (char **const) (chain->argv)); - flexfatal (_(chain->argv[0])); - } - - exit (1); - } - - /* Parent */ - close (pipes[0]); - if (dup2 (pipes[1], 1) == -1) - flexfatal (_("dup2(pipes[1],1)")); - close (pipes[1]); - if ( !fdopen (1, "w")) - flexfatal (_("fdopen(1) failed")); - - return true; -} - -/** Truncate the chain to max_len number of filters. - * @param chain the current chain. - * @param max_len the maximum length of the chain. - * @return the resulting length of the chain. - */ -int filter_truncate (struct filter *chain, int max_len) -{ - int len = 1; - - if (!chain) - return 0; - - while (chain->next && len < max_len) { - chain = chain->next; - ++len; - } - - chain->next = NULL; - return len; -} - -/** Splits the chain in order to write to a header file. - * Similar in spirit to the 'tee' program. - * The header file name is in extra. - * @return 0 (zero) on success, and -1 on failure. - */ -int filter_tee_header (struct filter *chain) -{ - /* This function reads from stdin and writes to both the C file and the - * header file at the same time. - */ - - const int readsz = 512; - char *buf; - int to_cfd = -1; - FILE *to_c = NULL, *to_h = NULL; - bool write_header; - - write_header = (chain->extra != NULL); - - /* Store a copy of the stdout pipe, which is already piped to C file - * through the running chain. Then create a new pipe to the H file as - * stdout, and fork the rest of the chain again. - */ - - if ((to_cfd = dup (1)) == -1) - flexfatal (_("dup(1) failed")); - to_c = fdopen (to_cfd, "w"); - - if (write_header) { - if (freopen ((char *) chain->extra, "w", stdout) == NULL) - flexfatal (_("freopen(headerfilename) failed")); - - filter_apply_chain (chain->next); - to_h = stdout; - } - - /* Now to_c is a pipe to the C branch, and to_h is a pipe to the H branch. - */ - - if (write_header) { - fputs (check_4_gnu_m4, to_h); - fputs ("m4_changecom`'m4_dnl\n", to_h); - fputs ("m4_changequote`'m4_dnl\n", to_h); - fputs ("m4_changequote([[,]])[[]]m4_dnl\n", to_h); - fputs ("m4_define( [[M4_YY_IN_HEADER]],[[]])m4_dnl\n", - to_h); - fprintf (to_h, "#ifndef %sHEADER_H\n", prefix); - fprintf (to_h, "#define %sHEADER_H 1\n", prefix); - fprintf (to_h, "#define %sIN_HEADER 1\n\n", prefix); - fprintf (to_h, - "m4_define( [[M4_YY_OUTFILE_NAME]],[[%s]])m4_dnl\n", - headerfilename ? headerfilename : ""); - - } - - fputs (check_4_gnu_m4, to_c); - fputs ("m4_changecom`'m4_dnl\n", to_c); - fputs ("m4_changequote`'m4_dnl\n", to_c); - fputs ("m4_changequote([[,]])[[]]m4_dnl\n", to_c); - fprintf (to_c, "m4_define( [[M4_YY_OUTFILE_NAME]],[[%s]])m4_dnl\n", - outfilename ? outfilename : ""); - - buf = (char *) flex_alloc (readsz); - while (fgets (buf, readsz, stdin)) { - fputs (buf, to_c); - if (write_header) - fputs (buf, to_h); - } - - if (write_header) { - fprintf (to_h, "\n"); - - /* write a fake line number. It will get fixed by the linedir filter. */ - fprintf (to_h, "#line 4000 \"M4_YY_OUTFILE_NAME\"\n"); - - fprintf (to_h, "#undef %sIN_HEADER\n", prefix); - fprintf (to_h, "#endif /* %sHEADER_H */\n", prefix); - fputs ("m4_undefine( [[M4_YY_IN_HEADER]])m4_dnl\n", to_h); - - fflush (to_h); - if (ferror (to_h)) - lerrsf (_("error writing output file %s"), - (char *) chain->extra); - - else if (fclose (to_h)) - lerrsf (_("error closing output file %s"), - (char *) chain->extra); - } - - fflush (to_c); - if (ferror (to_c)) - lerrsf (_("error writing output file %s"), - outfilename ? outfilename : ""); - - else if (fclose (to_c)) - lerrsf (_("error closing output file %s"), - outfilename ? outfilename : ""); - - while (wait (0) > 0) ; - - exit (0); - return 0; -} - -/** Adjust the line numbers in the #line directives of the generated scanner. - * After the m4 expansion, the line numbers are incorrect since the m4 macros - * can add or remove lines. This only adjusts line numbers for generated code, - * not user code. This also happens to be a good place to squeeze multiple - * blank lines into a single blank line. - */ -int filter_fix_linedirs (struct filter *chain) -{ - char *buf; - const int readsz = 512; - int lineno = 1; - bool in_gen = true; /* in generated code */ - bool last_was_blank = false; - - if (!chain) - return 0; - - buf = (char *) flex_alloc (readsz); - - while (fgets (buf, readsz, stdin)) { - - regmatch_t m[10]; - - /* Check for #line directive. */ - if (buf[0] == '#' - && regexec (®ex_linedir, buf, 3, m, 0) == 0) { - - int num; - char *fname; - - /* extract the line number and filename */ - num = regmatch_strtol (&m[1], buf, NULL, 0); - fname = regmatch_dup (&m[2], buf); - - if (strcmp - (fname, outfilename ? outfilename : "") - == 0 - || strcmp (fname, - headerfilename ? headerfilename : - "") == 0) { - /* Adjust the line directives. */ - in_gen = true; - sprintf (buf, "#line %d \"%s\"\n", - lineno + 1, fname); - free (fname); - - } - else { - /* it's a #line directive for code we didn't write */ - in_gen = false; - } - - last_was_blank = false; - } - - /* squeeze blank lines from generated code */ - else if (in_gen - && regexec (®ex_blank_line, buf, 0, NULL, - 0) == 0) { - if (last_was_blank) - continue; - else - last_was_blank = true; - } - - else { - /* it's a line of normal, non-empty code. */ - last_was_blank = false; - } - - fputs (buf, stdout); - lineno++; - } - fflush (stdout); - if (ferror (stdout)) - lerrsf (_("error writing output file %s"), - outfilename ? outfilename : ""); - - else if (fclose (stdout)) - lerrsf (_("error closing output file %s"), - outfilename ? outfilename : ""); - - return 0; -} - -/* vim:set expandtab cindent tabstop=4 softtabstop=4 shiftwidth=4 textwidth=0: */ diff --git a/src/bin/flex/flex.rdef b/src/bin/flex/flex.rdef deleted file mode 100644 index 521f2c70bb..0000000000 --- a/src/bin/flex/flex.rdef +++ /dev/null @@ -1,11 +0,0 @@ -resource app_version -{ - major = 2, - middle = 5, - minor = 33, - variety = B_APPV_FINAL, - internal = 0, - short_info = "flex", - long_info = "flex from http://flex.sourceforge.net/" -}; - diff --git a/src/bin/flex/flex.skl b/src/bin/flex/flex.skl deleted file mode 100644 index 683ead6eb9..0000000000 --- a/src/bin/flex/flex.skl +++ /dev/null @@ -1,3318 +0,0 @@ -%# -*-C-*- vi: set ft=c: -%# This file is processed in several stages. -%# Here are the stages, as best as I can describe: -%# -%# 1. flex.skl is processed through GNU m4 during the -%# pre-compilation stage of flex. Only macros starting -%# with `m4preproc_' are processed, and quoting is normal. -%# -%# 2. The preprocessed skeleton is translated verbatim into a -%# C array, saved as "skel.c" and compiled into the flex binary. -%# -%# 3. At runtime, the skeleton is generated and filtered (again) -%# through m4. Macros beginning with `m4_' will be processed. -%# The quoting is "[[" and "]]" so we don't interfere with -%# user code. -%# -%# All generate macros for the m4 stage contain the text "m4" or "M4" -%# in them. This is to distinguish them from CPP macros. -%# The exception to this rule is YY_G, which is an m4 macro, -%# but it needs to be remain short because it is used everywhere. -%# -/* A lexical scanner generated by flex */ - -%# Macros for preproc stage. -m4preproc_changecom - -%# Macros for runtime processing stage. -m4_changecom -m4_changequote -m4_changequote([[, ]]) - -%# -%# Lines in this skeleton starting with a "%" character are "control lines" -%# and affect the generation of the scanner. The possible control codes are -%# listed and processed in misc.c. -%# -%# %# - A comment. The current line is omitted from the generated scanner. -%# %if-c++-only - The following lines are printed for C++ scanners ONLY. -%# %if-c-only - The following lines are NOT printed for C++ scanners. -%# %if-c-or-c++ - The following lines are printed in BOTH C and C++ scanners. -%# %if-reentrant - Print for reentrant scanners.(push) -%# %if-not-reentrant - Print for non-reentrant scanners. (push) -%# %if-bison-bridge - Print for bison-bridge. (push) -%# %if-not-bison-bridge - Print for non-bison-bridge. (push) -%# %endif - pop from the previous if code. -%# %% - A stop-point, where code is inserted by flex. -%# Each stop-point is numbered here and also in the code generator. -%# (See gen.c, etc. for details.) -%# %not-for-header - Begin code that should NOT appear in a ".h" file. -%# %ok-for-header - %c and %e are used for building a header file. -%# %if-tables-serialization -%# -%# All control-lines EXCEPT comment lines ("%#") will be inserted into -%# the generated scanner as a C-style comment. This is to aid those who -%# edit the skeleton. -%# -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION FLEX_MAJOR_VERSION -#define YY_FLEX_MINOR_VERSION FLEX_MINOR_VERSION -#define YY_FLEX_SUBMINOR_VERSION FLEX_SUBMINOR_VERSION -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -%# Some negated symbols -m4_ifdef( [[M4_YY_IN_HEADER]], , [[m4_define([[M4_YY_NOT_IN_HEADER]], [[]])]]) -m4_ifdef( [[M4_YY_REENTRANT]], , [[m4_define([[M4_YY_NOT_REENTRANT]], [[]])]]) - -%# This is the m4 way to say "(stack_used || is_reentrant) -m4_ifdef( [[M4_YY_STACK_USED]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]]) -m4_ifdef( [[M4_YY_REENTRANT]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]]) - -%# Prefixes. -%# The complexity here is necessary so that m4 preserves -%# the argument lists to each C function. - - -m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]]) - -m4preproc_define(`M4_GEN_PREFIX', - ``m4_define(yy[[$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'') - -%if-c++-only - /* The c++ scanner is a mess. The FlexLexer.h header file relies on the - * following macro. This is required in order to pass the c++-multiple-scanners - * test in the regression suite. We get reports that it breaks inheritance. - * We will address this in a future release of flex, or omit the C++ scanner - * altogether. - */ - #define yyFlexLexer M4_YY_PREFIX[[FlexLexer]] -%endif - -%if-c-only - M4_GEN_PREFIX(`_create_buffer') - M4_GEN_PREFIX(`_delete_buffer') - M4_GEN_PREFIX(`_scan_buffer') - M4_GEN_PREFIX(`_scan_string') - M4_GEN_PREFIX(`_scan_bytes') - M4_GEN_PREFIX(`_init_buffer') - M4_GEN_PREFIX(`_flush_buffer') - M4_GEN_PREFIX(`_load_buffer_state') - M4_GEN_PREFIX(`_switch_to_buffer') - M4_GEN_PREFIX(`push_buffer_state') - M4_GEN_PREFIX(`pop_buffer_state') - M4_GEN_PREFIX(`ensure_buffer_stack') - M4_GEN_PREFIX(`lex') - M4_GEN_PREFIX(`restart') - M4_GEN_PREFIX(`lex_init') - M4_GEN_PREFIX(`lex_destroy') - M4_GEN_PREFIX(`get_debug') - M4_GEN_PREFIX(`set_debug') - M4_GEN_PREFIX(`get_extra') - M4_GEN_PREFIX(`set_extra') - M4_GEN_PREFIX(`get_in') - M4_GEN_PREFIX(`set_in') - M4_GEN_PREFIX(`get_out') - M4_GEN_PREFIX(`set_out') - M4_GEN_PREFIX(`get_leng') - M4_GEN_PREFIX(`get_text') - M4_GEN_PREFIX(`get_lineno') - M4_GEN_PREFIX(`set_lineno') - m4_ifdef( [[M4_YY_REENTRANT]], - [[ - M4_GEN_PREFIX(`get_column') - M4_GEN_PREFIX(`set_column') - ]]) - M4_GEN_PREFIX(`wrap') -%endif - -m4_ifdef( [[M4_YY_BISON_LVAL]], -[[ - M4_GEN_PREFIX(`get_lval') - M4_GEN_PREFIX(`set_lval') -]]) - -m4_ifdef( [[]], -[[ - M4_GEN_PREFIX(`get_lloc') - M4_GEN_PREFIX(`set_lloc') -]]) - - - M4_GEN_PREFIX(`alloc') - M4_GEN_PREFIX(`realloc') - M4_GEN_PREFIX(`free') - -%if-c-only -m4_ifdef( [[M4_YY_NOT_REENTRANT]], -[[ - M4_GEN_PREFIX(`text') - M4_GEN_PREFIX(`leng') - M4_GEN_PREFIX(`in') - M4_GEN_PREFIX(`out') - M4_GEN_PREFIX(`_flex_debug') - M4_GEN_PREFIX(`lineno') -]]) -%endif - - -m4_ifdef( [[M4_YY_TABLES_EXTERNAL]], -[[ - M4_GEN_PREFIX(`tables_fload') - M4_GEN_PREFIX(`tables_destroy') - M4_GEN_PREFIX(`TABLES_NAME') -]]) - -/* 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 -#include -#include -%endif -/* end standard C headers. */ - -%if-c-or-c++ -m4preproc_include(`flexint.h') -%endif - -%if-c++-only -/* begin standard C++ headers. */ -#include -#include -#include -#include -/* end standard C++ headers. */ -%endif - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -%# For compilers that can not handle prototypes. -%# e.g., -%# The function prototype -%# int foo(int x, char* y); -%# -%# ...should be written as -%# int foo M4_YY_PARAMS(int x, char* y); -%# -%# ...which could possibly generate -%# int foo (); -%# -m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]], -[[ - m4_define( [[M4_YY_PARAMS]], [[()]]) -]], -[[ - m4_define( [[M4_YY_PARAMS]], [[($*)]]) -]]) - -%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 - -/* An opaque pointer. */ -#ifndef YY_TYPEDEF_YY_SCANNER_T -#define YY_TYPEDEF_YY_SCANNER_T -typedef void* yyscan_t; -#endif - -%# Declare yyguts variable -m4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]]) -%# For use wherever a Global is accessed or assigned. -m4_define( [[YY_G]], [[yyg->$1]]) - -%# For use in function prototypes to append the additional argument. -m4_define( [[M4_YY_PROTO_LAST_ARG]], [[, yyscan_t yyscanner]]) -m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[yyscan_t yyscanner]]) - -%# For use in function definitions to append the additional argument. -m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]], -[[ - m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]]) - m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]]) -]], -[[ - m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]]) - m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]]) -]]) -m4_define( [[M4_YY_DECL_LAST_ARG]], [[yyscan_t yyscanner;]]) - -%# For use in function calls to pass the additional argument. -m4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]]) -m4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]]) - -%# For use in function documentation to adjust for additional argument. -m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]]) - -/* For convenience, these vars (plus the bison vars far below) - are macros in the reentrant scanner. */ -#define yyin YY_G(yyin_r) -#define yyout YY_G(yyout_r) -#define yyextra YY_G(yyextra_r) -#define yyleng YY_G(yyleng_r) -#define yytext YY_G(yytext_r) -#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) -#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) -#define yy_flex_debug YY_G(yy_flex_debug_r) - -m4_define( [[M4_YY_INCR_LINENO]], -[[ - do{ yylineno++; - yycolumn=0; - }while(0) -]]) - -int yylex_init M4_YY_PARAMS(yyscan_t* scanner); -%endif - - - -%if-not-reentrant - -m4_define( [[M4_YY_INCR_LINENO]], -[[ - yylineno++; -]]) - -%# Define these macros to be no-ops. -m4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]]) -m4_define( [[YY_G]], [[($1)]]) -m4_define( [[M4_YY_PROTO_LAST_ARG]]) -m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[void]]) -m4_define( [[M4_YY_DEF_LAST_ARG]]) - -m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]], -[[ - m4_define( [[M4_YY_DEF_ONLY_ARG]]) -]], -[[ - m4_define( [[M4_YY_DEF_ONLY_ARG]], [[void]]) -]]) -m4_define([[M4_YY_DECL_LAST_ARG]]) -m4_define([[M4_YY_CALL_LAST_ARG]]) -m4_define([[M4_YY_CALL_ONLY_ARG]]) -m4_define( [[M4_YY_DOC_PARAM]], [[]]) - -%endif - - -m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]], -[[ -%# For compilers that need traditional function definitions. -%# e.g., -%# The function prototype taking 2 arguments -%# int foo (int x, char* y) -%# -%# ...should be written as -%# int foo YYFARGS2(int,x, char*,y) -%# -%# ...which could possibly generate -%# int foo (x,y,yyscanner) -%# int x; -%# char * y; -%# yyscan_t yyscanner; -%# -%# Generate traditional function defs - m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\]] - M4_YY_DECL_LAST_ARG]]) - m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\]] - $1 $2; [[\]] - M4_YY_DECL_LAST_ARG]]) - m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]] - $1 $2; [[\]] - $3 $4; [[\]] - M4_YY_DECL_LAST_ARG]]) - m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]] - $1 $2; [[\]] - $3 $4; [[\]] - $5 $6; [[\]] - M4_YY_DECL_LAST_ARG]]) -]], -[[ -%# Generate C99 function defs. - m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)]]) - m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]]) - m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]]) - m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]]) -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* 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_G(yy_start) = 1 + 2 * -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* 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_G(yy_start) - 1) / 2) -#define YYSTATE YY_START -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG ) -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -#define YY_END_OF_BUFFER_CHAR 0 -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* 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 - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ - m4_ifdef( [[M4_YY_USE_LINENO]], - [[ - /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires - * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE yylex. - * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-yylineno scanner, because yy_act is - * normally declared as a register variable-- so it is not worth it. - */ - #define YY_LESS_LINENO(n) \ - do { \ - int yyl;\ - for ( yyl = n; yyl < yyleng; ++yyl )\ - if ( yytext[yyl] == '\n' )\ - --yylineno;\ - }while(0) - ]], - [[ - #define YY_LESS_LINENO(n) - ]]) -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* 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_G(yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -#define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG ) -]]) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int 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 - std::istream* yy_input_file; -%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; -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -#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 - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* 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_G(yy_buffer_stack) \ - ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \ - : NULL) -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* 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_G(yy_buffer_stack)[YY_G(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 M4_YY_PARAMS( FILE *input_file M4_YY_PROTO_LAST_ARG ); -void yy_switch_to_buffer M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG ); -YY_BUFFER_STATE yy_create_buffer M4_YY_PARAMS( FILE *file, int size M4_YY_PROTO_LAST_ARG ); -void yy_delete_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG ); -void yy_flush_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG ); -void yypush_buffer_state M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG ); -void yypop_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -static void yyensure_buffer_stack M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -static void yy_load_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -static void yy_init_buffer M4_YY_PARAMS( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG ); -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG) -]]) - -YY_BUFFER_STATE yy_scan_buffer M4_YY_PARAMS( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG ); -YY_BUFFER_STATE yy_scan_string M4_YY_PARAMS( yyconst char *yy_str M4_YY_PROTO_LAST_ARG ); -YY_BUFFER_STATE yy_scan_bytes M4_YY_PARAMS( yyconst char *bytes, int len M4_YY_PROTO_LAST_ARG ); - -%endif - -void *yyalloc M4_YY_PARAMS( yy_size_t M4_YY_PROTO_LAST_ARG ); -void *yyrealloc M4_YY_PARAMS( void *, yy_size_t M4_YY_PROTO_LAST_ARG ); -void yyfree M4_YY_PARAMS( void * M4_YY_PROTO_LAST_ARG ); - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -#define yy_new_buffer yy_create_buffer -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -#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 - -%if-c-only Standard (non-C++) definition - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -static yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -static yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state M4_YY_PROTO_LAST_ARG); -static int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG ); -]]) - -%endif - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - YY_G(yytext_ptr) = yy_bp; \ -%% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ - YY_G(yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ -%% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ - YY_G(yy_c_buf_p) = yy_cp; -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -%% [4.0] data tables for the DFA and the user's section 1 definitions go here -]]) - -m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]]) -M4_YY_SC_DEFS -m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]]) - -m4_ifdef( [[M4_YY_NO_UNISTD_H]],, -[[ -#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 -#include -%endif -#endif -]]) - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -%if-c-only Reentrant structure and macros (non-C++). -%if-reentrant - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* Holds the entire state of the reentrant scanner. */ -struct yyguts_t - { - - /* User-defined. Not touched by flex. */ - YY_EXTRA_TYPE yyextra_r; - - /* The rest are the same as the globals declared in the non-reentrant scanner. */ - FILE *yyin_r, *yyout_r; - size_t yy_buffer_stack_top; /**< index of top of stack. */ - size_t yy_buffer_stack_max; /**< capacity of stack. */ - YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ - char yy_hold_char; - int yy_n_chars; - int yyleng_r; - char *yy_c_buf_p; - int yy_init; - int yy_start; - int yy_did_buffer_switch_on_eof; - int yy_start_stack_ptr; - int yy_start_stack_depth; - int *yy_start_stack; - yy_state_type yy_last_accepting_state; - char* yy_last_accepting_cpos; - - int yylineno_r; - int yy_flex_debug_r; - -m4_ifdef( [[M4_YY_USES_REJECT]], -[[ - yy_state_type *yy_state_buf; - yy_state_type *yy_state_ptr; - char *yy_full_match; - int yy_lp; -]]) - -m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]], -[[ - char yytext_r[YYLMAX]; - char *yytext_ptr; - int yy_more_offset; - int yy_prev_more_offset; -]], -[[ - char *yytext_r; - int yy_more_flag; - int yy_more_len; -]]) - -m4_ifdef( [[M4_YY_BISON_LVAL]], -[[ - YYSTYPE * yylval_r; -]]) - -m4_ifdef( [[]], -[[ - YYLTYPE * yylloc_r; -]]) - - }; /* end struct yyguts_t */ -]]) - - -%if-c-only -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -]]) -%endif - -%if-reentrant - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ - m4_ifdef( [[M4_YY_BISON_LVAL]], - [[ - /* This must go here because YYSTYPE and YYLTYPE are included - * from bison output in section 1.*/ - # define yylval YY_G(yylval_r) - ]]) - - m4_ifdef( [[]], - [[ - # define yylloc YY_G(yylloc_r) - ]]) -]]) - -%endif - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -m4_ifdef( [[M4_YY_NO_DESTROY]],, -[[ -int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -]]) - -m4_ifdef( [[M4_YY_NO_GET_DEBUG]],, -[[ -int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -]]) - -m4_ifdef( [[M4_YY_NO_SET_DEBUG]],, -[[ -void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG ); -]]) - -m4_ifdef( [[M4_YY_NO_GET_EXTRA]],, -[[ -YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -]]) - -m4_ifdef( [[M4_YY_NO_SET_EXTRA]],, -[[ -void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG ); -]]) - -m4_ifdef( [[M4_YY_NO_GET_IN]],, -[[ -FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -]]) - -m4_ifdef( [[M4_YY_NO_SET_IN]],, -[[ -void yyset_in M4_YY_PARAMS( FILE * in_str M4_YY_PROTO_LAST_ARG ); -]]) - -m4_ifdef( [[M4_YY_NO_GET_OUT]],, -[[ -FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -]]) - -m4_ifdef( [[M4_YY_NO_SET_OUT]],, -[[ -void yyset_out M4_YY_PARAMS( FILE * out_str M4_YY_PROTO_LAST_ARG ); -]]) - -m4_ifdef( [[M4_YY_NO_GET_LENG]],, -[[ -int yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -]]) - -m4_ifdef( [[M4_YY_NO_GET_TEXT]],, -[[ -char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -]]) - -m4_ifdef( [[M4_YY_NO_GET_LINENO]],, -[[ -int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -]]) - -m4_ifdef( [[M4_YY_NO_SET_LINENO]],, -[[ -void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG ); -]]) - -%if-bison-bridge -m4_ifdef( [[M4_YY_NO_GET_LVAL]],, -[[ -YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -]]) - -void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG ); - -m4_ifdef( [[]], -[[ - m4_ifdef( [[M4_YY_NO_GET_LLOC]],, - [[ - YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); - ]]) - - m4_ifdef( [[M4_YY_NO_SET_LLOC]],, - [[ - void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG ); - ]]) -]]) -%endif -%endif End reentrant structures and macros. - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -#else -extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -#endif -#endif - -%not-for-header - m4_ifdef( [[M4_YY_NO_UNPUT]],, - [[ - static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG); - ]]) -%ok-for-header -%endif - -#ifndef yytext_ptr -static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG); -#endif - -#ifndef YY_NO_INPUT -%if-c-only Standard (non-C++) definition -%not-for-header -#ifdef __cplusplus -static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -#else -static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); -#endif -%ok-for-header -%endif -#endif - - -%if-c-only -%# TODO: This is messy. -m4_ifdef( [[M4_YY_STACK_USED]], -[[ - -m4_ifdef( [[M4_YY_NOT_REENTRANT]], -[[ - m4_ifdef( [[M4_YY_NOT_IN_HEADER]], - [[ - static int yy_start_stack_ptr = 0; - static int yy_start_stack_depth = 0; - static int *yy_start_stack = NULL; - ]]) -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ - m4_ifdef( [[M4_YY_NO_PUSH_STATE]],, - [[ - static void yy_push_state M4_YY_PARAMS( int new_state M4_YY_PROTO_LAST_ARG); - ]]) - m4_ifdef( [[M4_YY_NO_POP_STATE]],, - [[ - static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); - ]]) - m4_ifdef( [[M4_YY_NO_TOP_STATE]],, - [[ - static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); - ]]) -]]) - -]], -[[ -m4_define( [[M4_YY_NO_PUSH_STATE]]) -m4_define( [[M4_YY_NO_POP_STATE]]) -m4_define( [[M4_YY_NO_TOP_STATE]]) -]]) -%endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* 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 (void) fwrite( yytext, yyleng, 1, yyout ) -%endif -%if-c++-only C++ definition -#define ECHO LexerOutput( yytext, yyleng ) -%endif -#endif -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* 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-c++-only C++ definition \ - if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -%endif - -#endif -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* 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 - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -%if-c-only -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG) -%endif -%if-c++-only -#define YY_FATAL_ERROR(msg) LexerError( msg ) -%endif -#endif -]]) - -%if-tables-serialization structures and prototypes -m4preproc_include(`tables_shared.h') - -/* Load the DFA tables from the given stream. */ -int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG); - -/* Unload the tables from memory. */ -int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG); -%not-for-header - -/** Describes a mapping from a serialized table id to its deserialized state in - * this scanner. This is the bridge between our "generic" deserialization code - * and the specifics of this scanner. - */ -struct yytbl_dmap { - enum yytbl_id dm_id;/**< table identifier */ - void **dm_arr; /**< address of pointer to store the deserialized table. */ - size_t dm_sz; /**< local sizeof() each element in table. */ -}; - -/** A {0,0,0}-terminated list of structs, forming the map */ -static struct yytbl_dmap yydmap[] = -{ -%tables-yydmap generated elements - {0,0,0} -}; - -/** A tables-reader object to maintain some state in the read. */ -struct yytbl_reader { - FILE * fp; /**< input stream */ - flex_uint32_t bread; /**< bytes read since beginning of current tableset */ -}; - -%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 - - -m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]]) -m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]]) - -m4_ifdef( [[M4_YY_BISON_LVAL]], -[[ - m4_dnl The bison pure parser is used. Redefine yylex to - m4_dnl accept the lval parameter. - - m4_define( [[M4_YY_LEX_PROTO]], - [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]]) - m4_define( [[M4_YY_LEX_DECLARATION]], - [[YYFARGS1(YYSTYPE *,yylval_param)]]) -]]) - -m4_ifdef( [[]], -[[ - m4_dnl Locations are used. yylex should also accept the ylloc parameter. - - m4_define( [[M4_YY_LEX_PROTO]], - [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]]) - m4_define( [[M4_YY_LEX_DECLARATION]], - [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]]) -]]) - -extern int yylex M4_YY_LEX_PROTO; - -#define YY_DECL int yylex M4_YY_LEX_DECLARATION -%endif -%if-c++-only C++ definition -#define YY_DECL int yyFlexLexer::yylex() -%endif -#endif /* !YY_DECL */ - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* 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 -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -%% [6.0] YY_RULE_SETUP definition goes here -]]) - -%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; - M4_YY_DECL_GUTS_VAR(); - -m4_ifdef( [[M4_YY_NOT_REENTRANT]], -[[ - m4_ifdef( [[M4_YY_BISON_LVAL]], - [[ - YYSTYPE * yylval; - ]]) - m4_ifdef( [[]], - [[ - YYLTYPE * yylloc; - ]]) -]]) - -%% [7.0] user's declarations go here - -m4_ifdef( [[M4_YY_BISON_LVAL]], -[[ - yylval = yylval_param; -]]) - -m4_ifdef( [[]], -[[ - yylloc = yylloc_param; -]]) - - if ( !YY_G(yy_init) ) - { - YY_G(yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - -m4_ifdef( [[M4_YY_USES_REJECT]], -[[ - /* Create the reject buffer large enough to save one state per allowed character. */ - if ( ! YY_G(yy_state_buf) ) - YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG); -]]) - - if ( ! YY_G(yy_start) ) - YY_G(yy_start) = 1; /* first start state */ - - if ( ! yyin ) -%if-c-only - yyin = stdin; -%endif -%if-c++-only - yyin = & std::cin; -%endif - - if ( ! yyout ) -%if-c-only - yyout = stdout; -%endif -%if-c++-only - yyout = & std::cout; -%endif - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); - } - - yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { -%% [8.0] yymore()-related code goes here - yy_cp = YY_G(yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = YY_G(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_find_action: -%% [10.0] code to find the action number goes here - - 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 - - switch ( yy_act ) - { /* beginning of action switch */ -%% [13.0] actions go here - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = YY_G(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_G(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_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG ); - - /* 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 M4_YY_CALL_LAST_ARG); - - yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++YY_G(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 - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) ) - { - case EOB_ACT_END_OF_FILE: - { - YY_G(yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( M4_YY_CALL_ONLY_ARG ) ) - { - /* 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_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! YY_G(yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - YY_G(yy_c_buf_p) = - YY_G(yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG ); - - yy_cp = YY_G(yy_c_buf_p); - yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - YY_G(yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG ); - - yy_cp = YY_G(yy_c_buf_p); - yy_bp = YY_G(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 -yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout ) -{ - yyin = arg_yyin; - yyout = arg_yyout; - yy_c_buf_p = 0; - yy_init = 0; - yy_start = 0; - yy_flex_debug = 0; - yylineno = 1; // this will only get updated if %option yylineno - - yy_did_buffer_switch_on_eof = 0; - - yy_looking_for_trail_begin = 0; - yy_more_flag = 0; - yy_more_len = 0; - yy_more_offset = yy_prev_more_offset = 0; - - yy_start_stack_ptr = yy_start_stack_depth = 0; - yy_start_stack = NULL; - - YY_G(yy_buffer_stack) = 0; - YY_G(yy_buffer_stack_top) = 0; - YY_G(yy_buffer_stack_max) = 0; - - -m4_ifdef( [[M4_YY_USES_REJECT]], -[[ - yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE]; -]], -[[ - yy_state_buf = 0; -]]) -} - -yyFlexLexer::~yyFlexLexer() -{ - delete [] yy_state_buf; - yyfree( yy_start_stack M4_YY_CALL_LAST_ARG ); - yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG); -} - -void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out ) -{ - if ( new_in ) - { - yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG); - yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG); - } - - if ( new_out ) - yyout = new_out; -} - -#ifdef YY_INTERACTIVE -int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) -#else -int yyFlexLexer::LexerInput( char* buf, int max_size ) -#endif -{ - if ( yyin->eof() || yyin->fail() ) - return 0; - -#ifdef YY_INTERACTIVE - yyin->get( buf[0] ); - - if ( yyin->eof() ) - return 0; - - if ( yyin->bad() ) - return -1; - - return 1; - -#else - (void) yyin->read( buf, max_size ); - - if ( yyin->bad() ) - return -1; - else - return yyin->gcount(); -#endif -} - -void yyFlexLexer::LexerOutput( const char* buf, int size ) -{ - (void) yyout->write( buf, size ); -} -%ok-for-header -%endif - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* 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 YYFARGS0(void) -%endif -%if-c++-only -int yyFlexLexer::yy_get_next_buffer() -%endif -{ - M4_YY_DECL_GUTS_VAR(); - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = YY_G(yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(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_G(yy_c_buf_p) - YY_G(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_G(yy_c_buf_p) - YY_G(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_G(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. */ -m4_ifdef( [[M4_YY_USES_REJECT]], -[[ - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -]], -[[ - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) (YY_G(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 M4_YY_CALL_LAST_ARG ); - } - 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_G(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_G(yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars); - } - - if ( YY_G(yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin M4_YY_CALL_LAST_ARG); - } - - 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; - - YY_G(yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - YY_G(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 YYFARGS0(void) -%endif -%if-c++-only - yy_state_type yyFlexLexer::yy_get_previous_state() -%endif -{ - register yy_state_type yy_current_state; - register char *yy_cp; - M4_YY_DECL_GUTS_VAR(); - -%% [15.0] code to get the start state into yy_current_state goes here - - for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp ) - { -%% [16.0] code to find the next state goes here - } - - 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 YYFARGS1( yy_state_type, yy_current_state) -%endif -%if-c++-only - yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) -%endif -{ - register int yy_is_jam; - M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */ -%% [17.0] code to find the next state, and perhaps do backing up, goes here - - return yy_is_jam ? 0 : yy_current_state; -} - - -%if-c-only -m4_ifdef( [[M4_YY_NO_UNPUT]],, -[[ - static void yyunput YYFARGS2( int,c, register char *,yy_bp) -%endif -%if-c++-only - void yyFlexLexer::yyunput( int c, register char* yy_bp) -%endif -{ - register char *yy_cp; - M4_YY_DECL_GUTS_VAR(); - - yy_cp = YY_G(yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = YY_G(yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = YY_G(yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - -%% [18.0] update yylineno here -m4_ifdef( [[M4_YY_USE_LINENO]], -[[ - if ( c == '\n' ){ - --yylineno; - } -]]) - - YY_G(yytext_ptr) = yy_bp; - YY_G(yy_hold_char) = *yy_cp; - YY_G(yy_c_buf_p) = yy_cp; -} -%if-c-only -]]) -%endif - -%if-c-only -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput YYFARGS0(void) -#else - static int input YYFARGS0(void) -#endif - -%endif -%if-c++-only - int yyFlexLexer::yyinput() -%endif -{ - int c; - M4_YY_DECL_GUTS_VAR(); - - *YY_G(yy_c_buf_p) = YY_G(yy_hold_char); - - if ( *YY_G(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_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] ) - /* This was really a NUL. */ - *YY_G(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr); - ++YY_G(yy_c_buf_p); - - switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) ) - { - 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 M4_YY_CALL_LAST_ARG); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( M4_YY_CALL_ONLY_ARG ) ) - return EOF; - - if ( ! YY_G(yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(M4_YY_CALL_ONLY_ARG); -#else - return input(M4_YY_CALL_ONLY_ARG); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */ - *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */ - YY_G(yy_hold_char) = *++YY_G(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. - * M4_YY_DOC_PARAM - * @note This function does not reset the start condition to @c INITIAL . - */ -%if-c-only - void yyrestart YYFARGS1( FILE *,input_file) -%endif -%if-c++-only - void yyFlexLexer::yyrestart( std::istream* input_file ) -%endif -{ - M4_YY_DECL_GUTS_VAR(); - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); - } - - yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG); - yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * M4_YY_DOC_PARAM - */ -%if-c-only - void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer) -%endif -%if-c++-only - void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -%endif -{ - M4_YY_DECL_GUTS_VAR(); - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *YY_G(yy_c_buf_p) = YY_G(yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); - - /* 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_G(yy_did_buffer_switch_on_eof) = 1; -} - - -%if-c-only -static void yy_load_buffer_state YYFARGS0(void) -%endif -%if-c++-only - void yyFlexLexer::yy_load_buffer_state() -%endif -{ - M4_YY_DECL_GUTS_VAR(); - YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - YY_G(yy_hold_char) = *YY_G(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. - * M4_YY_DOC_PARAM - * @return the allocated buffer state. - */ -%if-c-only - YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size) -%endif -%if-c++-only - YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size ) -%endif -{ - YY_BUFFER_STATE b; - m4_dnl M4_YY_DECL_GUTS_VAR(); - - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG ); - 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 M4_YY_CALL_LAST_ARG ); - 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 M4_YY_CALL_LAST_ARG); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * M4_YY_DOC_PARAM - */ -%if-c-only - void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b) -%endif -%if-c++-only - void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) -%endif -{ - M4_YY_DECL_GUTS_VAR(); - - 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 M4_YY_CALL_LAST_ARG ); - - yyfree( (void *) b M4_YY_CALL_LAST_ARG ); -} - - -%if-c-only -m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],, -[[ - m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],, - [[ -#ifndef __cplusplus -extern int isatty M4_YY_PARAMS( int ); -#endif /* __cplusplus */ - ]]) -]]) -%endif - -%if-c++-only -m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],, -[[ -extern "C" int isatty M4_YY_PARAMS( int ); -]]) -%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 YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file) -%endif -%if-c++-only - void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file ) -%endif - -{ - int oerrno = errno; - M4_YY_DECL_GUTS_VAR(); - - yy_flush_buffer( b M4_YY_CALL_LAST_ARG); - - 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 -m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]], -[[ - b->yy_is_interactive = 1; -]], -[[ - m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]], - [[ - b->yy_is_interactive = 0; - ]], - [[ - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - ]]) -]]) -%endif -%if-c++-only - b->yy_is_interactive = 0; -%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. - * M4_YY_DOC_PARAM - */ -%if-c-only - void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b) -%endif -%if-c++-only - void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) -%endif -{ - M4_YY_DECL_GUTS_VAR(); - 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( M4_YY_CALL_ONLY_ARG ); -} - -%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. - * M4_YY_DOC_PARAM - */ -%if-c-only -void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer) -%endif -%if-c++-only -void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer) -%endif -{ - M4_YY_DECL_GUTS_VAR(); - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *YY_G(yy_c_buf_p) = YY_G(yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - YY_G(yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); - YY_G(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. - * M4_YY_DOC_PARAM - */ -%if-c-only -void yypop_buffer_state YYFARGS0(void) -%endif -%if-c++-only -void yyFlexLexer::yypop_buffer_state (void) -%endif -{ - M4_YY_DECL_GUTS_VAR(); - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG); - YY_CURRENT_BUFFER_LVALUE = NULL; - if (YY_G(yy_buffer_stack_top) > 0) - --YY_G(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); - YY_G(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 YYFARGS0(void) -%endif -%if-c++-only -void yyFlexLexer::yyensure_buffer_stack(void) -%endif -{ - int num_to_alloc; - M4_YY_DECL_GUTS_VAR(); - - if (!YY_G(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_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - M4_YY_CALL_LAST_ARG); - - memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - YY_G(yy_buffer_stack_max) = num_to_alloc; - YY_G(yy_buffer_stack_top) = 0; - return; - } - - if (YY_G(yy_buffer_stack_top) >= (YY_G(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_G(yy_buffer_stack_max) + grow_size; - YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - (YY_G(yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - M4_YY_CALL_LAST_ARG); - - /* zero only the new slots.*/ - memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - YY_G(yy_buffer_stack_max) = num_to_alloc; - } -} -%endif - - - - -m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],, -[[ -%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 - * M4_YY_DOC_PARAM - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size) -{ - YY_BUFFER_STATE b; - m4_dnl M4_YY_DECL_GUTS_VAR(); - - 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 ) M4_YY_CALL_LAST_ARG ); - 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 M4_YY_CALL_LAST_ARG ); - - return b; -} -%endif -]]) - - -m4_ifdef( [[M4_YY_NO_SCAN_STRING]],, -[[ -%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 str a NUL-terminated string to scan - * M4_YY_DOC_PARAM - * @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 YYFARGS1( yyconst char *, yystr) -{ - m4_dnl M4_YY_DECL_GUTS_VAR(); - - return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG); -} -%endif -]]) - - -m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],, -[[ -%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. - * M4_YY_DOC_PARAM - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, int ,_yybytes_len) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - m4_dnl M4_YY_DECL_GUTS_VAR(); - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG ); - 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 M4_YY_CALL_LAST_ARG); - 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 -]]) - - -m4_ifdef( [[M4_YY_NO_PUSH_STATE]],, -[[ -%if-c-only - static void yy_push_state YYFARGS1( int ,new_state) -%endif -%if-c++-only - void yyFlexLexer::yy_push_state( int new_state ) -%endif -{ - M4_YY_DECL_GUTS_VAR(); - if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) ) - { - yy_size_t new_size; - - YY_G(yy_start_stack_depth) += YY_START_STACK_INCR; - new_size = YY_G(yy_start_stack_depth) * sizeof( int ); - - if ( ! YY_G(yy_start_stack) ) - YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG ); - - else - YY_G(yy_start_stack) = (int *) yyrealloc( - (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG ); - - if ( ! YY_G(yy_start_stack) ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START; - - BEGIN(new_state); -} -]]) - - -m4_ifdef( [[M4_YY_NO_POP_STATE]],, -[[ -%if-c-only - static void yy_pop_state YYFARGS0(void) -%endif -%if-c++-only - void yyFlexLexer::yy_pop_state() -%endif -{ - M4_YY_DECL_GUTS_VAR(); - if ( --YY_G(yy_start_stack_ptr) < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]); -} -]]) - - -m4_ifdef( [[M4_YY_NO_TOP_STATE]],, -[[ -%if-c-only - static int yy_top_state YYFARGS0(void) -%endif -%if-c++-only - int yyFlexLexer::yy_top_state() -%endif -{ - M4_YY_DECL_GUTS_VAR(); - return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1]; -} -]]) - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -%if-c-only -static void yy_fatal_error YYFARGS1(yyconst char*, msg) -{ - m4_dnl M4_YY_DECL_GUTS_VAR(); - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} -%endif -%if-c++-only -void yyFlexLexer::LexerError( yyconst char msg[] ) -{ - M4_YY_DECL_GUTS_VAR(); - std::cerr << msg << std::endl; - exit( YY_EXIT_FAILURE ); -} -%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_G(yy_hold_char); \ - YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \ - YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \ - *YY_G(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - - - -/* Accessor methods (get/set functions) to struct members. */ - -%if-c-only -%if-reentrant -m4_ifdef( [[M4_YY_NO_GET_EXTRA]],, -[[ -/** Get the user-defined data for this scanner. - * M4_YY_DOC_PARAM - */ -YY_EXTRA_TYPE yyget_extra YYFARGS0(void) -{ - M4_YY_DECL_GUTS_VAR(); - return yyextra; -} -]]) -%endif - -m4_ifdef( [[M4_YY_NO_GET_LINENO]],, -[[ -/** Get the current line number. - * M4_YY_DOC_PARAM - */ -int yyget_lineno YYFARGS0(void) -{ - M4_YY_DECL_GUTS_VAR(); - - m4_ifdef( [[M4_YY_REENTRANT]], - [[ - if (! YY_CURRENT_BUFFER) - return 0; - ]]) - return yylineno; -} -]]) - -m4_ifdef( [[M4_YY_REENTRANT]], -[[ -m4_ifdef( [[M4_YY_NO_GET_COLUMN]],, -[[ -/** Get the current column number. - * M4_YY_DOC_PARAM - */ -int yyget_column YYFARGS0(void) -{ - M4_YY_DECL_GUTS_VAR(); - - m4_ifdef( [[M4_YY_REENTRANT]], - [[ - if (! YY_CURRENT_BUFFER) - return 0; - ]]) - return yycolumn; -} -]]) -]]) - -m4_ifdef( [[M4_YY_NO_GET_IN]],, -[[ -/** Get the input stream. - * M4_YY_DOC_PARAM - */ -FILE *yyget_in YYFARGS0(void) -{ - M4_YY_DECL_GUTS_VAR(); - return yyin; -} -]]) - -m4_ifdef( [[M4_YY_NO_GET_OUT]],, -[[ -/** Get the output stream. - * M4_YY_DOC_PARAM - */ -FILE *yyget_out YYFARGS0(void) -{ - M4_YY_DECL_GUTS_VAR(); - return yyout; -} -]]) - -m4_ifdef( [[M4_YY_NO_GET_LENG]],, -[[ -/** Get the length of the current token. - * M4_YY_DOC_PARAM - */ -int yyget_leng YYFARGS0(void) -{ - M4_YY_DECL_GUTS_VAR(); - return yyleng; -} -]]) - -/** Get the current token. - * M4_YY_DOC_PARAM - */ -m4_ifdef( [[M4_YY_NO_GET_TEXT]],, -[[ -char *yyget_text YYFARGS0(void) -{ - M4_YY_DECL_GUTS_VAR(); - return yytext; -} -]]) - -%if-reentrant -m4_ifdef( [[M4_YY_NO_SET_EXTRA]],, -[[ -/** Set the user-defined data. This data is never touched by the scanner. - * @param user_defined The data to be associated with this scanner. - * M4_YY_DOC_PARAM - */ -void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined) -{ - M4_YY_DECL_GUTS_VAR(); - yyextra = user_defined ; -} -]]) -%endif - -m4_ifdef( [[M4_YY_NO_SET_LINENO]],, -[[ -/** Set the current line number. - * @param line_number - * M4_YY_DOC_PARAM - */ -void yyset_lineno YYFARGS1( int ,line_number) -{ - M4_YY_DECL_GUTS_VAR(); - - m4_ifdef( [[M4_YY_REENTRANT]], - [[ - /* lineno is only valid if an input buffer exists. */ - if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "yyset_lineno called with no buffer" M4_YY_CALL_LAST_ARG); - ]]) - yylineno = line_number; -} -]]) - -m4_ifdef( [[M4_YY_REENTRANT]], -[[ -m4_ifdef( [[M4_YY_NO_SET_COLUMN]],, -[[ -/** Set the current column. - * @param line_number - * M4_YY_DOC_PARAM - */ -void yyset_column YYFARGS1( int , column_no) -{ - M4_YY_DECL_GUTS_VAR(); - - m4_ifdef( [[M4_YY_REENTRANT]], - [[ - /* column is only valid if an input buffer exists. */ - if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "yyset_column called with no buffer" M4_YY_CALL_LAST_ARG); - ]]) - yycolumn = column_no; -} -]]) -]]) - - -m4_ifdef( [[M4_YY_NO_SET_IN]],, -[[ -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * M4_YY_DOC_PARAM - * @see yy_switch_to_buffer - */ -void yyset_in YYFARGS1( FILE * ,in_str) -{ - M4_YY_DECL_GUTS_VAR(); - yyin = in_str ; -} -]]) - -m4_ifdef( [[M4_YY_NO_SET_OUT]],, -[[ -void yyset_out YYFARGS1( FILE * ,out_str) -{ - M4_YY_DECL_GUTS_VAR(); - yyout = out_str ; -} -]]) - - -m4_ifdef( [[M4_YY_NO_GET_DEBUG]],, -[[ -int yyget_debug YYFARGS0(void) -{ - M4_YY_DECL_GUTS_VAR(); - return yy_flex_debug; -} -]]) - -m4_ifdef( [[M4_YY_NO_SET_DEBUG]],, -[[ -void yyset_debug YYFARGS1( int ,bdebug) -{ - M4_YY_DECL_GUTS_VAR(); - yy_flex_debug = bdebug ; -} -]]) -%endif - -%if-reentrant -/* Accessor methods for yylval and yylloc */ - -%if-bison-bridge -m4_ifdef( [[M4_YY_NO_GET_LVAL]],, -[[ -YYSTYPE * yyget_lval YYFARGS0(void) -{ - M4_YY_DECL_GUTS_VAR(); - return yylval; -} -]]) - -m4_ifdef( [[M4_YY_NO_SET_LVAL]],, -[[ -void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param) -{ - M4_YY_DECL_GUTS_VAR(); - yylval = yylval_param; -} -]]) - -m4_ifdef( [[]], -[[ - m4_ifdef( [[M4_YY_NO_GET_LLOC]],, - [[ -YYLTYPE *yyget_lloc YYFARGS0(void) -{ - M4_YY_DECL_GUTS_VAR(); - return yylloc; -} - ]]) - - m4_ifdef( [[M4_YY_NO_SET_LLOC]],, - [[ -void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param) -{ - M4_YY_DECL_GUTS_VAR(); - yylloc = yylloc_param; -} - ]]) -]]) - -%endif - - -/* User-visible API */ - -/* yylex_init is special because it creates the scanner itself, so it is - * the ONLY reentrant function that doesn't take the scanner as the last argument. - * That's why we explicitly handle the declaration, instead of using our macros. - */ -m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]], -[[ -int yylex_init( ptr_yy_globals ) - yyscan_t* ptr_yy_globals; -]], -[[ -int yylex_init(yyscan_t* ptr_yy_globals) -]]) -{ - if (ptr_yy_globals == NULL){ - errno = EINVAL; - return 1; - } - - *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); - - if (*ptr_yy_globals == NULL){ - errno = ENOMEM; - return 1; - } - - /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ - memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); - - return yy_init_globals ( *ptr_yy_globals ); -} - -%endif - -%if-c-only -static int yy_init_globals YYFARGS0(void) -{ - M4_YY_DECL_GUTS_VAR(); - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - -m4_ifdef( [[M4_YY_USE_LINENO]], -[[ - m4_ifdef( [[M4_YY_NOT_REENTRANT]], - [[ - /* We do not touch yylineno unless the option is enabled. */ - yylineno = 1; - ]]) -]]) - YY_G(yy_buffer_stack) = 0; - YY_G(yy_buffer_stack_top) = 0; - YY_G(yy_buffer_stack_max) = 0; - YY_G(yy_c_buf_p) = (char *) 0; - YY_G(yy_init) = 0; - YY_G(yy_start) = 0; - -m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]], -[[ - YY_G(yy_start_stack_ptr) = 0; - YY_G(yy_start_stack_depth) = 0; - YY_G(yy_start_stack) = NULL; -]]) - -m4_ifdef( [[M4_YY_USES_REJECT]], -[[ - YY_G(yy_state_buf) = 0; - YY_G(yy_state_ptr) = 0; - YY_G(yy_full_match) = 0; - YY_G(yy_lp) = 0; -]]) - -m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]], -[[ - YY_G(yytext_ptr) = 0; - YY_G(yy_more_offset) = 0; - YY_G(yy_prev_more_offset) = 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 YYFARGS0(void) -{ - M4_YY_DECL_GUTS_VAR(); - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(M4_YY_CALL_ONLY_ARG); - } - - /* Destroy the stack itself. */ - yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG); - YY_G(yy_buffer_stack) = NULL; - -m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]], -[[ - /* Destroy the start condition stack. */ - yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG ); - YY_G(yy_start_stack) = NULL; -]]) - -m4_ifdef( [[M4_YY_USES_REJECT]], -[[ - yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG); - YY_G(yy_state_buf) = 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( M4_YY_CALL_ONLY_ARG); - -%if-reentrant - /* Destroy the main struct (reentrant only). */ - yyfree ( yyscanner M4_YY_CALL_LAST_ARG ); - yyscanner = NULL; -%endif - return 0; -} -%endif - - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -/* - * Internal utility routines. - */ -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -#ifndef yytext_ptr -static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YYFARGS1( yyconst char *,s) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif -]]) - -m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],, -[[ -void *yyalloc YYFARGS1( yy_size_t ,size) -{ - return (void *) malloc( size ); -} -]]) - -m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],, -[[ -void *yyrealloc YYFARGS2( 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 ); -} -]]) - -m4_ifdef( [[M4_YY_NO_FLEX_FREE]],, -[[ -void yyfree YYFARGS1( void *,ptr) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} -]]) - -%if-tables-serialization definitions -m4preproc_include(`tables_shared.c') - -static int yytbl_read8 (void *v, struct yytbl_reader * rd) -{ - errno = 0; - if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){ - errno = EIO; - return -1; - } - rd->bread += sizeof(flex_uint8_t); - return 0; -} - -static int yytbl_read16 (void *v, struct yytbl_reader * rd) -{ - errno = 0; - if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){ - errno = EIO; - return -1; - } - *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v)); - rd->bread += sizeof(flex_uint16_t); - return 0; -} - -static int yytbl_read32 (void *v, struct yytbl_reader * rd) -{ - errno = 0; - if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){ - errno = EIO; - return -1; - } - *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v)); - rd->bread += sizeof(flex_uint32_t); - return 0; -} - -/** Read the header */ -static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd) -{ - int bytes; - memset (th, 0, sizeof (struct yytbl_hdr)); - - if (yytbl_read32 (&(th->th_magic), rd) != 0) - return -1; - - if (th->th_magic != YYTBL_MAGIC){ - yy_fatal_error("bad magic number" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG); - return -1; - } - - if (yytbl_read32 (&(th->th_hsize), rd) != 0 - || yytbl_read32 (&(th->th_ssize), rd) != 0 - || yytbl_read16 (&(th->th_flags), rd) != 0) - return -1; - - /* Sanity check on header size. Greater than 1k suggests some funny business. */ - if (th->th_hsize < 16 || th->th_hsize > 1024){ - yy_fatal_error("insane header size detected" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG); - return -1; - } - - /* Allocate enough space for the version and name fields */ - bytes = th->th_hsize - 14; - th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG); - - /* we read it all into th_version, and point th_name into that data */ - if (fread (th->th_version, 1, bytes, rd->fp) != bytes){ - errno = EIO; - yyfree(th->th_version M4_YY_CALL_LAST_ARG); - th->th_version = NULL; - return -1; - } - else - rd->bread += bytes; - - th->th_name = th->th_version + strlen (th->th_version) + 1; - return 0; -} - -/** lookup id in the dmap list. - * @param dmap pointer to first element in list - * @return NULL if not found. - */ -static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap, - int, id) -{ - while (dmap->dm_id) - if (dmap->dm_id == id) - return dmap; - else - dmap++; - return NULL; -} - -/** Read a table while mapping its contents to the local array. - * @param dmap used to performing mapping - * @return 0 on success - */ -static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd) -{ - struct yytbl_data td; - struct yytbl_dmap *transdmap=0; - int len, i, rv, inner_loop_count; - void *p=0; - - memset (&td, 0, sizeof (struct yytbl_data)); - - if (yytbl_read16 (&td.td_id, rd) != 0 - || yytbl_read16 (&td.td_flags, rd) != 0 - || yytbl_read32 (&td.td_hilen, rd) != 0 - || yytbl_read32 (&td.td_lolen, rd) != 0) - return -1; - - /* Lookup the map for the transition table so we have it in case we need it - * inside the loop below. This scanner might not even have a transition - * table, which is ok. - */ - transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG); - - if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){ - yy_fatal_error("table id not found in map." /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG); - return -1; - } - - /* Allocate space for table. - * The --full yy_transition table is a special case, since we - * need the dmap.dm_sz entry to tell us the sizeof the individual - * struct members. - */ - { - size_t bytes; - - if ((td.td_flags & YYTD_STRUCT)) - bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1); - else - bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz; - - if(M4_YY_TABLES_VERIFY) - /* We point to the array itself */ - p = dmap->dm_arr; - else - /* We point to the address of a pointer. */ - *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG); - } - - /* If it's a struct, we read 2 integers to get one element */ - if ((td.td_flags & YYTD_STRUCT) != 0) - inner_loop_count = 2; - else - inner_loop_count = 1; - - /* read and map each element. - * This loop iterates once for each element of the td_data array. - * Notice that we increment 'i' in the inner loop. - */ - len = yytbl_calc_total_len (&td); - for (i = 0; i < len; ){ - int j; - - - /* This loop really executes exactly 1 or 2 times. - * The second time is to handle the second member of the - * YYTD_STRUCT for the yy_transition array. - */ - for (j = 0; j < inner_loop_count; j++, i++) { - flex_int32_t t32; - - /* read into t32 no matter what the real size is. */ - { - flex_int16_t t16; - flex_int8_t t8; - - switch (YYTDFLAGS2BYTES (td.td_flags)) { - case sizeof (flex_int32_t): - rv = yytbl_read32 (&t32, rd); - break; - case sizeof (flex_int16_t): - rv = yytbl_read16 (&t16, rd); - t32 = t16; - break; - case sizeof (flex_int8_t): - rv = yytbl_read8 (&t8, rd); - t32 = t8; - break; - default: - yy_fatal_error("invalid td_flags" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG); - return -1; - } - } - if (rv != 0) - return -1; - - /* copy into the deserialized array... */ - - if ((td.td_flags & YYTD_STRUCT)) { - /* t32 is the j'th member of a two-element struct. */ - void *v; - - v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify) - : &(((struct yy_trans_info *) p)->yy_nxt); - - switch (dmap->dm_sz) { - case sizeof (flex_int32_t): - if (M4_YY_TABLES_VERIFY){ - if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32) - yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int32_t" M4_YY_CALL_LAST_ARG); - }else - ((flex_int32_t *) v)[0] = (flex_int32_t) t32; - break; - case sizeof (flex_int16_t): - if (M4_YY_TABLES_VERIFY ){ - if(((flex_int16_t *) v)[0] != (flex_int16_t) t32) - yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int16_t" M4_YY_CALL_LAST_ARG); - }else - ((flex_int16_t *) v)[0] = (flex_int16_t) t32; - break; - case sizeof(flex_int8_t): - if (M4_YY_TABLES_VERIFY ){ - if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32) - yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int8_t" M4_YY_CALL_LAST_ARG); - }else - ((flex_int8_t *) v)[0] = (flex_int8_t) t32; - break; - default: - yy_fatal_error("invalid dmap->dm_sz for struct" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG); - return -1; - } - - /* if we're done with j, increment p */ - if (j == 1) - p = (struct yy_trans_info *) p + 1; - } - else if ((td.td_flags & YYTD_PTRANS)) { - /* t32 is an index into the transition array. */ - struct yy_trans_info *v; - - - if (!transdmap){ - yy_fatal_error("transition table not found" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG); - return -1; - } - - if( M4_YY_TABLES_VERIFY) - v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]); - else - v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]); - - if(M4_YY_TABLES_VERIFY ){ - if( ((struct yy_trans_info **) p)[0] != v) - yy_fatal_error("tables verification failed at YYTD_PTRANS" M4_YY_CALL_LAST_ARG); - }else - ((struct yy_trans_info **) p)[0] = v; - - /* increment p */ - p = (struct yy_trans_info **) p + 1; - } - else { - /* t32 is a plain int. copy data, then incrememnt p. */ - switch (dmap->dm_sz) { - case sizeof (flex_int32_t): - if(M4_YY_TABLES_VERIFY ){ - if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32) - yy_fatal_error("tables verification failed at flex_int32_t" M4_YY_CALL_LAST_ARG); - }else - ((flex_int32_t *) p)[0] = (flex_int32_t) t32; - p = ((flex_int32_t *) p) + 1; - break; - case sizeof (flex_int16_t): - if(M4_YY_TABLES_VERIFY ){ - if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32) - yy_fatal_error("tables verification failed at flex_int16_t" M4_YY_CALL_LAST_ARG); - }else - ((flex_int16_t *) p)[0] = (flex_int16_t) t32; - p = ((flex_int16_t *) p) + 1; - break; - case sizeof (flex_int8_t): - if(M4_YY_TABLES_VERIFY ){ - if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32) - yy_fatal_error("tables verification failed at flex_int8_t" M4_YY_CALL_LAST_ARG); - }else - ((flex_int8_t *) p)[0] = (flex_int8_t) t32; - p = ((flex_int8_t *) p) + 1; - break; - default: - yy_fatal_error("invalid dmap->dm_sz for plain int" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG); - return -1; - } - } - } - - } - - /* Now eat padding. */ - { - int pad; - pad = yypad64(rd->bread); - while(--pad >= 0){ - flex_int8_t t8; - if(yytbl_read8(&t8,rd) != 0) - return -1; - } - } - - return 0; -} - -%define-yytables The name for this specific scanner's tables. - -/* Find the key and load the DFA tables from the given stream. */ -static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key) -{ - int rv=0; - struct yytbl_hdr th; - struct yytbl_reader rd; - - rd.fp = fp; - th.th_version = NULL; - - /* Keep trying until we find the right set of tables or end of file. */ - while (!feof(rd.fp)) { - rd.bread = 0; - if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){ - rv = -1; - goto return_rv; - } - - /* A NULL key means choose the first set of tables. */ - if (key == NULL) - break; - - if (strcmp(th.th_name,key) != 0){ - /* Skip ahead to next set */ - fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR); - yyfree(th.th_version M4_YY_CALL_LAST_ARG); - th.th_version = NULL; - } - else - break; - } - - while (rd.bread < th.th_ssize){ - /* Load the data tables */ - if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){ - rv = -1; - goto return_rv; - } - } - -return_rv: - if(th.th_version){ - yyfree(th.th_version M4_YY_CALL_LAST_ARG); - th.th_version = NULL; - } - - return rv; -} - -/** Load the DFA tables for this scanner from the given stream. */ -int yytables_fload YYFARGS1(FILE *, fp) -{ - - if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0) - return -1; - return 0; -} - -/** Destroy the loaded tables, freeing memory, etc.. */ -int yytables_destroy YYFARGS0(void) -{ - struct yytbl_dmap *dmap=0; - - if(!M4_YY_TABLES_VERIFY){ - /* Walk the dmap, freeing the pointers */ - for(dmap=yydmap; dmap->dm_id; dmap++) { - void * v; - v = dmap->dm_arr; - if(v && *(char**)v){ - yyfree(*(char**)v M4_YY_CALL_LAST_ARG); - *(char**)v = NULL; - } - } - } - - return 0; -} - -/* end table serialization code definitions */ -%endif - - -m4_ifdef([[M4_YY_MAIN]], [[ -int main M4_YY_PARAMS(void); - -int main () -{ - -%if-reentrant - yyscan_t lexer; - yylex_init(&lexer); - yylex( lexer ); - yylex_destroy( lexer); - -%endif -%if-not-reentrant - yylex(); -%endif - - return 0; -} -]]) - -%ok-for-header -m4_ifdef( [[M4_YY_IN_HEADER]], -[[ -#undef YY_NEW_FILE -#undef YY_FLUSH_BUFFER -#undef yy_set_bol -#undef yy_new_buffer -#undef yy_set_interactive -#undef YY_DO_BEFORE_ACTION - -#ifdef YY_DECL_IS_OURS -#undef YY_DECL_IS_OURS -#undef YY_DECL -#endif -]]) diff --git a/src/bin/flex/flex.spec b/src/bin/flex/flex.spec deleted file mode 100644 index 51171c3b86..0000000000 --- a/src/bin/flex/flex.spec +++ /dev/null @@ -1,54 +0,0 @@ -Summary: fast lexical analyzer generator -Name: flex -Version: 2.5.33 -Release: 0 -License: BSD style -Group: Development/Tools -Source: ftp://ftp.ee.lbl.gov/%{name}-%{version}.tar.gz -Prefix: %{_prefix} -BuildRoot: %{_tmppath}/%{name}-%{version} -Prereq: /sbin/install-info - -%description -The flex program generates scanners. Scanners are programs which can -recognize lexical patterns in text. Flex takes pairs of regular -expressions and C code as input and generates a C source file as -output. The output file is compiled and linked with a library to -produce an executable. The executable searches through its input for -occurrences of the regular expressions. When a match is found, it -executes the corresponding C code. Flex was designed to work with -both Yacc and Bison, and is used by many programs as part of their -build process. - -%prep -%setup -q -n %{name}-%{version} - -%build -%configure -make - -%install -rm -rf $RPM_BUILD_ROOT -%makeinstall -rm -f ${RPM_BUILD_ROOT}/%{_infodir}/dir - -%clean -rm -rf ${RPM_BUILD_ROOT} - -%post -/sbin/install-info %{_infodir}/flex.info.gz %{_infodir}/dir - -%postun -if [ "$1" = 0 ]; then - /sbin/install-info --del %{_infodir}/flex.info.gz %{_infodir}/dir -fi - -%files -%defattr(-,root,root) -%doc COPYING NEWS README -%{_bindir}/* -%{_mandir}/man1/* -%{_libdir}/* -%{_includedir}/FlexLexer.h -%{_infodir}/flex.info* -%{_datadir}/locale/* diff --git a/src/bin/flex/flex.spec.in b/src/bin/flex/flex.spec.in deleted file mode 100644 index 026f0211e0..0000000000 --- a/src/bin/flex/flex.spec.in +++ /dev/null @@ -1,54 +0,0 @@ -Summary: fast lexical analyzer generator -Name: flex -Version: @VERSION@ -Release: 0 -License: BSD style -Group: Development/Tools -Source: ftp://ftp.ee.lbl.gov/%{name}-%{version}.tar.gz -Prefix: %{_prefix} -BuildRoot: %{_tmppath}/%{name}-%{version} -Prereq: /sbin/install-info - -%description -The flex program generates scanners. Scanners are programs which can -recognize lexical patterns in text. Flex takes pairs of regular -expressions and C code as input and generates a C source file as -output. The output file is compiled and linked with a library to -produce an executable. The executable searches through its input for -occurrences of the regular expressions. When a match is found, it -executes the corresponding C code. Flex was designed to work with -both Yacc and Bison, and is used by many programs as part of their -build process. - -%prep -%setup -q -n %{name}-%{version} - -%build -%configure -make - -%install -rm -rf $RPM_BUILD_ROOT -%makeinstall -rm -f ${RPM_BUILD_ROOT}/%{_infodir}/dir - -%clean -rm -rf ${RPM_BUILD_ROOT} - -%post -/sbin/install-info %{_infodir}/flex.info.gz %{_infodir}/dir - -%postun -if [ "$1" = 0 ]; then - /sbin/install-info --del %{_infodir}/flex.info.gz %{_infodir}/dir -fi - -%files -%defattr(-,root,root) -%doc COPYING NEWS README -%{_bindir}/* -%{_mandir}/man1/* -%{_libdir}/* -%{_includedir}/FlexLexer.h -%{_infodir}/flex.info* -%{_datadir}/locale/* diff --git a/src/bin/flex/flexdef.h b/src/bin/flex/flexdef.h deleted file mode 100644 index 2f887f4d31..0000000000 --- a/src/bin/flex/flexdef.h +++ /dev/null @@ -1,1182 +0,0 @@ - -/* flexdef - definitions file for flex */ - -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -#ifndef FLEXDEF_H -#define FLEXDEF_H 1 - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifdef STDC_HEADERS -#include -#include -#include -#include -#include -#include -#include -#endif -#ifdef HAVE_LIMITS_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_PARAMS_H -#include -#endif -#ifdef HAVE_SYS_WAIT_H -#include -#endif -#ifdef HAVE_STDBOOL_H -#include -#else -#define bool int -#define true 1 -#define false 0 -#endif -#include -#include "flexint.h" - -/* We use gettext. So, when we write strings which should be translated, we mark them with _() */ -#ifdef ENABLE_NLS -#ifdef HAVE_LOCALE_H -#include -#endif /* HAVE_LOCALE_H */ -#include "gettext.h" -#define _(String) gettext (String) -#else -#define _(STRING) STRING -#endif /* ENABLE_NLS */ - -/* Always be prepared to generate an 8-bit scanner. */ -#define CSIZE 256 -#define Char unsigned char - -/* Size of input alphabet - should be size of ASCII set. */ -#ifndef DEFAULT_CSIZE -#define DEFAULT_CSIZE 128 -#endif - -#ifndef PROTO -#if __STDC__ -#define PROTO(proto) proto -#else -#define PROTO(proto) () -#endif -#endif - -#ifdef VMS -#ifndef __VMS_POSIX -#define unlink remove -#define SHORT_FILE_NAMES -#endif -#endif - -#ifdef MS_DOS -#define SHORT_FILE_NAMES -#endif - - -/* Maximum line length we'll have to deal with. */ -#define MAXLINE 2048 - -#ifndef MIN -#define MIN(x,y) ((x) < (y) ? (x) : (y)) -#endif -#ifndef MAX -#define MAX(x,y) ((x) > (y) ? (x) : (y)) -#endif -#ifndef ABS -#define ABS(x) ((x) < 0 ? -(x) : (x)) -#endif - - -/* ANSI C does not guarantee that isascii() is defined */ -#ifndef isascii -#define isascii(c) ((c) <= 0177) -#endif - -#define unspecified -1 - -/* Special chk[] values marking the slots taking by end-of-buffer and action - * numbers. - */ -#define EOB_POSITION -1 -#define ACTION_POSITION -2 - -/* Number of data items per line for -f output. */ -#define NUMDATAITEMS 10 - -/* Number of lines of data in -f output before inserting a blank line for - * readability. - */ -#define NUMDATALINES 10 - -/* transition_struct_out() definitions. */ -#define TRANS_STRUCT_PRINT_LENGTH 14 - -/* Returns true if an nfa state has an epsilon out-transition slot - * that can be used. This definition is currently not used. - */ -#define FREE_EPSILON(state) \ - (transchar[state] == SYM_EPSILON && \ - trans2[state] == NO_TRANSITION && \ - finalst[state] != state) - -/* Returns true if an nfa state has an epsilon out-transition character - * and both slots are free - */ -#define SUPER_FREE_EPSILON(state) \ - (transchar[state] == SYM_EPSILON && \ - trans1[state] == NO_TRANSITION) \ - -/* Maximum number of NFA states that can comprise a DFA state. It's real - * big because if there's a lot of rules, the initial state will have a - * huge epsilon closure. - */ -#define INITIAL_MAX_DFA_SIZE 750 -#define MAX_DFA_SIZE_INCREMENT 750 - - -/* A note on the following masks. They are used to mark accepting numbers - * as being special. As such, they implicitly limit the number of accepting - * numbers (i.e., rules) because if there are too many rules the rule numbers - * will overload the mask bits. Fortunately, this limit is \large/ (0x2000 == - * 8192) so unlikely to actually cause any problems. A check is made in - * new_rule() to ensure that this limit is not reached. - */ - -/* Mask to mark a trailing context accepting number. */ -#define YY_TRAILING_MASK 0x2000 - -/* Mask to mark the accepting number of the "head" of a trailing context - * rule. - */ -#define YY_TRAILING_HEAD_MASK 0x4000 - -/* Maximum number of rules, as outlined in the above note. */ -#define MAX_RULE (YY_TRAILING_MASK - 1) - - -/* NIL must be 0. If not, its special meaning when making equivalence classes - * (it marks the representative of a given e.c.) will be unidentifiable. - */ -#define NIL 0 - -#define JAM -1 /* to mark a missing DFA transition */ -#define NO_TRANSITION NIL -#define UNIQUE -1 /* marks a symbol as an e.c. representative */ -#define INFINITE_REPEAT -1 /* for x{5,} constructions */ - -#define INITIAL_MAX_CCLS 100 /* max number of unique character classes */ -#define MAX_CCLS_INCREMENT 100 - -/* Size of table holding members of character classes. */ -#define INITIAL_MAX_CCL_TBL_SIZE 500 -#define MAX_CCL_TBL_SIZE_INCREMENT 250 - -#define INITIAL_MAX_RULES 100 /* default maximum number of rules */ -#define MAX_RULES_INCREMENT 100 - -#define INITIAL_MNS 2000 /* default maximum number of nfa states */ -#define MNS_INCREMENT 1000 /* amount to bump above by if it's not enough */ - -#define INITIAL_MAX_DFAS 1000 /* default maximum number of dfa states */ -#define MAX_DFAS_INCREMENT 1000 - -#define JAMSTATE -32766 /* marks a reference to the state that always jams */ - -/* Maximum number of NFA states. */ -#define MAXIMUM_MNS 31999 -#define MAXIMUM_MNS_LONG 1999999999 - -/* Enough so that if it's subtracted from an NFA state number, the result - * is guaranteed to be negative. - */ -#define MARKER_DIFFERENCE (maximum_mns+2) - -/* Maximum number of nxt/chk pairs for non-templates. */ -#define INITIAL_MAX_XPAIRS 2000 -#define MAX_XPAIRS_INCREMENT 2000 - -/* Maximum number of nxt/chk pairs needed for templates. */ -#define INITIAL_MAX_TEMPLATE_XPAIRS 2500 -#define MAX_TEMPLATE_XPAIRS_INCREMENT 2500 - -#define SYM_EPSILON (CSIZE + 1) /* to mark transitions on the symbol epsilon */ - -#define INITIAL_MAX_SCS 40 /* maximum number of start conditions */ -#define MAX_SCS_INCREMENT 40 /* amount to bump by if it's not enough */ - -#define ONE_STACK_SIZE 500 /* stack of states with only one out-transition */ -#define SAME_TRANS -1 /* transition is the same as "default" entry for state */ - -/* The following percentages are used to tune table compression: - - * The percentage the number of out-transitions a state must be of the - * number of equivalence classes in order to be considered for table - * compaction by using protos. - */ -#define PROTO_SIZE_PERCENTAGE 15 - -/* The percentage the number of homogeneous out-transitions of a state - * must be of the number of total out-transitions of the state in order - * that the state's transition table is first compared with a potential - * template of the most common out-transition instead of with the first - * proto in the proto queue. - */ -#define CHECK_COM_PERCENTAGE 50 - -/* The percentage the number of differences between a state's transition - * table and the proto it was first compared with must be of the total - * number of out-transitions of the state in order to keep the first - * proto as a good match and not search any further. - */ -#define FIRST_MATCH_DIFF_PERCENTAGE 10 - -/* The percentage the number of differences between a state's transition - * table and the most similar proto must be of the state's total number - * of out-transitions to use the proto as an acceptable close match. - */ -#define ACCEPTABLE_DIFF_PERCENTAGE 50 - -/* The percentage the number of homogeneous out-transitions of a state - * must be of the number of total out-transitions of the state in order - * to consider making a template from the state. - */ -#define TEMPLATE_SAME_PERCENTAGE 60 - -/* The percentage the number of differences between a state's transition - * table and the most similar proto must be of the state's total number - * of out-transitions to create a new proto from the state. - */ -#define NEW_PROTO_DIFF_PERCENTAGE 20 - -/* The percentage the total number of out-transitions of a state must be - * of the number of equivalence classes in order to consider trying to - * fit the transition table into "holes" inside the nxt/chk table. - */ -#define INTERIOR_FIT_PERCENTAGE 15 - -/* Size of region set aside to cache the complete transition table of - * protos on the proto queue to enable quick comparisons. - */ -#define PROT_SAVE_SIZE 2000 - -#define MSP 50 /* maximum number of saved protos (protos on the proto queue) */ - -/* Maximum number of out-transitions a state can have that we'll rummage - * around through the interior of the internal fast table looking for a - * spot for it. - */ -#define MAX_XTIONS_FULL_INTERIOR_FIT 4 - -/* Maximum number of rules which will be reported as being associated - * with a DFA state. - */ -#define MAX_ASSOC_RULES 100 - -/* Number that, if used to subscript an array, has a good chance of producing - * an error; should be small enough to fit into a short. - */ -#define BAD_SUBSCRIPT -32767 - -/* Absolute value of largest number that can be stored in a short, with a - * bit of slop thrown in for general paranoia. - */ -#define MAX_SHORT 32700 - - -/* Declarations for global variables. */ - - -/* Variables for flags: - * printstats - if true (-v), dump statistics - * syntaxerror - true if a syntax error has been found - * eofseen - true if we've seen an eof in the input file - * ddebug - if true (-d), make a "debug" scanner - * trace - if true (-T), trace processing - * nowarn - if true (-w), do not generate warnings - * spprdflt - if true (-s), suppress the default rule - * interactive - if true (-I), generate an interactive scanner - * caseins - if true (-i), generate a case-insensitive scanner - * lex_compat - if true (-l), maximize compatibility with AT&T lex - * posix_compat - if true (-X), maximize compatibility with POSIX lex - * do_yylineno - if true, generate code to maintain yylineno - * useecs - if true (-Ce flag), use equivalence classes - * fulltbl - if true (-Cf flag), don't compress the DFA state table - * usemecs - if true (-Cm flag), use meta-equivalence classes - * fullspd - if true (-F flag), use Jacobson method of table representation - * gen_line_dirs - if true (i.e., no -L flag), generate #line directives - * performance_report - if > 0 (i.e., -p flag), generate a report relating - * to scanner performance; if > 1 (-p -p), report on minor performance - * problems, too - * backing_up_report - if true (i.e., -b flag), generate "lex.backup" file - * listing backing-up states - * C_plus_plus - if true (i.e., -+ flag), generate a C++ scanner class; - * otherwise, a standard C scanner - * reentrant - if true (-R), generate a reentrant C scanner. - * bison_bridge_lval - if true (--bison-bridge), bison pure calling convention. - * bison_bridge_lloc - if true (--bison-locations), bison yylloc. - * long_align - if true (-Ca flag), favor long-word alignment. - * use_read - if true (-f, -F, or -Cr) then use read() for scanner input; - * otherwise, use fread(). - * yytext_is_array - if true (i.e., %array directive), then declare - * yytext as a array instead of a character pointer. Nice and inefficient. - * do_yywrap - do yywrap() processing on EOF. If false, EOF treated as - * "no more files". - * csize - size of character set for the scanner we're generating; - * 128 for 7-bit chars and 256 for 8-bit - * yymore_used - if true, yymore() is used in input rules - * reject - if true, generate back-up tables for REJECT macro - * real_reject - if true, scanner really uses REJECT (as opposed to just - * having "reject" set for variable trailing context) - * continued_action - true if this rule's action is to "fall through" to - * the next rule's action (i.e., the '|' action) - * in_rule - true if we're inside an individual rule, false if not. - * yymore_really_used - whether to treat yymore() as really used, regardless - * of what we think based on references to it in the user's actions. - * reject_really_used - same for REJECT - */ - -extern int printstats, syntaxerror, eofseen, ddebug, trace, nowarn, - spprdflt; -extern int interactive, caseins, lex_compat, posix_compat, do_yylineno; -extern int useecs, fulltbl, usemecs, fullspd; -extern int gen_line_dirs, performance_report, backing_up_report; -extern int reentrant, bison_bridge_lval, bison_bridge_lloc; -extern bool ansi_func_defs, ansi_func_protos; -extern int C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap; -extern int csize; -extern int yymore_used, reject, real_reject, continued_action, in_rule; - -extern int yymore_really_used, reject_really_used; - - -/* Variables used in the flex input routines: - * datapos - characters on current output line - * dataline - number of contiguous lines of data in current data - * statement. Used to generate readable -f output - * linenum - current input line number - * out_linenum - current output line number - * skelfile - the skeleton file - * skel - compiled-in skeleton array - * skel_ind - index into "skel" array, if skelfile is nil - * yyin - input file - * backing_up_file - file to summarize backing-up states to - * infilename - name of input file - * outfilename - name of output file - * headerfilename - name of the .h file to generate - * did_outfilename - whether outfilename was explicitly set - * prefix - the prefix used for externally visible names ("yy" by default) - * yyclass - yyFlexLexer subclass to use for YY_DECL - * do_stdinit - whether to initialize yyin/yyout to stdin/stdout - * use_stdout - the -t flag - * input_files - array holding names of input files - * num_input_files - size of input_files array - * program_name - name with which program was invoked - * - * action_array - array to hold the rule actions - * action_size - size of action_array - * defs1_offset - index where the user's section 1 definitions start - * in action_array - * prolog_offset - index where the prolog starts in action_array - * action_offset - index where the non-prolog starts in action_array - * action_index - index where the next action should go, with respect - * to "action_array" - */ - -extern int datapos, dataline, linenum, out_linenum; -extern FILE *skelfile, *yyin, *backing_up_file; -extern const char *skel[]; -extern int skel_ind; -extern char *infilename, *outfilename, *headerfilename; -extern int did_outfilename; -extern char *prefix, *yyclass; -extern int do_stdinit, use_stdout; -extern char **input_files; -extern int num_input_files; -extern char *program_name; - -extern char *action_array; -extern int action_size; -extern int defs1_offset, prolog_offset, action_offset, action_index; - - -/* Variables for stack of states having only one out-transition: - * onestate - state number - * onesym - transition symbol - * onenext - target state - * onedef - default base entry - * onesp - stack pointer - */ - -extern int onestate[ONE_STACK_SIZE], onesym[ONE_STACK_SIZE]; -extern int onenext[ONE_STACK_SIZE], onedef[ONE_STACK_SIZE], onesp; - - -/* Variables for nfa machine data: - * maximum_mns - maximal number of NFA states supported by tables - * current_mns - current maximum on number of NFA states - * num_rules - number of the last accepting state; also is number of - * rules created so far - * num_eof_rules - number of <> rules - * default_rule - number of the default rule - * current_max_rules - current maximum number of rules - * lastnfa - last nfa state number created - * firstst - physically the first state of a fragment - * lastst - last physical state of fragment - * finalst - last logical state of fragment - * transchar - transition character - * trans1 - transition state - * trans2 - 2nd transition state for epsilons - * accptnum - accepting number - * assoc_rule - rule associated with this NFA state (or 0 if none) - * state_type - a STATE_xxx type identifying whether the state is part - * of a normal rule, the leading state in a trailing context - * rule (i.e., the state which marks the transition from - * recognizing the text-to-be-matched to the beginning of - * the trailing context), or a subsequent state in a trailing - * context rule - * rule_type - a RULE_xxx type identifying whether this a ho-hum - * normal rule or one which has variable head & trailing - * context - * rule_linenum - line number associated with rule - * rule_useful - true if we've determined that the rule can be matched - * rule_has_nl - true if rule could possibly match a newline - * ccl_has_nl - true if current ccl could match a newline - * nlch - default eol char - */ - -extern int maximum_mns, current_mns, current_max_rules; -extern int num_rules, num_eof_rules, default_rule, lastnfa; -extern int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2; -extern int *accptnum, *assoc_rule, *state_type; -extern int *rule_type, *rule_linenum, *rule_useful; -extern bool *rule_has_nl, *ccl_has_nl; -extern int nlch; - -/* Different types of states; values are useful as masks, as well, for - * routines like check_trailing_context(). - */ -#define STATE_NORMAL 0x1 -#define STATE_TRAILING_CONTEXT 0x2 - -/* Global holding current type of state we're making. */ - -extern int current_state_type; - -/* Different types of rules. */ -#define RULE_NORMAL 0 -#define RULE_VARIABLE 1 - -/* True if the input rules include a rule with both variable-length head - * and trailing context, false otherwise. - */ -extern int variable_trailing_context_rules; - - -/* Variables for protos: - * numtemps - number of templates created - * numprots - number of protos created - * protprev - backlink to a more-recently used proto - * protnext - forward link to a less-recently used proto - * prottbl - base/def table entry for proto - * protcomst - common state of proto - * firstprot - number of the most recently used proto - * lastprot - number of the least recently used proto - * protsave contains the entire state array for protos - */ - -extern int numtemps, numprots, protprev[MSP], protnext[MSP], prottbl[MSP]; -extern int protcomst[MSP], firstprot, lastprot, protsave[PROT_SAVE_SIZE]; - - -/* Variables for managing equivalence classes: - * numecs - number of equivalence classes - * nextecm - forward link of Equivalence Class members - * ecgroup - class number or backward link of EC members - * nummecs - number of meta-equivalence classes (used to compress - * templates) - * tecfwd - forward link of meta-equivalence classes members - * tecbck - backward link of MEC's - */ - -/* Reserve enough room in the equivalence class arrays so that we - * can use the CSIZE'th element to hold equivalence class information - * for the NUL character. Later we'll move this information into - * the 0th element. - */ -extern int numecs, nextecm[CSIZE + 1], ecgroup[CSIZE + 1], nummecs; - -/* Meta-equivalence classes are indexed starting at 1, so it's possible - * that they will require positions from 1 .. CSIZE, i.e., CSIZE + 1 - * slots total (since the arrays are 0-based). nextecm[] and ecgroup[] - * don't require the extra position since they're indexed from 1 .. CSIZE - 1. - */ -extern int tecfwd[CSIZE + 1], tecbck[CSIZE + 1]; - - -/* Variables for start conditions: - * lastsc - last start condition created - * current_max_scs - current limit on number of start conditions - * scset - set of rules active in start condition - * scbol - set of rules active only at the beginning of line in a s.c. - * scxclu - true if start condition is exclusive - * sceof - true if start condition has EOF rule - * scname - start condition name - */ - -extern int lastsc, *scset, *scbol, *scxclu, *sceof; -extern int current_max_scs; -extern char **scname; - - -/* Variables for dfa machine data: - * current_max_dfa_size - current maximum number of NFA states in DFA - * current_max_xpairs - current maximum number of non-template xtion pairs - * current_max_template_xpairs - current maximum number of template pairs - * current_max_dfas - current maximum number DFA states - * lastdfa - last dfa state number created - * nxt - state to enter upon reading character - * chk - check value to see if "nxt" applies - * tnxt - internal nxt table for templates - * base - offset into "nxt" for given state - * def - where to go if "chk" disallows "nxt" entry - * nultrans - NUL transition for each state - * NUL_ec - equivalence class of the NUL character - * tblend - last "nxt/chk" table entry being used - * firstfree - first empty entry in "nxt/chk" table - * dss - nfa state set for each dfa - * dfasiz - size of nfa state set for each dfa - * dfaacc - accepting set for each dfa state (if using REJECT), or accepting - * number, if not - * accsiz - size of accepting set for each dfa state - * dhash - dfa state hash value - * numas - number of DFA accepting states created; note that this - * is not necessarily the same value as num_rules, which is the analogous - * value for the NFA - * numsnpairs - number of state/nextstate transition pairs - * jambase - position in base/def where the default jam table starts - * jamstate - state number corresponding to "jam" state - * end_of_buffer_state - end-of-buffer dfa state number - */ - -extern int current_max_dfa_size, current_max_xpairs; -extern int current_max_template_xpairs, current_max_dfas; -extern int lastdfa, *nxt, *chk, *tnxt; -extern int *base, *def, *nultrans, NUL_ec, tblend, firstfree, **dss, - *dfasiz; -extern union dfaacc_union { - int *dfaacc_set; - int dfaacc_state; -} *dfaacc; -extern int *accsiz, *dhash, numas; -extern int numsnpairs, jambase, jamstate; -extern int end_of_buffer_state; - -/* Variables for ccl information: - * lastccl - ccl index of the last created ccl - * current_maxccls - current limit on the maximum number of unique ccl's - * cclmap - maps a ccl index to its set pointer - * ccllen - gives the length of a ccl - * cclng - true for a given ccl if the ccl is negated - * cclreuse - counts how many times a ccl is re-used - * current_max_ccl_tbl_size - current limit on number of characters needed - * to represent the unique ccl's - * ccltbl - holds the characters in each ccl - indexed by cclmap - */ - -extern int lastccl, *cclmap, *ccllen, *cclng, cclreuse; -extern int current_maxccls, current_max_ccl_tbl_size; -extern Char *ccltbl; - - -/* Variables for miscellaneous information: - * nmstr - last NAME scanned by the scanner - * sectnum - section number currently being parsed - * nummt - number of empty nxt/chk table entries - * hshcol - number of hash collisions detected by snstods - * dfaeql - number of times a newly created dfa was equal to an old one - * numeps - number of epsilon NFA states created - * eps2 - number of epsilon states which have 2 out-transitions - * num_reallocs - number of times it was necessary to realloc() a group - * of arrays - * tmpuses - number of DFA states that chain to templates - * totnst - total number of NFA states used to make DFA states - * peakpairs - peak number of transition pairs we had to store internally - * numuniq - number of unique transitions - * numdup - number of duplicate transitions - * hshsave - number of hash collisions saved by checking number of states - * num_backing_up - number of DFA states requiring backing up - * bol_needed - whether scanner needs beginning-of-line recognition - */ - -extern char nmstr[MAXLINE]; -extern int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs; -extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave; -extern int num_backing_up, bol_needed; - -void *allocate_array PROTO ((int, size_t)); -void *reallocate_array PROTO ((void *, int, size_t)); - -void *flex_alloc PROTO ((size_t)); -void *flex_realloc PROTO ((void *, size_t)); -void flex_free PROTO ((void *)); - -#define allocate_integer_array(size) \ - (int *) allocate_array( size, sizeof( int ) ) - -#define reallocate_integer_array(array,size) \ - (int *) reallocate_array( (void *) array, size, sizeof( int ) ) - -#define allocate_bool_array(size) \ - (bool *) allocate_array( size, sizeof( bool ) ) - -#define reallocate_bool_array(array,size) \ - (bool *) reallocate_array( (void *) array, size, sizeof( bool ) ) - -#define allocate_int_ptr_array(size) \ - (int **) allocate_array( size, sizeof( int * ) ) - -#define allocate_char_ptr_array(size) \ - (char **) allocate_array( size, sizeof( char * ) ) - -#define allocate_dfaacc_union(size) \ - (union dfaacc_union *) \ - allocate_array( size, sizeof( union dfaacc_union ) ) - -#define reallocate_int_ptr_array(array,size) \ - (int **) reallocate_array( (void *) array, size, sizeof( int * ) ) - -#define reallocate_char_ptr_array(array,size) \ - (char **) reallocate_array( (void *) array, size, sizeof( char * ) ) - -#define reallocate_dfaacc_union(array, size) \ - (union dfaacc_union *) \ - reallocate_array( (void *) array, size, sizeof( union dfaacc_union ) ) - -#define allocate_character_array(size) \ - (char *) allocate_array( size, sizeof( char ) ) - -#define reallocate_character_array(array,size) \ - (char *) reallocate_array( (void *) array, size, sizeof( char ) ) - -#define allocate_Character_array(size) \ - (Char *) allocate_array( size, sizeof( Char ) ) - -#define reallocate_Character_array(array,size) \ - (Char *) reallocate_array( (void *) array, size, sizeof( Char ) ) - - -/* Used to communicate between scanner and parser. The type should really - * be YYSTYPE, but we can't easily get our hands on it. - */ -extern int yylval; - - -/* External functions that are cross-referenced among the flex source files. */ - - -/* from file ccl.c */ - -extern void ccladd PROTO ((int, int)); /* add a single character to a ccl */ -extern int cclinit PROTO ((void)); /* make an empty ccl */ -extern void cclnegate PROTO ((int)); /* negate a ccl */ - -/* List the members of a set of characters in CCL form. */ -extern void list_character_set PROTO ((FILE *, int[])); - - -/* from file dfa.c */ - -/* Check a DFA state for backing up. */ -extern void check_for_backing_up PROTO ((int, int[])); - -/* Check to see if NFA state set constitutes "dangerous" trailing context. */ -extern void check_trailing_context PROTO ((int *, int, int *, int)); - -/* Construct the epsilon closure of a set of ndfa states. */ -extern int *epsclosure PROTO ((int *, int *, int[], int *, int *)); - -/* Increase the maximum number of dfas. */ -extern void increase_max_dfas PROTO ((void)); - -extern void ntod PROTO ((void)); /* convert a ndfa to a dfa */ - -/* Converts a set of ndfa states into a dfa state. */ -extern int snstods PROTO ((int[], int, int[], int, int, int *)); - - -/* from file ecs.c */ - -/* Convert character classes to set of equivalence classes. */ -extern void ccl2ecl PROTO ((void)); - -/* Associate equivalence class numbers with class members. */ -extern int cre8ecs PROTO ((int[], int[], int)); - -/* Update equivalence classes based on character class transitions. */ -extern void mkeccl PROTO ((Char[], int, int[], int[], int, int)); - -/* Create equivalence class for single character. */ -extern void mkechar PROTO ((int, int[], int[])); - - -/* from file gen.c */ - -extern void do_indent PROTO ((void)); /* indent to the current level */ - -/* Generate the code to keep backing-up information. */ -extern void gen_backing_up PROTO ((void)); - -/* Generate the code to perform the backing up. */ -extern void gen_bu_action PROTO ((void)); - -/* Generate full speed compressed transition table. */ -extern void genctbl PROTO ((void)); - -/* Generate the code to find the action number. */ -extern void gen_find_action PROTO ((void)); - -extern void genftbl PROTO ((void)); /* generate full transition table */ - -/* Generate the code to find the next compressed-table state. */ -extern void gen_next_compressed_state PROTO ((char *)); - -/* Generate the code to find the next match. */ -extern void gen_next_match PROTO ((void)); - -/* Generate the code to find the next state. */ -extern void gen_next_state PROTO ((int)); - -/* Generate the code to make a NUL transition. */ -extern void gen_NUL_trans PROTO ((void)); - -/* Generate the code to find the start state. */ -extern void gen_start_state PROTO ((void)); - -/* Generate data statements for the transition tables. */ -extern void gentabs PROTO ((void)); - -/* Write out a formatted string at the current indentation level. */ -extern void indent_put2s PROTO ((const char *, const char *)); - -/* Write out a string + newline at the current indentation level. */ -extern void indent_puts PROTO ((const char *)); - -extern void make_tables PROTO ((void)); /* generate transition tables */ - - -/* from file main.c */ - -extern void check_options PROTO ((void)); -extern void flexend PROTO ((int)); -extern void usage PROTO ((void)); - - -/* from file misc.c */ - -/* Add a #define to the action file. */ -extern void action_define PROTO ((const char *defname, int value)); - -/* Add the given text to the stored actions. */ -extern void add_action PROTO ((char *new_text)); - -/* True if a string is all lower case. */ -extern int all_lower PROTO ((register char *)); - -/* True if a string is all upper case. */ -extern int all_upper PROTO ((register char *)); - -/* Bubble sort an integer array. */ -extern void bubble PROTO ((int[], int)); - -/* Check a character to make sure it's in the expected range. */ -extern void check_char PROTO ((int c)); - -/* Replace upper-case letter to lower-case. */ -extern Char clower PROTO ((int)); - -/* Returns a dynamically allocated copy of a string. */ -extern char *copy_string PROTO ((register const char *)); - -/* Returns a dynamically allocated copy of a (potentially) unsigned string. */ -extern Char *copy_unsigned_string PROTO ((register Char *)); - -/* Shell sort a character array. */ -extern void cshell PROTO ((Char[], int, int)); - -/* Finish up a block of data declarations. */ -extern void dataend PROTO ((void)); - -/* Flush generated data statements. */ -extern void dataflush PROTO ((void)); - -/* Report an error message and terminate. */ -extern void flexerror PROTO ((const char *)); - -/* Report a fatal error message and terminate. */ -extern void flexfatal PROTO ((const char *)); - -/* Report a fatal error with a pinpoint, and terminate */ -#if HAVE_DECL___FUNC__ -#define flex_die(msg) \ - do{ \ - fprintf (stderr,\ - _("%s: fatal internal error at %s:%d (%s): %s\n"),\ - program_name, __FILE__, (int)__LINE__,\ - __func__,msg);\ - FLEX_EXIT(1);\ - }while(0) -#else /* ! HAVE_DECL___FUNC__ */ -#define flex_die(msg) \ - do{ \ - fprintf (stderr,\ - _("%s: fatal internal error at %s:%d %s\n"),\ - program_name, __FILE__, (int)__LINE__,\ - msg);\ - FLEX_EXIT(1);\ - }while(0) -#endif /* ! HAVE_DECL___func__ */ - -/* Convert a hexadecimal digit string to an integer value. */ -extern int htoi PROTO ((Char[])); - -/* Report an error message formatted with one integer argument. */ -extern void lerrif PROTO ((const char *, int)); - -/* Report an error message formatted with one string argument. */ -extern void lerrsf PROTO ((const char *, const char *)); - -/* Spit out a "#line" statement. */ -extern void line_directive_out PROTO ((FILE *, int)); - -/* Mark the current position in the action array as the end of the section 1 - * user defs. - */ -extern void mark_defs1 PROTO ((void)); - -/* Mark the current position in the action array as the end of the prolog. */ -extern void mark_prolog PROTO ((void)); - -/* Generate a data statment for a two-dimensional array. */ -extern void mk2data PROTO ((int)); - -extern void mkdata PROTO ((int)); /* generate a data statement */ - -/* Return the integer represented by a string of digits. */ -extern int myctoi PROTO ((const char *)); - -/* Return character corresponding to escape sequence. */ -extern Char myesc PROTO ((Char[])); - -/* Convert an octal digit string to an integer value. */ -extern int otoi PROTO ((Char[])); - -/* Output a (possibly-formatted) string to the generated scanner. */ -extern void out PROTO ((const char *)); -extern void out_dec PROTO ((const char *, int)); -extern void out_dec2 PROTO ((const char *, int, int)); -extern void out_hex PROTO ((const char *, unsigned int)); -extern void out_line_count PROTO ((const char *)); -extern void out_str PROTO ((const char *, const char *)); -extern void out_str3 -PROTO ((const char *, const char *, const char *, const char *)); -extern void out_str_dec PROTO ((const char *, const char *, int)); -extern void outc PROTO ((int)); -extern void outn PROTO ((const char *)); -extern void out_m4_define (const char* def, const char* val); - -/* Return a printable version of the given character, which might be - * 8-bit. - */ -extern char *readable_form PROTO ((int)); - -/* Write out one section of the skeleton file. */ -extern void skelout PROTO ((void)); - -/* Output a yy_trans_info structure. */ -extern void transition_struct_out PROTO ((int, int)); - -/* Only needed when using certain broken versions of bison to build parse.c. */ -extern void *yy_flex_xmalloc PROTO ((int)); - -/* Set a region of memory to 0. */ -extern void zero_out PROTO ((char *, size_t)); - - -/* from file nfa.c */ - -/* Add an accepting state to a machine. */ -extern void add_accept PROTO ((int, int)); - -/* Make a given number of copies of a singleton machine. */ -extern int copysingl PROTO ((int, int)); - -/* Debugging routine to write out an nfa. */ -extern void dumpnfa PROTO ((int)); - -/* Finish up the processing for a rule. */ -extern void finish_rule PROTO ((int, int, int, int, int)); - -/* Connect two machines together. */ -extern int link_machines PROTO ((int, int)); - -/* Mark each "beginning" state in a machine as being a "normal" (i.e., - * not trailing context associated) state. - */ -extern void mark_beginning_as_normal PROTO ((register int)); - -/* Make a machine that branches to two machines. */ -extern int mkbranch PROTO ((int, int)); - -extern int mkclos PROTO ((int)); /* convert a machine into a closure */ -extern int mkopt PROTO ((int)); /* make a machine optional */ - -/* Make a machine that matches either one of two machines. */ -extern int mkor PROTO ((int, int)); - -/* Convert a machine into a positive closure. */ -extern int mkposcl PROTO ((int)); - -extern int mkrep PROTO ((int, int, int)); /* make a replicated machine */ - -/* Create a state with a transition on a given symbol. */ -extern int mkstate PROTO ((int)); - -extern void new_rule PROTO ((void)); /* initialize for a new rule */ - - -/* from file parse.y */ - -/* Build the "<>" action for the active start conditions. */ -extern void build_eof_action PROTO ((void)); - -/* Write out a message formatted with one string, pinpointing its location. */ -extern void format_pinpoint_message PROTO ((const char *, const char *)); - -/* Write out a message, pinpointing its location. */ -extern void pinpoint_message PROTO ((const char *)); - -/* Write out a warning, pinpointing it at the given line. */ -extern void line_warning PROTO ((const char *, int)); - -/* Write out a message, pinpointing it at the given line. */ -extern void line_pinpoint PROTO ((const char *, int)); - -/* Report a formatted syntax error. */ -extern void format_synerr PROTO ((const char *, const char *)); -extern void synerr PROTO ((const char *)); /* report a syntax error */ -extern void format_warn PROTO ((const char *, const char *)); -extern void warn PROTO ((const char *)); /* report a warning */ -extern void yyerror PROTO ((const char *)); /* report a parse error */ -extern int yyparse PROTO ((void)); /* the YACC parser */ - - -/* from file scan.l */ - -/* The Flex-generated scanner for flex. */ -extern int flexscan PROTO ((void)); - -/* Open the given file (if NULL, stdin) for scanning. */ -extern void set_input_file PROTO ((char *)); - -/* Wrapup a file in the lexical analyzer. */ -extern int yywrap PROTO ((void)); - - -/* from file sym.c */ - -/* Save the text of a character class. */ -extern void cclinstal PROTO ((Char[], int)); - -/* Lookup the number associated with character class. */ -extern int ccllookup PROTO ((Char[])); - -extern void ndinstal PROTO ((const char *, Char[])); /* install a name definition */ -extern Char *ndlookup PROTO ((const char *)); /* lookup a name definition */ - -/* Increase maximum number of SC's. */ -extern void scextend PROTO ((void)); -extern void scinstal PROTO ((const char *, int)); /* make a start condition */ - -/* Lookup the number associated with a start condition. */ -extern int sclookup PROTO ((const char *)); - - -/* from file tblcmp.c */ - -/* Build table entries for dfa state. */ -extern void bldtbl PROTO ((int[], int, int, int, int)); - -extern void cmptmps PROTO ((void)); /* compress template table entries */ -extern void expand_nxt_chk PROTO ((void)); /* increase nxt/chk arrays */ - -/* Finds a space in the table for a state to be placed. */ -extern int find_table_space PROTO ((int *, int)); -extern void inittbl PROTO ((void)); /* initialize transition tables */ - -/* Make the default, "jam" table entries. */ -extern void mkdeftbl PROTO ((void)); - -/* Create table entries for a state (or state fragment) which has - * only one out-transition. - */ -extern void mk1tbl PROTO ((int, int, int, int)); - -/* Place a state into full speed transition table. */ -extern void place_state PROTO ((int *, int, int)); - -/* Save states with only one out-transition to be processed later. */ -extern void stack1 PROTO ((int, int, int, int)); - - -/* from file yylex.c */ - -extern int yylex PROTO ((void)); - -/* A growable array. See buf.c. */ -struct Buf { - void *elts; /* elements. */ - int nelts; /* number of elements. */ - size_t elt_size; /* in bytes. */ - int nmax; /* max capacity of elements. */ -}; - -extern void buf_init PROTO ((struct Buf * buf, size_t elem_size)); -extern void buf_destroy PROTO ((struct Buf * buf)); -extern struct Buf *buf_append -PROTO ((struct Buf * buf, const void *ptr, int n_elem)); -extern struct Buf *buf_concat PROTO((struct Buf* dest, const struct Buf* src)); -extern struct Buf *buf_strappend PROTO ((struct Buf *, const char *str)); -extern struct Buf *buf_strnappend -PROTO ((struct Buf *, const char *str, int nchars)); -extern struct Buf *buf_strdefine -PROTO ((struct Buf * buf, const char *str, const char *def)); -extern struct Buf *buf_prints PROTO((struct Buf *buf, const char *fmt, const char* s)); -extern struct Buf *buf_m4_define PROTO((struct Buf *buf, const char* def, const char* val)); -extern struct Buf *buf_m4_undefine PROTO((struct Buf *buf, const char* def)); -extern struct Buf *buf_print_strings PROTO((struct Buf * buf, FILE* out)); -extern struct Buf *buf_linedir PROTO((struct Buf *buf, const char* filename, int lineno)); - -extern struct Buf userdef_buf; /* a string buffer for #define's generated by user-options on cmd line. */ -extern struct Buf defs_buf; /* a char* buffer to save #define'd some symbols generated by flex. */ -extern struct Buf yydmap_buf; /* a string buffer to hold yydmap elements */ -extern struct Buf m4defs_buf; /* Holds m4 definitions. */ -extern struct Buf top_buf; /* contains %top code. String buffer. */ - -/* For blocking out code from the header file. */ -#define OUT_BEGIN_CODE() outn("m4_ifdef( [[M4_YY_IN_HEADER]],,[[") -#define OUT_END_CODE() outn("]])") - -/* For setjmp/longjmp (instead of calling exit(2)). Linkage in main.c */ -extern jmp_buf flex_main_jmp_buf; - -#define FLEX_EXIT(status) longjmp(flex_main_jmp_buf,(status)+1) - -/* Removes all \n and \r chars from tail of str. returns str. */ -extern char *chomp (char *str); - -/* ctype functions forced to return boolean */ -#define b_isalnum(c) (isalnum(c)?true:false) -#define b_isalpha(c) (isalpha(c)?true:false) -#define b_isascii(c) (isascii(c)?true:false) -#define b_isblank(c) (isblank(c)?true:false) -#define b_iscntrl(c) (iscntrl(c)?true:false) -#define b_isdigit(c) (isdigit(c)?true:false) -#define b_isgraph(c) (isgraph(c)?true:false) -#define b_islower(c) (islower(c)?true:false) -#define b_isprint(c) (isprint(c)?true:false) -#define b_ispunct(c) (ispunct(c)?true:false) -#define b_isspace(c) (isspace(c)?true:false) -#define b_isupper(c) (isupper(c)?true:false) -#define b_isxdigit(c) (isxdigit(c)?true:false) - -/* return true if char is uppercase or lowercase. */ -bool has_case(int c); - -/* Change case of character if possible. */ -int reverse_case(int c); - -/* return false if [c1-c2] is ambiguous for a caseless scanner. */ -bool range_covers_case (int c1, int c2); - -/* - * From "filter.c" - */ - -/** A single stdio filter to execute. - * The filter may be external, such as "sed", or it - * may be internal, as a function call. - */ -struct filter { - int (*filter_func)(struct filter*); /**< internal filter function */ - void * extra; /**< extra data passed to filter_func */ - int argc; /**< arg count */ - const char ** argv; /**< arg vector, \0-terminated */ - struct filter * next; /**< next filter or NULL */ -}; - -/* output filter chain */ -extern struct filter * output_chain; -extern struct filter *filter_create_ext PROTO((struct filter * chain, const char *cmd, ...)); -struct filter *filter_create_int PROTO((struct filter *chain, - int (*filter_func) (struct filter *), - void *extra)); -extern bool filter_apply_chain PROTO((struct filter * chain)); -extern int filter_truncate (struct filter * chain, int max_len); -extern int filter_tee_header PROTO((struct filter *chain)); -extern int filter_fix_linedirs PROTO((struct filter *chain)); - - -/* - * From "regex.c" - */ - -extern regex_t regex_linedir, regex_blank_line; -bool flex_init_regex(void); -void flex_regcomp(regex_t *preg, const char *regex, int cflags); -char *regmatch_dup (regmatch_t * m, const char *src); -char *regmatch_cpy (regmatch_t * m, char *dest, const char *src); -int regmatch_len (regmatch_t * m); -int regmatch_strtol (regmatch_t * m, const char *src, char **endptr, int base); -bool regmatch_empty (regmatch_t * m); - -#endif /* not defined FLEXDEF_H */ diff --git a/src/bin/flex/flexint.h b/src/bin/flex/flexint.h deleted file mode 100644 index 40887159c8..0000000000 --- a/src/bin/flex/flexint.h +++ /dev/null @@ -1,63 +0,0 @@ -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if __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 */ diff --git a/src/bin/flex/gen.c b/src/bin/flex/gen.c deleted file mode 100644 index b78f59581d..0000000000 --- a/src/bin/flex/gen.c +++ /dev/null @@ -1,2175 +0,0 @@ -/* gen - actual generation (writing) of flex scanners */ - -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -#include "flexdef.h" -#include "tables.h" - - -/* declare functions that have forward references */ - -void gen_next_state PROTO ((int)); -void genecs PROTO ((void)); -void indent_put2s PROTO ((const char *, const char *)); -void indent_puts PROTO ((const char *)); - - -static int indent_level = 0; /* each level is 8 spaces */ - -#define indent_up() (++indent_level) -#define indent_down() (--indent_level) -#define set_indent(indent_val) indent_level = indent_val - -/* Almost everything is done in terms of arrays starting at 1, so provide - * a null entry for the zero element of all C arrays. (The exception - * to this is that the fast table representation generally uses the - * 0 elements of its arrays, too.) - */ - -static const char *get_int16_decl (void) -{ - return (gentables) - ? "static yyconst flex_int16_t %s[%d] =\n { 0,\n" - : "static yyconst flex_int16_t * %s = 0;\n"; -} - - -static const char *get_int32_decl (void) -{ - return (gentables) - ? "static yyconst flex_int32_t %s[%d] =\n { 0,\n" - : "static yyconst flex_int32_t * %s = 0;\n"; -} - -static const char *get_state_decl (void) -{ - return (gentables) - ? "static yyconst yy_state_type %s[%d] =\n { 0,\n" - : "static yyconst yy_state_type * %s = 0;\n"; -} - -/* Indent to the current level. */ - -void do_indent () -{ - register int i = indent_level * 8; - - while (i >= 8) { - outc ('\t'); - i -= 8; - } - - while (i > 0) { - outc (' '); - --i; - } -} - - -/** Make the table for possible eol matches. - * @return the newly allocated rule_can_match_eol table - */ -static struct yytbl_data *mkeoltbl (void) -{ - int i; - flex_int8_t *tdata = 0; - struct yytbl_data *tbl; - - tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data)); - yytbl_data_init (tbl, YYTD_ID_RULE_CAN_MATCH_EOL); - tbl->td_flags = YYTD_DATA8; - tbl->td_lolen = num_rules + 1; - tbl->td_data = tdata = - (flex_int8_t *) calloc (tbl->td_lolen, sizeof (flex_int8_t)); - - for (i = 1; i <= num_rules; i++) - tdata[i] = rule_has_nl[i] ? 1 : 0; - - buf_prints (&yydmap_buf, - "\t{YYTD_ID_RULE_CAN_MATCH_EOL, (void**)&yy_rule_can_match_eol, sizeof(%s)},\n", - "flex_int32_t"); - return tbl; -} - -/* Generate the table for possible eol matches. */ -static void geneoltbl () -{ - int i; - - outn ("m4_ifdef( [[M4_YY_USE_LINENO]],[["); - outn ("/* Table of booleans, true if rule could match eol. */"); - out_str_dec (get_int32_decl (), "yy_rule_can_match_eol", - num_rules + 1); - - if (gentables) { - for (i = 1; i <= num_rules; i++) { - out_dec ("%d, ", rule_has_nl[i] ? 1 : 0); - /* format nicely, 20 numbers per line. */ - if ((i % 20) == 19) - out ("\n "); - } - out (" };\n"); - } - outn ("]])"); -} - - -/* Generate the code to keep backing-up information. */ - -void gen_backing_up () -{ - if (reject || num_backing_up == 0) - return; - - if (fullspd) - indent_puts ("if ( yy_current_state[-1].yy_nxt )"); - else - indent_puts ("if ( yy_accept[yy_current_state] )"); - - indent_up (); - indent_puts ("{"); - indent_puts ("YY_G(yy_last_accepting_state) = yy_current_state;"); - indent_puts ("YY_G(yy_last_accepting_cpos) = yy_cp;"); - indent_puts ("}"); - indent_down (); -} - - -/* Generate the code to perform the backing up. */ - -void gen_bu_action () -{ - if (reject || num_backing_up == 0) - return; - - set_indent (3); - - indent_puts ("case 0: /* must back up */"); - indent_puts ("/* undo the effects of YY_DO_BEFORE_ACTION */"); - indent_puts ("*yy_cp = YY_G(yy_hold_char);"); - - if (fullspd || fulltbl) - indent_puts ("yy_cp = YY_G(yy_last_accepting_cpos) + 1;"); - else - /* Backing-up info for compressed tables is taken \after/ - * yy_cp has been incremented for the next state. - */ - indent_puts ("yy_cp = YY_G(yy_last_accepting_cpos);"); - - indent_puts ("yy_current_state = YY_G(yy_last_accepting_state);"); - indent_puts ("goto yy_find_action;"); - outc ('\n'); - - set_indent (0); -} - -/** mkctbl - make full speed compressed transition table - * This is an array of structs; each struct a pair of integers. - * You should call mkssltbl() immediately after this. - * Then, I think, mkecstbl(). Arrrg. - * @return the newly allocated trans table - */ - -static struct yytbl_data *mkctbl (void) -{ - register int i; - struct yytbl_data *tbl = 0; - flex_int32_t *tdata = 0, curr = 0; - int end_of_buffer_action = num_rules + 1; - - buf_prints (&yydmap_buf, - "\t{YYTD_ID_TRANSITION, (void**)&yy_transition, sizeof(%s)},\n", - ((tblend + numecs + 1) >= INT16_MAX - || long_align) ? "flex_int32_t" : "flex_int16_t"); - - tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data)); - yytbl_data_init (tbl, YYTD_ID_TRANSITION); - tbl->td_flags = YYTD_DATA32 | YYTD_STRUCT; - tbl->td_hilen = 0; - tbl->td_lolen = tblend + numecs + 1; /* number of structs */ - - tbl->td_data = tdata = - (flex_int32_t *) calloc (tbl->td_lolen * 2, sizeof (flex_int32_t)); - - /* We want the transition to be represented as the offset to the - * next state, not the actual state number, which is what it currently - * is. The offset is base[nxt[i]] - (base of current state)]. That's - * just the difference between the starting points of the two involved - * states (to - from). - * - * First, though, we need to find some way to put in our end-of-buffer - * flags and states. We do this by making a state with absolutely no - * transitions. We put it at the end of the table. - */ - - /* We need to have room in nxt/chk for two more slots: One for the - * action and one for the end-of-buffer transition. We now *assume* - * that we're guaranteed the only character we'll try to index this - * nxt/chk pair with is EOB, i.e., 0, so we don't have to make sure - * there's room for jam entries for other characters. - */ - - while (tblend + 2 >= current_max_xpairs) - expand_nxt_chk (); - - while (lastdfa + 1 >= current_max_dfas) - increase_max_dfas (); - - base[lastdfa + 1] = tblend + 2; - nxt[tblend + 1] = end_of_buffer_action; - chk[tblend + 1] = numecs + 1; - chk[tblend + 2] = 1; /* anything but EOB */ - - /* So that "make test" won't show arb. differences. */ - nxt[tblend + 2] = 0; - - /* Make sure every state has an end-of-buffer transition and an - * action #. - */ - for (i = 0; i <= lastdfa; ++i) { - int anum = dfaacc[i].dfaacc_state; - int offset = base[i]; - - chk[offset] = EOB_POSITION; - chk[offset - 1] = ACTION_POSITION; - nxt[offset - 1] = anum; /* action number */ - } - - for (i = 0; i <= tblend; ++i) { - if (chk[i] == EOB_POSITION) { - tdata[curr++] = 0; - tdata[curr++] = base[lastdfa + 1] - i; - } - - else if (chk[i] == ACTION_POSITION) { - tdata[curr++] = 0; - tdata[curr++] = nxt[i]; - } - - else if (chk[i] > numecs || chk[i] == 0) { - tdata[curr++] = 0; - tdata[curr++] = 0; - } - else { /* verify, transition */ - - tdata[curr++] = chk[i]; - tdata[curr++] = base[nxt[i]] - (i - chk[i]); - } - } - - - /* Here's the final, end-of-buffer state. */ - tdata[curr++] = chk[tblend + 1]; - tdata[curr++] = nxt[tblend + 1]; - - tdata[curr++] = chk[tblend + 2]; - tdata[curr++] = nxt[tblend + 2]; - - return tbl; -} - - -/** Make start_state_list table. - * @return the newly allocated start_state_list table - */ -static struct yytbl_data *mkssltbl (void) -{ - struct yytbl_data *tbl = 0; - flex_int32_t *tdata = 0; - flex_int32_t i; - - tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data)); - yytbl_data_init (tbl, YYTD_ID_START_STATE_LIST); - tbl->td_flags = YYTD_DATA32 | YYTD_PTRANS; - tbl->td_hilen = 0; - tbl->td_lolen = lastsc * 2 + 1; - - tbl->td_data = tdata = - (flex_int32_t *) calloc (tbl->td_lolen, sizeof (flex_int32_t)); - - for (i = 0; i <= lastsc * 2; ++i) - tdata[i] = base[i]; - - buf_prints (&yydmap_buf, - "\t{YYTD_ID_START_STATE_LIST, (void**)&yy_start_state_list, sizeof(%s)},\n", - "struct yy_trans_info*"); - - return tbl; -} - - - -/* genctbl - generates full speed compressed transition table */ - -void genctbl () -{ - register int i; - int end_of_buffer_action = num_rules + 1; - - /* Table of verify for transition and offset to next state. */ - if (gentables) - out_dec ("static yyconst struct yy_trans_info yy_transition[%d] =\n {\n", tblend + numecs + 1); - else - outn ("static yyconst struct yy_trans_info *yy_transition = 0;"); - - /* We want the transition to be represented as the offset to the - * next state, not the actual state number, which is what it currently - * is. The offset is base[nxt[i]] - (base of current state)]. That's - * just the difference between the starting points of the two involved - * states (to - from). - * - * First, though, we need to find some way to put in our end-of-buffer - * flags and states. We do this by making a state with absolutely no - * transitions. We put it at the end of the table. - */ - - /* We need to have room in nxt/chk for two more slots: One for the - * action and one for the end-of-buffer transition. We now *assume* - * that we're guaranteed the only character we'll try to index this - * nxt/chk pair with is EOB, i.e., 0, so we don't have to make sure - * there's room for jam entries for other characters. - */ - - while (tblend + 2 >= current_max_xpairs) - expand_nxt_chk (); - - while (lastdfa + 1 >= current_max_dfas) - increase_max_dfas (); - - base[lastdfa + 1] = tblend + 2; - nxt[tblend + 1] = end_of_buffer_action; - chk[tblend + 1] = numecs + 1; - chk[tblend + 2] = 1; /* anything but EOB */ - - /* So that "make test" won't show arb. differences. */ - nxt[tblend + 2] = 0; - - /* Make sure every state has an end-of-buffer transition and an - * action #. - */ - for (i = 0; i <= lastdfa; ++i) { - int anum = dfaacc[i].dfaacc_state; - int offset = base[i]; - - chk[offset] = EOB_POSITION; - chk[offset - 1] = ACTION_POSITION; - nxt[offset - 1] = anum; /* action number */ - } - - for (i = 0; i <= tblend; ++i) { - if (chk[i] == EOB_POSITION) - transition_struct_out (0, base[lastdfa + 1] - i); - - else if (chk[i] == ACTION_POSITION) - transition_struct_out (0, nxt[i]); - - else if (chk[i] > numecs || chk[i] == 0) - transition_struct_out (0, 0); /* unused slot */ - - else /* verify, transition */ - transition_struct_out (chk[i], - base[nxt[i]] - (i - - chk[i])); - } - - - /* Here's the final, end-of-buffer state. */ - transition_struct_out (chk[tblend + 1], nxt[tblend + 1]); - transition_struct_out (chk[tblend + 2], nxt[tblend + 2]); - - if (gentables) - outn (" };\n"); - - /* Table of pointers to start states. */ - if (gentables) - out_dec ("static yyconst struct yy_trans_info *yy_start_state_list[%d] =\n", lastsc * 2 + 1); - else - outn ("static yyconst struct yy_trans_info **yy_start_state_list =0;"); - - if (gentables) { - outn (" {"); - - for (i = 0; i <= lastsc * 2; ++i) - out_dec (" &yy_transition[%d],\n", base[i]); - - dataend (); - } - - if (useecs) - genecs (); -} - - -/* mkecstbl - Make equivalence-class tables. */ - -struct yytbl_data *mkecstbl (void) -{ - register int i; - struct yytbl_data *tbl = 0; - flex_int32_t *tdata = 0; - - tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data)); - yytbl_data_init (tbl, YYTD_ID_EC); - tbl->td_flags |= YYTD_DATA32; - tbl->td_hilen = 0; - tbl->td_lolen = csize; - - tbl->td_data = tdata = - (flex_int32_t *) calloc (tbl->td_lolen, sizeof (flex_int32_t)); - - for (i = 1; i < csize; ++i) { - if (caseins && isupper (i)) - ecgroup[i] = ecgroup[tolower (i)]; - - ecgroup[i] = ABS (ecgroup[i]); - tdata[i] = ecgroup[i]; - } - - buf_prints (&yydmap_buf, - "\t{YYTD_ID_EC, (void**)&yy_ec, sizeof(%s)},\n", - "flex_int32_t"); - - return tbl; -} - -/* Generate equivalence-class tables. */ - -void genecs () -{ - register int i, j; - int numrows; - - out_str_dec (get_int32_decl (), "yy_ec", csize); - - for (i = 1; i < csize; ++i) { - if (caseins && (i >= 'A') && (i <= 'Z')) - ecgroup[i] = ecgroup[clower (i)]; - - ecgroup[i] = ABS (ecgroup[i]); - mkdata (ecgroup[i]); - } - - dataend (); - - if (trace) { - fputs (_("\n\nEquivalence Classes:\n\n"), stderr); - - numrows = csize / 8; - - for (j = 0; j < numrows; ++j) { - for (i = j; i < csize; i = i + numrows) { - fprintf (stderr, "%4s = %-2d", - readable_form (i), ecgroup[i]); - - putc (' ', stderr); - } - - putc ('\n', stderr); - } - } -} - - -/* Generate the code to find the action number. */ - -void gen_find_action () -{ - if (fullspd) - indent_puts ("yy_act = yy_current_state[-1].yy_nxt;"); - - else if (fulltbl) - indent_puts ("yy_act = yy_accept[yy_current_state];"); - - else if (reject) { - indent_puts ("yy_current_state = *--YY_G(yy_state_ptr);"); - indent_puts ("YY_G(yy_lp) = yy_accept[yy_current_state];"); - - outn ("find_rule: /* we branch to this label when backing up */"); - - indent_puts - ("for ( ; ; ) /* until we find what rule we matched */"); - - indent_up (); - - indent_puts ("{"); - - indent_puts - ("if ( YY_G(yy_lp) && YY_G(yy_lp) < yy_accept[yy_current_state + 1] )"); - indent_up (); - indent_puts ("{"); - indent_puts ("yy_act = yy_acclist[YY_G(yy_lp)];"); - - if (variable_trailing_context_rules) { - indent_puts - ("if ( yy_act & YY_TRAILING_HEAD_MASK ||"); - indent_puts (" yy_looking_for_trail_begin )"); - indent_up (); - indent_puts ("{"); - - indent_puts - ("if ( yy_act == yy_looking_for_trail_begin )"); - indent_up (); - indent_puts ("{"); - indent_puts ("yy_looking_for_trail_begin = 0;"); - indent_puts ("yy_act &= ~YY_TRAILING_HEAD_MASK;"); - indent_puts ("break;"); - indent_puts ("}"); - indent_down (); - - indent_puts ("}"); - indent_down (); - - indent_puts - ("else if ( yy_act & YY_TRAILING_MASK )"); - indent_up (); - indent_puts ("{"); - indent_puts - ("yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;"); - indent_puts - ("yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;"); - - if (real_reject) { - /* Remember matched text in case we back up - * due to REJECT. - */ - indent_puts - ("YY_G(yy_full_match) = yy_cp;"); - indent_puts - ("yy_full_state = YY_G(yy_state_ptr);"); - indent_puts ("yy_full_lp = YY_G(yy_lp);"); - } - - indent_puts ("}"); - indent_down (); - - indent_puts ("else"); - indent_up (); - indent_puts ("{"); - indent_puts ("YY_G(yy_full_match) = yy_cp;"); - indent_puts - ("yy_full_state = YY_G(yy_state_ptr);"); - indent_puts ("yy_full_lp = YY_G(yy_lp);"); - indent_puts ("break;"); - indent_puts ("}"); - indent_down (); - - indent_puts ("++YY_G(yy_lp);"); - indent_puts ("goto find_rule;"); - } - - else { - /* Remember matched text in case we back up due to - * trailing context plus REJECT. - */ - indent_up (); - indent_puts ("{"); - indent_puts ("YY_G(yy_full_match) = yy_cp;"); - indent_puts ("break;"); - indent_puts ("}"); - indent_down (); - } - - indent_puts ("}"); - indent_down (); - - indent_puts ("--yy_cp;"); - - /* We could consolidate the following two lines with those at - * the beginning, but at the cost of complaints that we're - * branching inside a loop. - */ - indent_puts ("yy_current_state = *--YY_G(yy_state_ptr);"); - indent_puts ("YY_G(yy_lp) = yy_accept[yy_current_state];"); - - indent_puts ("}"); - - indent_down (); - } - - else { /* compressed */ - indent_puts ("yy_act = yy_accept[yy_current_state];"); - - if (interactive && !reject) { - /* Do the guaranteed-needed backing up to figure out - * the match. - */ - indent_puts ("if ( yy_act == 0 )"); - indent_up (); - indent_puts ("{ /* have to back up */"); - indent_puts - ("yy_cp = YY_G(yy_last_accepting_cpos);"); - indent_puts - ("yy_current_state = YY_G(yy_last_accepting_state);"); - indent_puts - ("yy_act = yy_accept[yy_current_state];"); - indent_puts ("}"); - indent_down (); - } - } -} - -/* mkftbl - make the full table and return the struct . - * you should call mkecstbl() after this. - */ - -struct yytbl_data *mkftbl (void) -{ - register int i; - int end_of_buffer_action = num_rules + 1; - struct yytbl_data *tbl; - flex_int32_t *tdata = 0; - - tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data)); - yytbl_data_init (tbl, YYTD_ID_ACCEPT); - tbl->td_flags |= YYTD_DATA32; - tbl->td_hilen = 0; /* it's a one-dimensional array */ - tbl->td_lolen = lastdfa + 1; - - tbl->td_data = tdata = - (flex_int32_t *) calloc (tbl->td_lolen, sizeof (flex_int32_t)); - - dfaacc[end_of_buffer_state].dfaacc_state = end_of_buffer_action; - - for (i = 1; i <= lastdfa; ++i) { - register int anum = dfaacc[i].dfaacc_state; - - tdata[i] = anum; - - if (trace && anum) - fprintf (stderr, _("state # %d accepts: [%d]\n"), - i, anum); - } - - buf_prints (&yydmap_buf, - "\t{YYTD_ID_ACCEPT, (void**)&yy_accept, sizeof(%s)},\n", - long_align ? "flex_int32_t" : "flex_int16_t"); - return tbl; -} - - -/* genftbl - generate full transition table */ - -void genftbl () -{ - register int i; - int end_of_buffer_action = num_rules + 1; - - out_str_dec (long_align ? get_int32_decl () : get_int16_decl (), - "yy_accept", lastdfa + 1); - - dfaacc[end_of_buffer_state].dfaacc_state = end_of_buffer_action; - - for (i = 1; i <= lastdfa; ++i) { - register int anum = dfaacc[i].dfaacc_state; - - mkdata (anum); - - if (trace && anum) - fprintf (stderr, _("state # %d accepts: [%d]\n"), - i, anum); - } - - dataend (); - - if (useecs) - genecs (); - - /* Don't have to dump the actual full table entries - they were - * created on-the-fly. - */ -} - - -/* Generate the code to find the next compressed-table state. */ - -void gen_next_compressed_state (char_map) - char *char_map; -{ - indent_put2s ("register YY_CHAR yy_c = %s;", char_map); - - /* Save the backing-up info \before/ computing the next state - * because we always compute one more state than needed - we - * always proceed until we reach a jam state - */ - gen_backing_up (); - - indent_puts - ("while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )"); - indent_up (); - indent_puts ("{"); - indent_puts ("yy_current_state = (int) yy_def[yy_current_state];"); - - if (usemecs) { - /* We've arrange it so that templates are never chained - * to one another. This means we can afford to make a - * very simple test to see if we need to convert to - * yy_c's meta-equivalence class without worrying - * about erroneously looking up the meta-equivalence - * class twice - */ - do_indent (); - - /* lastdfa + 2 is the beginning of the templates */ - out_dec ("if ( yy_current_state >= %d )\n", lastdfa + 2); - - indent_up (); - indent_puts ("yy_c = yy_meta[(unsigned int) yy_c];"); - indent_down (); - } - - indent_puts ("}"); - indent_down (); - - indent_puts - ("yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];"); -} - - -/* Generate the code to find the next match. */ - -void gen_next_match () -{ - /* NOTE - changes in here should be reflected in gen_next_state() and - * gen_NUL_trans(). - */ - char *char_map = useecs ? - "yy_ec[YY_SC_TO_UI(*yy_cp)] " : "YY_SC_TO_UI(*yy_cp)"; - - char *char_map_2 = useecs ? - "yy_ec[YY_SC_TO_UI(*++yy_cp)] " : "YY_SC_TO_UI(*++yy_cp)"; - - if (fulltbl) { - if (gentables) - indent_put2s - ("while ( (yy_current_state = yy_nxt[yy_current_state][ %s ]) > 0 )", - char_map); - else - indent_put2s - ("while ( (yy_current_state = yy_nxt[yy_current_state*YY_NXT_LOLEN + %s ]) > 0 )", - char_map); - - indent_up (); - - if (num_backing_up > 0) { - indent_puts ("{"); - gen_backing_up (); - outc ('\n'); - } - - indent_puts ("++yy_cp;"); - - if (num_backing_up > 0) - - indent_puts ("}"); - - indent_down (); - - outc ('\n'); - indent_puts ("yy_current_state = -yy_current_state;"); - } - - else if (fullspd) { - indent_puts ("{"); - indent_puts - ("register yyconst struct yy_trans_info *yy_trans_info;\n"); - indent_puts ("register YY_CHAR yy_c;\n"); - indent_put2s ("for ( yy_c = %s;", char_map); - indent_puts - (" (yy_trans_info = &yy_current_state[(unsigned int) yy_c])->"); - indent_puts ("yy_verify == yy_c;"); - indent_put2s (" yy_c = %s )", char_map_2); - - indent_up (); - - if (num_backing_up > 0) - indent_puts ("{"); - - indent_puts ("yy_current_state += yy_trans_info->yy_nxt;"); - - if (num_backing_up > 0) { - outc ('\n'); - gen_backing_up (); - indent_puts ("}"); - } - - indent_down (); - indent_puts ("}"); - } - - else { /* compressed */ - indent_puts ("do"); - - indent_up (); - indent_puts ("{"); - - gen_next_state (false); - - indent_puts ("++yy_cp;"); - - - indent_puts ("}"); - indent_down (); - - do_indent (); - - if (interactive) - out_dec ("while ( yy_base[yy_current_state] != %d );\n", jambase); - else - out_dec ("while ( yy_current_state != %d );\n", - jamstate); - - if (!reject && !interactive) { - /* Do the guaranteed-needed backing up to figure out - * the match. - */ - indent_puts - ("yy_cp = YY_G(yy_last_accepting_cpos);"); - indent_puts - ("yy_current_state = YY_G(yy_last_accepting_state);"); - } - } -} - - -/* Generate the code to find the next state. */ - -void gen_next_state (worry_about_NULs) - int worry_about_NULs; -{ /* NOTE - changes in here should be reflected in gen_next_match() */ - char char_map[256]; - - if (worry_about_NULs && !nultrans) { - if (useecs) - (void) sprintf (char_map, - "(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : %d)", - NUL_ec); - else - (void) sprintf (char_map, - "(*yy_cp ? YY_SC_TO_UI(*yy_cp) : %d)", - NUL_ec); - } - - else - strcpy (char_map, useecs ? - "yy_ec[YY_SC_TO_UI(*yy_cp)]" : - "YY_SC_TO_UI(*yy_cp)"); - - if (worry_about_NULs && nultrans) { - if (!fulltbl && !fullspd) - /* Compressed tables back up *before* they match. */ - gen_backing_up (); - - indent_puts ("if ( *yy_cp )"); - indent_up (); - indent_puts ("{"); - } - - if (fulltbl) { - if (gentables) - indent_put2s - ("yy_current_state = yy_nxt[yy_current_state][%s];", - char_map); - else - indent_put2s - ("yy_current_state = yy_nxt[yy_current_state*YY_NXT_LOLEN + %s];", - char_map); - } - - else if (fullspd) - indent_put2s - ("yy_current_state += yy_current_state[%s].yy_nxt;", - char_map); - - else - gen_next_compressed_state (char_map); - - if (worry_about_NULs && nultrans) { - - indent_puts ("}"); - indent_down (); - indent_puts ("else"); - indent_up (); - indent_puts - ("yy_current_state = yy_NUL_trans[yy_current_state];"); - indent_down (); - } - - if (fullspd || fulltbl) - gen_backing_up (); - - if (reject) - indent_puts ("*YY_G(yy_state_ptr)++ = yy_current_state;"); -} - - -/* Generate the code to make a NUL transition. */ - -void gen_NUL_trans () -{ /* NOTE - changes in here should be reflected in gen_next_match() */ - /* Only generate a definition for "yy_cp" if we'll generate code - * that uses it. Otherwise lint and the like complain. - */ - int need_backing_up = (num_backing_up > 0 && !reject); - - if (need_backing_up && (!nultrans || fullspd || fulltbl)) - /* We're going to need yy_cp lying around for the call - * below to gen_backing_up(). - */ - indent_puts ("register char *yy_cp = YY_G(yy_c_buf_p);"); - - outc ('\n'); - - if (nultrans) { - indent_puts - ("yy_current_state = yy_NUL_trans[yy_current_state];"); - indent_puts ("yy_is_jam = (yy_current_state == 0);"); - } - - else if (fulltbl) { - do_indent (); - if (gentables) - out_dec ("yy_current_state = yy_nxt[yy_current_state][%d];\n", NUL_ec); - else - out_dec ("yy_current_state = yy_nxt[yy_current_state*YY_NXT_LOLEN + %d];\n", NUL_ec); - indent_puts ("yy_is_jam = (yy_current_state <= 0);"); - } - - else if (fullspd) { - do_indent (); - out_dec ("register int yy_c = %d;\n", NUL_ec); - - indent_puts - ("register yyconst struct yy_trans_info *yy_trans_info;\n"); - indent_puts - ("yy_trans_info = &yy_current_state[(unsigned int) yy_c];"); - indent_puts ("yy_current_state += yy_trans_info->yy_nxt;"); - - indent_puts - ("yy_is_jam = (yy_trans_info->yy_verify != yy_c);"); - } - - else { - char NUL_ec_str[20]; - - (void) sprintf (NUL_ec_str, "%d", NUL_ec); - gen_next_compressed_state (NUL_ec_str); - - do_indent (); - out_dec ("yy_is_jam = (yy_current_state == %d);\n", - jamstate); - - if (reject) { - /* Only stack this state if it's a transition we - * actually make. If we stack it on a jam, then - * the state stack and yy_c_buf_p get out of sync. - */ - indent_puts ("if ( ! yy_is_jam )"); - indent_up (); - indent_puts - ("*YY_G(yy_state_ptr)++ = yy_current_state;"); - indent_down (); - } - } - - /* If we've entered an accepting state, back up; note that - * compressed tables have *already* done such backing up, so - * we needn't bother with it again. - */ - if (need_backing_up && (fullspd || fulltbl)) { - outc ('\n'); - indent_puts ("if ( ! yy_is_jam )"); - indent_up (); - indent_puts ("{"); - gen_backing_up (); - indent_puts ("}"); - indent_down (); - } -} - - -/* Generate the code to find the start state. */ - -void gen_start_state () -{ - if (fullspd) { - if (bol_needed) { - indent_puts - ("yy_current_state = yy_start_state_list[YY_G(yy_start) + YY_AT_BOL()];"); - } - else - indent_puts - ("yy_current_state = yy_start_state_list[YY_G(yy_start)];"); - } - - else { - indent_puts ("yy_current_state = YY_G(yy_start);"); - - if (bol_needed) - indent_puts ("yy_current_state += YY_AT_BOL();"); - - if (reject) { - /* Set up for storing up states. */ - outn ("m4_ifdef( [[M4_YY_USES_REJECT]],\n[["); - indent_puts - ("YY_G(yy_state_ptr) = YY_G(yy_state_buf);"); - indent_puts - ("*YY_G(yy_state_ptr)++ = yy_current_state;"); - outn ("]])"); - } - } -} - - -/* gentabs - generate data statements for the transition tables */ - -void gentabs () -{ - int i, j, k, *accset, nacc, *acc_array, total_states; - int end_of_buffer_action = num_rules + 1; - struct yytbl_data *yyacc_tbl = 0, *yymeta_tbl = 0, *yybase_tbl = 0, - *yydef_tbl = 0, *yynxt_tbl = 0, *yychk_tbl = 0, *yyacclist_tbl=0; - flex_int32_t *yyacc_data = 0, *yybase_data = 0, *yydef_data = 0, - *yynxt_data = 0, *yychk_data = 0, *yyacclist_data=0; - flex_int32_t yybase_curr = 0, yyacclist_curr=0,yyacc_curr=0; - - acc_array = allocate_integer_array (current_max_dfas); - nummt = 0; - - /* The compressed table format jams by entering the "jam state", - * losing information about the previous state in the process. - * In order to recover the previous state, we effectively need - * to keep backing-up information. - */ - ++num_backing_up; - - if (reject) { - /* Write out accepting list and pointer list. - - * First we generate the "yy_acclist" array. In the process, - * we compute the indices that will go into the "yy_accept" - * array, and save the indices in the dfaacc array. - */ - int EOB_accepting_list[2]; - - /* Set up accepting structures for the End Of Buffer state. */ - EOB_accepting_list[0] = 0; - EOB_accepting_list[1] = end_of_buffer_action; - accsiz[end_of_buffer_state] = 1; - dfaacc[end_of_buffer_state].dfaacc_set = - EOB_accepting_list; - - out_str_dec (long_align ? get_int32_decl () : - get_int16_decl (), "yy_acclist", MAX (numas, - 1) + 1); - - buf_prints (&yydmap_buf, - "\t{YYTD_ID_ACCLIST, (void**)&yy_acclist, sizeof(%s)},\n", - long_align ? "flex_int32_t" : "flex_int16_t"); - - yyacclist_tbl = (struct yytbl_data*)calloc(1,sizeof(struct yytbl_data)); - yytbl_data_init (yyacclist_tbl, YYTD_ID_ACCLIST); - yyacclist_tbl->td_lolen = MAX(numas,1) + 1; - yyacclist_tbl->td_data = yyacclist_data = - (flex_int32_t *) calloc (yyacclist_tbl->td_lolen, sizeof (flex_int32_t)); - yyacclist_curr = 1; - - j = 1; /* index into "yy_acclist" array */ - - for (i = 1; i <= lastdfa; ++i) { - acc_array[i] = j; - - if (accsiz[i] != 0) { - accset = dfaacc[i].dfaacc_set; - nacc = accsiz[i]; - - if (trace) - fprintf (stderr, - _("state # %d accepts: "), - i); - - for (k = 1; k <= nacc; ++k) { - int accnum = accset[k]; - - ++j; - - if (variable_trailing_context_rules - && !(accnum & - YY_TRAILING_HEAD_MASK) - && accnum > 0 - && accnum <= num_rules - && rule_type[accnum] == - RULE_VARIABLE) { - /* Special hack to flag - * accepting number as part - * of trailing context rule. - */ - accnum |= YY_TRAILING_MASK; - } - - mkdata (accnum); - yyacclist_data[yyacclist_curr++] = accnum; - - if (trace) { - fprintf (stderr, "[%d]", - accset[k]); - - if (k < nacc) - fputs (", ", - stderr); - else - putc ('\n', - stderr); - } - } - } - } - - /* add accepting number for the "jam" state */ - acc_array[i] = j; - - dataend (); - if (tablesext) { - yytbl_data_compress (yyacclist_tbl); - if (yytbl_data_fwrite (&tableswr, yyacclist_tbl) < 0) - flexerror (_("Could not write yyacclist_tbl")); - yytbl_data_destroy (yyacclist_tbl); - yyacclist_tbl = NULL; - } - } - - else { - dfaacc[end_of_buffer_state].dfaacc_state = - end_of_buffer_action; - - for (i = 1; i <= lastdfa; ++i) - acc_array[i] = dfaacc[i].dfaacc_state; - - /* add accepting number for jam state */ - acc_array[i] = 0; - } - - /* Begin generating yy_accept */ - - /* Spit out "yy_accept" array. If we're doing "reject", it'll be - * pointers into the "yy_acclist" array. Otherwise it's actual - * accepting numbers. In either case, we just dump the numbers. - */ - - /* "lastdfa + 2" is the size of "yy_accept"; includes room for C arrays - * beginning at 0 and for "jam" state. - */ - k = lastdfa + 2; - - if (reject) - /* We put a "cap" on the table associating lists of accepting - * numbers with state numbers. This is needed because we tell - * where the end of an accepting list is by looking at where - * the list for the next state starts. - */ - ++k; - - out_str_dec (long_align ? get_int32_decl () : get_int16_decl (), - "yy_accept", k); - - buf_prints (&yydmap_buf, - "\t{YYTD_ID_ACCEPT, (void**)&yy_accept, sizeof(%s)},\n", - long_align ? "flex_int32_t" : "flex_int16_t"); - - yyacc_tbl = - (struct yytbl_data *) calloc (1, - sizeof (struct yytbl_data)); - yytbl_data_init (yyacc_tbl, YYTD_ID_ACCEPT); - yyacc_tbl->td_lolen = k; - yyacc_tbl->td_data = yyacc_data = - (flex_int32_t *) calloc (yyacc_tbl->td_lolen, sizeof (flex_int32_t)); - yyacc_curr=1; - - for (i = 1; i <= lastdfa; ++i) { - mkdata (acc_array[i]); - yyacc_data[yyacc_curr++] = acc_array[i]; - - if (!reject && trace && acc_array[i]) - fprintf (stderr, _("state # %d accepts: [%d]\n"), - i, acc_array[i]); - } - - /* Add entry for "jam" state. */ - mkdata (acc_array[i]); - yyacc_data[yyacc_curr++] = acc_array[i]; - - if (reject) { - /* Add "cap" for the list. */ - mkdata (acc_array[i]); - yyacc_data[yyacc_curr++] = acc_array[i]; - } - - dataend (); - if (tablesext) { - yytbl_data_compress (yyacc_tbl); - if (yytbl_data_fwrite (&tableswr, yyacc_tbl) < 0) - flexerror (_("Could not write yyacc_tbl")); - yytbl_data_destroy (yyacc_tbl); - yyacc_tbl = NULL; - } - /* End generating yy_accept */ - - if (useecs) { - - genecs (); - if (tablesext) { - struct yytbl_data *tbl; - - tbl = mkecstbl (); - yytbl_data_compress (tbl); - if (yytbl_data_fwrite (&tableswr, tbl) < 0) - flexerror (_("Could not write ecstbl")); - yytbl_data_destroy (tbl); - tbl = 0; - } - } - - if (usemecs) { - /* Begin generating yy_meta */ - /* Write out meta-equivalence classes (used to index - * templates with). - */ - flex_int32_t *yymecs_data = 0; - yymeta_tbl = - (struct yytbl_data *) calloc (1, - sizeof (struct - yytbl_data)); - yytbl_data_init (yymeta_tbl, YYTD_ID_META); - yymeta_tbl->td_lolen = numecs + 1; - yymeta_tbl->td_data = yymecs_data = - (flex_int32_t *) calloc (yymeta_tbl->td_lolen, - sizeof (flex_int32_t)); - - if (trace) - fputs (_("\n\nMeta-Equivalence Classes:\n"), - stderr); - - out_str_dec (get_int32_decl (), "yy_meta", numecs + 1); - buf_prints (&yydmap_buf, - "\t{YYTD_ID_META, (void**)&yy_meta, sizeof(%s)},\n", - "flex_int32_t"); - - for (i = 1; i <= numecs; ++i) { - if (trace) - fprintf (stderr, "%d = %d\n", - i, ABS (tecbck[i])); - - mkdata (ABS (tecbck[i])); - yymecs_data[i] = ABS (tecbck[i]); - } - - dataend (); - if (tablesext) { - yytbl_data_compress (yymeta_tbl); - if (yytbl_data_fwrite (&tableswr, yymeta_tbl) < 0) - flexerror (_ - ("Could not write yymeta_tbl")); - yytbl_data_destroy (yymeta_tbl); - yymeta_tbl = NULL; - } - /* End generating yy_meta */ - } - - total_states = lastdfa + numtemps; - - /* Begin generating yy_base */ - out_str_dec ((tblend >= INT16_MAX || long_align) ? - get_int32_decl () : get_int16_decl (), - "yy_base", total_states + 1); - - buf_prints (&yydmap_buf, - "\t{YYTD_ID_BASE, (void**)&yy_base, sizeof(%s)},\n", - (tblend >= INT16_MAX - || long_align) ? "flex_int32_t" : "flex_int16_t"); - yybase_tbl = - (struct yytbl_data *) calloc (1, - sizeof (struct yytbl_data)); - yytbl_data_init (yybase_tbl, YYTD_ID_BASE); - yybase_tbl->td_lolen = total_states + 1; - yybase_tbl->td_data = yybase_data = - (flex_int32_t *) calloc (yybase_tbl->td_lolen, - sizeof (flex_int32_t)); - yybase_curr = 1; - - for (i = 1; i <= lastdfa; ++i) { - register int d = def[i]; - - if (base[i] == JAMSTATE) - base[i] = jambase; - - if (d == JAMSTATE) - def[i] = jamstate; - - else if (d < 0) { - /* Template reference. */ - ++tmpuses; - def[i] = lastdfa - d + 1; - } - - mkdata (base[i]); - yybase_data[yybase_curr++] = base[i]; - } - - /* Generate jam state's base index. */ - mkdata (base[i]); - yybase_data[yybase_curr++] = base[i]; - - for (++i /* skip jam state */ ; i <= total_states; ++i) { - mkdata (base[i]); - yybase_data[yybase_curr++] = base[i]; - def[i] = jamstate; - } - - dataend (); - if (tablesext) { - yytbl_data_compress (yybase_tbl); - if (yytbl_data_fwrite (&tableswr, yybase_tbl) < 0) - flexerror (_("Could not write yybase_tbl")); - yytbl_data_destroy (yybase_tbl); - yybase_tbl = NULL; - } - /* End generating yy_base */ - - - /* Begin generating yy_def */ - out_str_dec ((total_states >= INT16_MAX || long_align) ? - get_int32_decl () : get_int16_decl (), - "yy_def", total_states + 1); - - buf_prints (&yydmap_buf, - "\t{YYTD_ID_DEF, (void**)&yy_def, sizeof(%s)},\n", - (total_states >= INT16_MAX - || long_align) ? "flex_int32_t" : "flex_int16_t"); - - yydef_tbl = - (struct yytbl_data *) calloc (1, - sizeof (struct yytbl_data)); - yytbl_data_init (yydef_tbl, YYTD_ID_DEF); - yydef_tbl->td_lolen = total_states + 1; - yydef_tbl->td_data = yydef_data = - (flex_int32_t *) calloc (yydef_tbl->td_lolen, sizeof (flex_int32_t)); - - for (i = 1; i <= total_states; ++i) { - mkdata (def[i]); - yydef_data[i] = def[i]; - } - - dataend (); - if (tablesext) { - yytbl_data_compress (yydef_tbl); - if (yytbl_data_fwrite (&tableswr, yydef_tbl) < 0) - flexerror (_("Could not write yydef_tbl")); - yytbl_data_destroy (yydef_tbl); - yydef_tbl = NULL; - } - /* End generating yy_def */ - - - /* Begin generating yy_nxt */ - out_str_dec ((total_states >= INT16_MAX || long_align) ? - get_int32_decl () : get_int16_decl (), "yy_nxt", - tblend + 1); - - buf_prints (&yydmap_buf, - "\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n", - (total_states >= INT16_MAX - || long_align) ? "flex_int32_t" : "flex_int16_t"); - - yynxt_tbl = - (struct yytbl_data *) calloc (1, - sizeof (struct yytbl_data)); - yytbl_data_init (yynxt_tbl, YYTD_ID_NXT); - yynxt_tbl->td_lolen = tblend + 1; - yynxt_tbl->td_data = yynxt_data = - (flex_int32_t *) calloc (yynxt_tbl->td_lolen, sizeof (flex_int32_t)); - - for (i = 1; i <= tblend; ++i) { - /* Note, the order of the following test is important. - * If chk[i] is 0, then nxt[i] is undefined. - */ - if (chk[i] == 0 || nxt[i] == 0) - nxt[i] = jamstate; /* new state is the JAM state */ - - mkdata (nxt[i]); - yynxt_data[i] = nxt[i]; - } - - dataend (); - if (tablesext) { - yytbl_data_compress (yynxt_tbl); - if (yytbl_data_fwrite (&tableswr, yynxt_tbl) < 0) - flexerror (_("Could not write yynxt_tbl")); - yytbl_data_destroy (yynxt_tbl); - yynxt_tbl = NULL; - } - /* End generating yy_nxt */ - - /* Begin generating yy_chk */ - out_str_dec ((total_states >= INT16_MAX || long_align) ? - get_int32_decl () : get_int16_decl (), "yy_chk", - tblend + 1); - - buf_prints (&yydmap_buf, - "\t{YYTD_ID_CHK, (void**)&yy_chk, sizeof(%s)},\n", - (total_states >= INT16_MAX - || long_align) ? "flex_int32_t" : "flex_int16_t"); - - yychk_tbl = - (struct yytbl_data *) calloc (1, - sizeof (struct yytbl_data)); - yytbl_data_init (yychk_tbl, YYTD_ID_CHK); - yychk_tbl->td_lolen = tblend + 1; - yychk_tbl->td_data = yychk_data = - (flex_int32_t *) calloc (yychk_tbl->td_lolen, sizeof (flex_int32_t)); - - for (i = 1; i <= tblend; ++i) { - if (chk[i] == 0) - ++nummt; - - mkdata (chk[i]); - yychk_data[i] = chk[i]; - } - - dataend (); - if (tablesext) { - yytbl_data_compress (yychk_tbl); - if (yytbl_data_fwrite (&tableswr, yychk_tbl) < 0) - flexerror (_("Could not write yychk_tbl")); - yytbl_data_destroy (yychk_tbl); - yychk_tbl = NULL; - } - /* End generating yy_chk */ - - flex_free ((void *) acc_array); -} - - -/* Write out a formatted string (with a secondary string argument) at the - * current indentation level, adding a final newline. - */ - -void indent_put2s (fmt, arg) - const char *fmt, *arg; -{ - do_indent (); - out_str (fmt, arg); - outn (""); -} - - -/* Write out a string at the current indentation level, adding a final - * newline. - */ - -void indent_puts (str) - const char *str; -{ - do_indent (); - outn (str); -} - - -/* make_tables - generate transition tables and finishes generating output file - */ - -void make_tables () -{ - register int i; - int did_eof_rule = false; - struct yytbl_data *yynultrans_tbl; - - - skelout (); /* %% [2.0] - break point in skel */ - - /* First, take care of YY_DO_BEFORE_ACTION depending on yymore - * being used. - */ - set_indent (1); - - if (yymore_used && !yytext_is_array) { - indent_puts ("YY_G(yytext_ptr) -= YY_G(yy_more_len); \\"); - indent_puts - ("yyleng = (size_t) (yy_cp - YY_G(yytext_ptr)); \\"); - } - - else - indent_puts ("yyleng = (size_t) (yy_cp - yy_bp); \\"); - - /* Now also deal with copying yytext_ptr to yytext if needed. */ - skelout (); /* %% [3.0] - break point in skel */ - if (yytext_is_array) { - if (yymore_used) - indent_puts - ("if ( yyleng + YY_G(yy_more_offset) >= YYLMAX ) \\"); - else - indent_puts ("if ( yyleng >= YYLMAX ) \\"); - - indent_up (); - indent_puts - ("YY_FATAL_ERROR( \"token too large, exceeds YYLMAX\" ); \\"); - indent_down (); - - if (yymore_used) { - indent_puts - ("yy_flex_strncpy( &yytext[YY_G(yy_more_offset)], YY_G(yytext_ptr), yyleng + 1 M4_YY_CALL_LAST_ARG); \\"); - indent_puts ("yyleng += YY_G(yy_more_offset); \\"); - indent_puts - ("YY_G(yy_prev_more_offset) = YY_G(yy_more_offset); \\"); - indent_puts ("YY_G(yy_more_offset) = 0; \\"); - } - else { - indent_puts - ("yy_flex_strncpy( yytext, YY_G(yytext_ptr), yyleng + 1 M4_YY_CALL_LAST_ARG); \\"); - } - } - - set_indent (0); - - skelout (); /* %% [4.0] - break point in skel */ - - - /* This is where we REALLY begin generating the tables. */ - - out_dec ("#define YY_NUM_RULES %d\n", num_rules); - out_dec ("#define YY_END_OF_BUFFER %d\n", num_rules + 1); - - if (fullspd) { - /* Need to define the transet type as a size large - * enough to hold the biggest offset. - */ - int total_table_size = tblend + numecs + 1; - char *trans_offset_type = - (total_table_size >= INT16_MAX || long_align) ? - "flex_int32_t" : "flex_int16_t"; - - set_indent (0); - indent_puts ("struct yy_trans_info"); - indent_up (); - indent_puts ("{"); - - /* We require that yy_verify and yy_nxt must be of the same size int. */ - indent_put2s ("%s yy_verify;", trans_offset_type); - - /* In cases where its sister yy_verify *is* a "yes, there is - * a transition", yy_nxt is the offset (in records) to the - * next state. In most cases where there is no transition, - * the value of yy_nxt is irrelevant. If yy_nxt is the -1th - * record of a state, though, then yy_nxt is the action number - * for that state. - */ - - indent_put2s ("%s yy_nxt;", trans_offset_type); - indent_puts ("};"); - indent_down (); - } - else { - /* We generate a bogus 'struct yy_trans_info' data type - * so we can guarantee that it is always declared in the skel. - * This is so we can compile "sizeof(struct yy_trans_info)" - * in any scanner. - */ - indent_puts - ("/* This struct is not used in this scanner,"); - indent_puts (" but its presence is necessary. */"); - indent_puts ("struct yy_trans_info"); - indent_up (); - indent_puts ("{"); - indent_puts ("flex_int32_t yy_verify;"); - indent_puts ("flex_int32_t yy_nxt;"); - indent_puts ("};"); - indent_down (); - } - - if (fullspd) { - genctbl (); - if (tablesext) { - struct yytbl_data *tbl; - - tbl = mkctbl (); - yytbl_data_compress (tbl); - if (yytbl_data_fwrite (&tableswr, tbl) < 0) - flexerror (_("Could not write ftbl")); - yytbl_data_destroy (tbl); - - tbl = mkssltbl (); - yytbl_data_compress (tbl); - if (yytbl_data_fwrite (&tableswr, tbl) < 0) - flexerror (_("Could not write ssltbl")); - yytbl_data_destroy (tbl); - tbl = 0; - - if (useecs) { - tbl = mkecstbl (); - yytbl_data_compress (tbl); - if (yytbl_data_fwrite (&tableswr, tbl) < 0) - flexerror (_ - ("Could not write ecstbl")); - yytbl_data_destroy (tbl); - tbl = 0; - } - } - } - else if (fulltbl) { - genftbl (); - if (tablesext) { - struct yytbl_data *tbl; - - tbl = mkftbl (); - yytbl_data_compress (tbl); - if (yytbl_data_fwrite (&tableswr, tbl) < 0) - flexerror (_("Could not write ftbl")); - yytbl_data_destroy (tbl); - tbl = 0; - - if (useecs) { - tbl = mkecstbl (); - yytbl_data_compress (tbl); - if (yytbl_data_fwrite (&tableswr, tbl) < 0) - flexerror (_ - ("Could not write ecstbl")); - yytbl_data_destroy (tbl); - tbl = 0; - } - } - } - else - gentabs (); - - if (do_yylineno) { - - geneoltbl (); - - if (tablesext) { - struct yytbl_data *tbl; - - tbl = mkeoltbl (); - yytbl_data_compress (tbl); - if (yytbl_data_fwrite (&tableswr, tbl) < 0) - flexerror (_("Could not write eoltbl")); - yytbl_data_destroy (tbl); - tbl = 0; - } - } - - /* Definitions for backing up. We don't need them if REJECT - * is being used because then we use an alternative backin-up - * technique instead. - */ - if (num_backing_up > 0 && !reject) { - if (!C_plus_plus && !reentrant) { - indent_puts - ("static yy_state_type yy_last_accepting_state;"); - indent_puts - ("static char *yy_last_accepting_cpos;\n"); - } - } - - if (nultrans) { - flex_int32_t *yynultrans_data = 0; - - /* Begin generating yy_NUL_trans */ - out_str_dec (get_state_decl (), "yy_NUL_trans", - lastdfa + 1); - buf_prints (&yydmap_buf, - "\t{YYTD_ID_NUL_TRANS, (void**)&yy_NUL_trans, sizeof(%s)},\n", - (fullspd) ? "struct yy_trans_info*" : - "flex_int32_t"); - - yynultrans_tbl = - (struct yytbl_data *) calloc (1, - sizeof (struct - yytbl_data)); - yytbl_data_init (yynultrans_tbl, YYTD_ID_NUL_TRANS); - if (fullspd) - yynultrans_tbl->td_flags |= YYTD_PTRANS; - yynultrans_tbl->td_lolen = lastdfa + 1; - yynultrans_tbl->td_data = yynultrans_data = - (flex_int32_t *) calloc (yynultrans_tbl->td_lolen, - sizeof (flex_int32_t)); - - for (i = 1; i <= lastdfa; ++i) { - if (fullspd) { - out_dec (" &yy_transition[%d],\n", - base[i]); - yynultrans_data[i] = base[i]; - } - else { - mkdata (nultrans[i]); - yynultrans_data[i] = nultrans[i]; - } - } - - dataend (); - if (tablesext) { - yytbl_data_compress (yynultrans_tbl); - if (yytbl_data_fwrite (&tableswr, yynultrans_tbl) < - 0) - flexerror (_ - ("Could not write yynultrans_tbl")); - yytbl_data_destroy (yynultrans_tbl); - yynultrans_tbl = NULL; - } - /* End generating yy_NUL_trans */ - } - - if (!C_plus_plus && !reentrant) { - indent_puts ("extern int yy_flex_debug;"); - indent_put2s ("int yy_flex_debug = %s;\n", - ddebug ? "1" : "0"); - } - - if (ddebug) { /* Spit out table mapping rules to line numbers. */ - out_str_dec (long_align ? get_int32_decl () : - get_int16_decl (), "yy_rule_linenum", - num_rules); - for (i = 1; i < num_rules; ++i) - mkdata (rule_linenum[i]); - dataend (); - } - - if (reject) { - outn ("m4_ifdef( [[M4_YY_USES_REJECT]],\n[["); - /* Declare state buffer variables. */ - if (!C_plus_plus && !reentrant) { - outn ("static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;"); - outn ("static char *yy_full_match;"); - outn ("static int yy_lp;"); - } - - if (variable_trailing_context_rules) { - if (!C_plus_plus) { - outn ("static int yy_looking_for_trail_begin = 0;"); - outn ("static int yy_full_lp;"); - outn ("static int *yy_full_state;"); - } - - out_hex ("#define YY_TRAILING_MASK 0x%x\n", - (unsigned int) YY_TRAILING_MASK); - out_hex ("#define YY_TRAILING_HEAD_MASK 0x%x\n", - (unsigned int) YY_TRAILING_HEAD_MASK); - } - - outn ("#define REJECT \\"); - outn ("{ \\"); - outn ("*yy_cp = YY_G(yy_hold_char); /* undo effects of setting up yytext */ \\"); - outn ("yy_cp = YY_G(yy_full_match); /* restore poss. backed-over text */ \\"); - - if (variable_trailing_context_rules) { - outn ("YY_G(yy_lp) = yy_full_lp; /* restore orig. accepting pos. */ \\"); - outn ("YY_G(yy_state_ptr) = yy_full_state; /* restore orig. state */ \\"); - outn ("yy_current_state = *YY_G(yy_state_ptr); /* restore curr. state */ \\"); - } - - outn ("++YY_G(yy_lp); \\"); - outn ("goto find_rule; \\"); - - outn ("}"); - outn ("]])\n"); - } - - else { - outn ("/* The intent behind this definition is that it'll catch"); - outn (" * any uses of REJECT which flex missed."); - outn (" */"); - outn ("#define REJECT reject_used_but_not_detected"); - } - - if (yymore_used) { - if (!C_plus_plus) { - if (yytext_is_array) { - if (!reentrant){ - indent_puts ("static int yy_more_offset = 0;"); - indent_puts ("static int yy_prev_more_offset = 0;"); - } - } - else if (!reentrant) { - indent_puts - ("static int yy_more_flag = 0;"); - indent_puts - ("static int yy_more_len = 0;"); - } - } - - if (yytext_is_array) { - indent_puts - ("#define yymore() (YY_G(yy_more_offset) = yy_flex_strlen( yytext M4_YY_CALL_LAST_ARG))"); - indent_puts ("#define YY_NEED_STRLEN"); - indent_puts ("#define YY_MORE_ADJ 0"); - indent_puts - ("#define YY_RESTORE_YY_MORE_OFFSET \\"); - indent_up (); - indent_puts ("{ \\"); - indent_puts - ("YY_G(yy_more_offset) = YY_G(yy_prev_more_offset); \\"); - indent_puts ("yyleng -= YY_G(yy_more_offset); \\"); - indent_puts ("}"); - indent_down (); - } - else { - indent_puts - ("#define yymore() (YY_G(yy_more_flag) = 1)"); - indent_puts - ("#define YY_MORE_ADJ YY_G(yy_more_len)"); - indent_puts ("#define YY_RESTORE_YY_MORE_OFFSET"); - } - } - - else { - indent_puts - ("#define yymore() yymore_used_but_not_detected"); - indent_puts ("#define YY_MORE_ADJ 0"); - indent_puts ("#define YY_RESTORE_YY_MORE_OFFSET"); - } - - if (!C_plus_plus) { - if (yytext_is_array) { - outn ("#ifndef YYLMAX"); - outn ("#define YYLMAX 8192"); - outn ("#endif\n"); - if (!reentrant){ - outn ("char yytext[YYLMAX];"); - outn ("char *yytext_ptr;"); - } - } - - else { - if(! reentrant) - outn ("char *yytext;"); - } - } - - out (&action_array[defs1_offset]); - - line_directive_out (stdout, 0); - - skelout (); /* %% [5.0] - break point in skel */ - - if (!C_plus_plus) { - if (use_read) { - outn ("\terrno=0; \\"); - outn ("\twhile ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \\"); - outn ("\t{ \\"); - outn ("\t\tif( errno != EINTR) \\"); - outn ("\t\t{ \\"); - outn ("\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\"); - outn ("\t\t\tbreak; \\"); - outn ("\t\t} \\"); - outn ("\t\terrno=0; \\"); - outn ("\t\tclearerr(yyin); \\"); - outn ("\t}\\"); - } - - else { - outn ("\tif ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \\"); - outn ("\t\t{ \\"); - outn ("\t\tint c = '*'; \\"); - outn ("\t\tsize_t n; \\"); - outn ("\t\tfor ( n = 0; n < max_size && \\"); - outn ("\t\t\t (c = getc( yyin )) != EOF && c != '\\n'; ++n ) \\"); - outn ("\t\t\tbuf[n] = (char) c; \\"); - outn ("\t\tif ( c == '\\n' ) \\"); - outn ("\t\t\tbuf[n++] = (char) c; \\"); - outn ("\t\tif ( c == EOF && ferror( yyin ) ) \\"); - outn ("\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\"); - outn ("\t\tresult = n; \\"); - outn ("\t\t} \\"); - outn ("\telse \\"); - outn ("\t\t{ \\"); - outn ("\t\terrno=0; \\"); - outn ("\t\twhile ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \\"); - outn ("\t\t\t{ \\"); - outn ("\t\t\tif( errno != EINTR) \\"); - outn ("\t\t\t\t{ \\"); - outn ("\t\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\"); - outn ("\t\t\t\tbreak; \\"); - outn ("\t\t\t\t} \\"); - outn ("\t\t\terrno=0; \\"); - outn ("\t\t\tclearerr(yyin); \\"); - outn ("\t\t\t} \\"); - outn ("\t\t}\\"); - } - } - - skelout (); /* %% [6.0] - break point in skel */ - - indent_puts ("#define YY_RULE_SETUP \\"); - indent_up (); - if (bol_needed) { - indent_puts ("if ( yyleng > 0 ) \\"); - indent_up (); - indent_puts ("YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \\"); - indent_puts ("\t\t(yytext[yyleng - 1] == '\\n'); \\"); - indent_down (); - } - indent_puts ("YY_USER_ACTION"); - indent_down (); - - skelout (); /* %% [7.0] - break point in skel */ - - /* Copy prolog to output file. */ - out (&action_array[prolog_offset]); - - line_directive_out (stdout, 0); - - skelout (); /* %% [8.0] - break point in skel */ - - set_indent (2); - - if (yymore_used && !yytext_is_array) { - indent_puts ("YY_G(yy_more_len) = 0;"); - indent_puts ("if ( YY_G(yy_more_flag) )"); - indent_up (); - indent_puts ("{"); - indent_puts - ("YY_G(yy_more_len) = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);"); - indent_puts ("YY_G(yy_more_flag) = 0;"); - indent_puts ("}"); - indent_down (); - } - - skelout (); /* %% [9.0] - break point in skel */ - - gen_start_state (); - - /* Note, don't use any indentation. */ - outn ("yy_match:"); - gen_next_match (); - - skelout (); /* %% [10.0] - break point in skel */ - set_indent (2); - gen_find_action (); - - skelout (); /* %% [11.0] - break point in skel */ - outn ("m4_ifdef( [[M4_YY_USE_LINENO]],[["); - indent_puts - ("if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )"); - indent_up (); - indent_puts ("{"); - indent_puts ("int yyl;"); - do_indent (); - out_str ("for ( yyl = %s; yyl < yyleng; ++yyl )\n", - yymore_used ? (yytext_is_array ? "YY_G(yy_prev_more_offset)" : - "YY_G(yy_more_len)") : "0"); - indent_up (); - indent_puts ("if ( yytext[yyl] == '\\n' )"); - indent_up (); - indent_puts ("M4_YY_INCR_LINENO();"); - indent_down (); - indent_down (); - indent_puts ("}"); - indent_down (); - outn ("]])"); - - skelout (); /* %% [12.0] - break point in skel */ - if (ddebug) { - indent_puts ("if ( yy_flex_debug )"); - indent_up (); - - indent_puts ("{"); - indent_puts ("if ( yy_act == 0 )"); - indent_up (); - indent_puts (C_plus_plus ? - "std::cerr << \"--scanner backing up\\n\";" : - "fprintf( stderr, \"--scanner backing up\\n\" );"); - indent_down (); - - do_indent (); - out_dec ("else if ( yy_act < %d )\n", num_rules); - indent_up (); - - if (C_plus_plus) { - indent_puts - ("std::cerr << \"--accepting rule at line \" << yy_rule_linenum[yy_act] <<"); - indent_puts - (" \"(\\\"\" << yytext << \"\\\")\\n\";"); - } - else { - indent_puts - ("fprintf( stderr, \"--accepting rule at line %ld (\\\"%s\\\")\\n\","); - - indent_puts - (" (long)yy_rule_linenum[yy_act], yytext );"); - } - - indent_down (); - - do_indent (); - out_dec ("else if ( yy_act == %d )\n", num_rules); - indent_up (); - - if (C_plus_plus) { - indent_puts - ("std::cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\\n\";"); - } - else { - indent_puts - ("fprintf( stderr, \"--accepting default rule (\\\"%s\\\")\\n\","); - indent_puts (" yytext );"); - } - - indent_down (); - - do_indent (); - out_dec ("else if ( yy_act == %d )\n", num_rules + 1); - indent_up (); - - indent_puts (C_plus_plus ? - "std::cerr << \"--(end of buffer or a NUL)\\n\";" : - "fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );"); - - indent_down (); - - do_indent (); - outn ("else"); - indent_up (); - - if (C_plus_plus) { - indent_puts - ("std::cerr << \"--EOF (start condition \" << YY_START << \")\\n\";"); - } - else { - indent_puts - ("fprintf( stderr, \"--EOF (start condition %d)\\n\", YY_START );"); - } - - indent_down (); - - indent_puts ("}"); - indent_down (); - } - - /* Copy actions to output file. */ - skelout (); /* %% [13.0] - break point in skel */ - indent_up (); - gen_bu_action (); - out (&action_array[action_offset]); - - line_directive_out (stdout, 0); - - /* generate cases for any missing EOF rules */ - for (i = 1; i <= lastsc; ++i) - if (!sceof[i]) { - do_indent (); - out_str ("case YY_STATE_EOF(%s):\n", scname[i]); - did_eof_rule = true; - } - - if (did_eof_rule) { - indent_up (); - indent_puts ("yyterminate();"); - indent_down (); - } - - - /* Generate code for handling NUL's, if needed. */ - - /* First, deal with backing up and setting up yy_cp if the scanner - * finds that it should JAM on the NUL. - */ - skelout (); /* %% [14.0] - break point in skel */ - set_indent (4); - - if (fullspd || fulltbl) - indent_puts ("yy_cp = YY_G(yy_c_buf_p);"); - - else { /* compressed table */ - if (!reject && !interactive) { - /* Do the guaranteed-needed backing up to figure - * out the match. - */ - indent_puts - ("yy_cp = YY_G(yy_last_accepting_cpos);"); - indent_puts - ("yy_current_state = YY_G(yy_last_accepting_state);"); - } - - else - /* Still need to initialize yy_cp, though - * yy_current_state was set up by - * yy_get_previous_state(). - */ - indent_puts ("yy_cp = YY_G(yy_c_buf_p);"); - } - - - /* Generate code for yy_get_previous_state(). */ - set_indent (1); - skelout (); /* %% [15.0] - break point in skel */ - - gen_start_state (); - - set_indent (2); - skelout (); /* %% [16.0] - break point in skel */ - gen_next_state (true); - - set_indent (1); - skelout (); /* %% [17.0] - break point in skel */ - gen_NUL_trans (); - - skelout (); /* %% [18.0] - break point in skel */ - skelout (); /* %% [19.0] - break point in skel */ - /* Update BOL and yylineno inside of input(). */ - if (bol_needed) { - indent_puts - ("YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\\n');"); - if (do_yylineno) { - indent_puts - ("if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol )"); - indent_up (); - indent_puts ("M4_YY_INCR_LINENO();"); - indent_down (); - } - } - - else if (do_yylineno) { - indent_puts ("if ( c == '\\n' )"); - indent_up (); - indent_puts ("M4_YY_INCR_LINENO();"); - indent_down (); - } - - skelout (); - - /* Copy remainder of input to output. */ - - line_directive_out (stdout, 1); - - if (sectnum == 3) { - OUT_BEGIN_CODE (); - (void) flexscan (); /* copy remainder of input to output */ - OUT_END_CODE (); - } -} diff --git a/src/bin/flex/gettext.h b/src/bin/flex/gettext.h deleted file mode 100644 index ea67f30815..0000000000 --- a/src/bin/flex/gettext.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Convenience header for conditional use of GNU . - Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - USA. */ - -#ifndef _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 - -#else - -/* 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) ((const char *) (Msgid)) -# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) -# define ngettext(Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -# define dngettext(Domainname, Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -# define textdomain(Domainname) ((const char *) (Domainname)) -# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) -# define bind_textdomain_codeset(Domainname, Codeset) ((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 - -#endif /* _LIBGETTEXT_H */ diff --git a/src/bin/flex/install-sh b/src/bin/flex/install-sh deleted file mode 100755 index 0ec27bcd48..0000000000 --- a/src/bin/flex/install-sh +++ /dev/null @@ -1,294 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# -# 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. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd=$cpprog - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "$0: no input file specified" >&2 - exit 1 -else - : -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d "$dst" ]; then - instcmd=: - chmodcmd="" - else - instcmd=$mkdirprog - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f "$src" ] || [ -d "$src" ] - then - : - else - echo "$0: $src does not exist" >&2 - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "$0: no destination specified" >&2 - exit 1 - else - : - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d "$dst" ] - then - dst=$dst/`basename "$src"` - else - : - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' - ' -IFS="${IFS-$defaultIFS}" - -oIFS=$IFS -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS=$oIFS - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp=$pathcomp$1 - shift - - if [ ! -d "$pathcomp" ] ; - then - $mkdirprog "$pathcomp" - else - : - fi - - pathcomp=$pathcomp/ -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd "$dst" && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename "$dst"` - else - dstfile=`basename "$dst" $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename "$dst"` - else - : - fi - -# Make a couple of temp file names in the proper directory. - - dsttmp=$dstdir/#inst.$$# - rmtmp=$dstdir/#rm.$$# - -# Trap to clean up temp files at exit. - - trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 - -# Move or copy the file name to the temp name - - $doit $instcmd "$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 $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && - -# 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. - -{ - if [ -f "$dstdir/$dstfile" ] - then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || - $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || - { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit - } - else - : - fi -} && - -# Now rename the file to the real destination. - - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - -fi && - -# The final little trick to "correctly" pass the exit status to the exit trap. - -{ - (exit 0); exit -} diff --git a/src/bin/flex/libmain.c b/src/bin/flex/libmain.c deleted file mode 100644 index 49262e462b..0000000000 --- a/src/bin/flex/libmain.c +++ /dev/null @@ -1,33 +0,0 @@ -/* libmain - flex run-time support library "main" function */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -extern int yylex (); - -int main (argc, argv) - int argc; - char *argv[]; -{ - while (yylex () != 0) ; - - return 0; -} diff --git a/src/bin/flex/libyywrap.c b/src/bin/flex/libyywrap.c deleted file mode 100644 index 8561a43f4c..0000000000 --- a/src/bin/flex/libyywrap.c +++ /dev/null @@ -1,27 +0,0 @@ -/* libyywrap - flex run-time support library "yywrap" function */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -int yywrap (void) -{ - return 1; -} diff --git a/src/bin/flex/main.c b/src/bin/flex/main.c deleted file mode 100644 index f28c5da901..0000000000 --- a/src/bin/flex/main.c +++ /dev/null @@ -1,1843 +0,0 @@ -/* flex - tool to generate fast lexical analyzers */ - -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - - -#include "flexdef.h" -#include "version.h" -#include "options.h" -#include "tables.h" - -static char flex_version[] = FLEX_VERSION; - -/* declare functions that have forward references */ - -void flexinit PROTO ((int, char **)); -void readin PROTO ((void)); -void set_up_initial_allocations PROTO ((void)); -static char *basename2 PROTO ((char *path, int should_strip_ext)); - - -/* these globals are all defined and commented in flexdef.h */ -int printstats, syntaxerror, eofseen, ddebug, trace, nowarn, spprdflt; -int interactive, caseins, lex_compat, posix_compat, do_yylineno, - useecs, fulltbl, usemecs; -int fullspd, gen_line_dirs, performance_report, backing_up_report; -int C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap, - csize; -int reentrant, bison_bridge_lval, bison_bridge_lloc; -int yymore_used, reject, real_reject, continued_action, in_rule; -int yymore_really_used, reject_really_used; -int datapos, dataline, linenum, out_linenum; -FILE *skelfile = NULL; -int skel_ind = 0; -char *action_array; -int action_size, defs1_offset, prolog_offset, action_offset, - action_index; -char *infilename = NULL, *outfilename = NULL, *headerfilename = NULL; -int did_outfilename; -char *prefix, *yyclass; -int do_stdinit, use_stdout; -int onestate[ONE_STACK_SIZE], onesym[ONE_STACK_SIZE]; -int onenext[ONE_STACK_SIZE], onedef[ONE_STACK_SIZE], onesp; -int maximum_mns, current_mns, current_max_rules; -int num_rules, num_eof_rules, default_rule, lastnfa; -int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2; -int *accptnum, *assoc_rule, *state_type; -int *rule_type, *rule_linenum, *rule_useful; -int current_state_type; -int variable_trailing_context_rules; -int numtemps, numprots, protprev[MSP], protnext[MSP], prottbl[MSP]; -int protcomst[MSP], firstprot, lastprot, protsave[PROT_SAVE_SIZE]; -int numecs, nextecm[CSIZE + 1], ecgroup[CSIZE + 1], nummecs, - tecfwd[CSIZE + 1]; -int tecbck[CSIZE + 1]; -int lastsc, *scset, *scbol, *scxclu, *sceof; -int current_max_scs; -char **scname; -int current_max_dfa_size, current_max_xpairs; -int current_max_template_xpairs, current_max_dfas; -int lastdfa, *nxt, *chk, *tnxt; -int *base, *def, *nultrans, NUL_ec, tblend, firstfree, **dss, *dfasiz; -union dfaacc_union *dfaacc; -int *accsiz, *dhash, numas; -int numsnpairs, jambase, jamstate; -int lastccl, *cclmap, *ccllen, *cclng, cclreuse; -int current_maxccls, current_max_ccl_tbl_size; -Char *ccltbl; -char nmstr[MAXLINE]; -int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs; -int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave; -int num_backing_up, bol_needed; -FILE *backing_up_file; -int end_of_buffer_state; -char **input_files; -int num_input_files; -jmp_buf flex_main_jmp_buf; -bool *rule_has_nl, *ccl_has_nl; -int nlch = '\n'; -bool ansi_func_defs, ansi_func_protos; - -bool tablesext, tablesverify, gentables; -char *tablesfilename=0,*tablesname=0; -struct yytbl_writer tableswr; - -/* Make sure program_name is initialized so we don't crash if writing - * out an error message before getting the program name from argv[0]. - */ -char *program_name = "flex"; - -#ifndef SHORT_FILE_NAMES -static char *outfile_template = "lex.%s.%s"; -static char *backing_name = "lex.backup"; -static char *tablesfile_template = "lex.%s.tables"; -#else -static char *outfile_template = "lex%s.%s"; -static char *backing_name = "lex.bck"; -static char *tablesfile_template = "lex%s.tbl"; -#endif - -#ifdef MS_DOS -extern unsigned _stklen = 16384; -#endif - -/* From scan.l */ -extern FILE* yyout; - -static char outfile_path[MAXLINE]; -static int outfile_created = 0; -static char *skelname = NULL; -static int _stdout_closed = 0; /* flag to prevent double-fclose() on stdout. */ - -/* For debugging. The max number of filters to apply to skeleton. */ -static int preproc_level = 1000; - -int flex_main PROTO ((int argc, char *argv[])); -int main PROTO ((int argc, char *argv[])); - -int flex_main (argc, argv) - int argc; - char *argv[]; -{ - int i, exit_status, child_status; - - /* Set a longjmp target. Yes, I know it's a hack, but it gets worse: The - * return value of setjmp, if non-zero, is the desired exit code PLUS ONE. - * For example, if you want 'main' to return with code '2', then call - * longjmp() with an argument of 3. This is because it is invalid to - * specify a value of 0 to longjmp. FLEX_EXIT(n) should be used instead of - * exit(n); - */ - exit_status = setjmp (flex_main_jmp_buf); - if (exit_status){ - if (stdout && !_stdout_closed && !ferror(stdout)){ - fflush(stdout); - fclose(stdout); - } - while (wait(&child_status) > 0){ - if (!WIFEXITED (child_status) - || WEXITSTATUS (child_status) != 0){ - /* report an error of a child - */ - if( exit_status <= 1 ) - exit_status = 2; - - } - } - return exit_status - 1; - } - - flexinit (argc, argv); - - readin (); - - ntod (); - - for (i = 1; i <= num_rules; ++i) - if (!rule_useful[i] && i != default_rule) - line_warning (_("rule cannot be matched"), - rule_linenum[i]); - - if (spprdflt && !reject && rule_useful[default_rule]) - line_warning (_ - ("-s option given but default rule can be matched"), - rule_linenum[default_rule]); - - /* Generate the C state transition tables from the DFA. */ - make_tables (); - - /* Note, flexend does not return. It exits with its argument - * as status. - */ - flexend (0); - - return 0; /* keep compilers/lint happy */ -} - -/* Wrapper around flex_main, so flex_main can be built as a library. */ -int main (argc, argv) - int argc; - char *argv[]; -{ -#if ENABLE_NLS -#if HAVE_LOCALE_H - setlocale (LC_MESSAGES, ""); - textdomain (PACKAGE); - bindtextdomain (PACKAGE, LOCALEDIR); -#endif -#endif - - return flex_main (argc, argv); -} - -/* check_options - check user-specified options */ - -void check_options () -{ - int i; - const char * m4 = NULL; - - if (lex_compat) { - if (C_plus_plus) - flexerror (_("Can't use -+ with -l option")); - - if (fulltbl || fullspd) - flexerror (_("Can't use -f or -F with -l option")); - - if (reentrant || bison_bridge_lval) - flexerror (_ - ("Can't use --reentrant or --bison-bridge with -l option")); - - /* Don't rely on detecting use of yymore() and REJECT, - * just assume they'll be used. - */ - yymore_really_used = reject_really_used = true; - - yytext_is_array = true; - do_yylineno = true; - use_read = false; - } - - -#if 0 - /* This makes no sense whatsoever. I'm removing it. */ - if (do_yylineno) - /* This should really be "maintain_backup_tables = true" */ - reject_really_used = true; -#endif - - if (csize == unspecified) { - if ((fulltbl || fullspd) && !useecs) - csize = DEFAULT_CSIZE; - else - csize = CSIZE; - } - - if (interactive == unspecified) { - if (fulltbl || fullspd) - interactive = false; - else - interactive = true; - } - - if (fulltbl || fullspd) { - if (usemecs) - flexerror (_ - ("-Cf/-CF and -Cm don't make sense together")); - - if (interactive) - flexerror (_("-Cf/-CF and -I are incompatible")); - - if (lex_compat) - flexerror (_ - ("-Cf/-CF are incompatible with lex-compatibility mode")); - - - if (fulltbl && fullspd) - flexerror (_ - ("-Cf and -CF are mutually exclusive")); - } - - if (C_plus_plus && fullspd) - flexerror (_("Can't use -+ with -CF option")); - - if (C_plus_plus && yytext_is_array) { - warn (_("%array incompatible with -+ option")); - yytext_is_array = false; - } - - if (C_plus_plus && (reentrant)) - flexerror (_("Options -+ and --reentrant are mutually exclusive.")); - - if (C_plus_plus && bison_bridge_lval) - flexerror (_("bison bridge not supported for the C++ scanner.")); - - - if (useecs) { /* Set up doubly-linked equivalence classes. */ - - /* We loop all the way up to csize, since ecgroup[csize] is - * the position used for NUL characters. - */ - ecgroup[1] = NIL; - - for (i = 2; i <= csize; ++i) { - ecgroup[i] = i - 1; - nextecm[i - 1] = i; - } - - nextecm[csize] = NIL; - } - - else { - /* Put everything in its own equivalence class. */ - for (i = 1; i <= csize; ++i) { - ecgroup[i] = i; - nextecm[i] = BAD_SUBSCRIPT; /* to catch errors */ - } - } - - if (!ansi_func_defs) - buf_m4_define( &m4defs_buf, "M4_YY_NO_ANSI_FUNC_DEFS", NULL); - - if (!ansi_func_protos) - buf_m4_define( &m4defs_buf, "M4_YY_NO_ANSI_FUNC_PROTOS", NULL); - - if (!use_stdout) { - FILE *prev_stdout; - - if (!did_outfilename) { - char *suffix; - - if (C_plus_plus) - suffix = "cc"; - else - suffix = "c"; - - sprintf (outfile_path, outfile_template, - prefix, suffix); - - outfilename = outfile_path; - } - - prev_stdout = freopen (outfilename, "w+", stdout); - - if (prev_stdout == NULL) - lerrsf (_("could not create %s"), outfilename); - - outfile_created = 1; - } - - - /* Setup the filter chain. */ - output_chain = filter_create_int(NULL, filter_tee_header, headerfilename); - if ( !(m4 = getenv("M4"))) - m4 = M4; - filter_create_ext(output_chain, m4, "-P", 0); - filter_create_int(output_chain, filter_fix_linedirs, NULL); - - /* For debugging, only run the requested number of filters. */ - if (preproc_level > 0) { - filter_truncate(output_chain, preproc_level); - filter_apply_chain(output_chain); - } - yyout = stdout; - - - /* always generate the tablesverify flag. */ - buf_m4_define (&m4defs_buf, "M4_YY_TABLES_VERIFY", tablesverify ? "1" : "0"); - if (tablesext) - gentables = false; - - if (tablesverify) - /* force generation of C tables. */ - gentables = true; - - - if (tablesext) { - FILE *tablesout; - struct yytbl_hdr hdr; - char *pname = 0; - int nbytes = 0; - - buf_m4_define (&m4defs_buf, "M4_YY_TABLES_EXTERNAL", NULL); - - if (!tablesfilename) { - nbytes = strlen (prefix) + - strlen (tablesfile_template) + 2; - tablesfilename = pname = - (char *) calloc (nbytes, 1); - sprintf (pname, tablesfile_template, prefix); - } - - if ((tablesout = fopen (tablesfilename, "w")) == NULL) - lerrsf (_("could not create %s"), tablesfilename); - if (pname) - free (pname); - tablesfilename = 0; - - yytbl_writer_init (&tableswr, tablesout); - - nbytes = strlen (prefix) + strlen ("tables") + 2; - tablesname = (char *) calloc (nbytes, 1); - sprintf (tablesname, "%stables", prefix); - yytbl_hdr_init (&hdr, flex_version, tablesname); - - if (yytbl_hdr_fwrite (&tableswr, &hdr) <= 0) - flexerror (_("could not write tables header")); - } - - if (skelname && (skelfile = fopen (skelname, "r")) == NULL) - lerrsf (_("can't open skeleton file %s"), skelname); - - if (reentrant) { - buf_m4_define (&m4defs_buf, "M4_YY_REENTRANT", NULL); - if (yytext_is_array) - buf_m4_define (&m4defs_buf, "M4_YY_TEXT_IS_ARRAY", NULL); - } - - if ( bison_bridge_lval) - buf_m4_define (&m4defs_buf, "M4_YY_BISON_LVAL", NULL); - - if ( bison_bridge_lloc) - buf_m4_define (&m4defs_buf, "", NULL); - - buf_m4_define(&m4defs_buf, "M4_YY_PREFIX", prefix); - - if (did_outfilename) - line_directive_out (stdout, 0); - - if (do_yylineno) - buf_m4_define (&m4defs_buf, "M4_YY_USE_LINENO", NULL); - - /* Create the alignment type. */ - buf_strdefine (&userdef_buf, "YY_INT_ALIGNED", - long_align ? "long int" : "short int"); - - /* Define the start condition macros. */ - { - struct Buf tmpbuf; - buf_init(&tmpbuf, sizeof(char)); - for (i = 1; i <= lastsc; i++) { - char *str, *fmt = "#define %s %d\n"; - - str = (char*)flex_alloc(strlen(fmt) + strlen(scname[i]) + (int)(1 + log10(i)) + 2); - sprintf(str, fmt, scname[i], i - 1); - buf_strappend(&tmpbuf, str); - free(str); - } - buf_m4_define(&m4defs_buf, "M4_YY_SC_DEFS", tmpbuf.elts); - buf_destroy(&tmpbuf); - } - - /* This is where we begin writing to the file. */ - - /* Dump the %top code. */ - if( top_buf.elts) - outn((char*) top_buf.elts); - - /* Dump the m4 definitions. */ - buf_print_strings(&m4defs_buf, stdout); - m4defs_buf.nelts = 0; /* memory leak here. */ - - /* Place a bogus line directive, it will be fixed in the filter. */ - outn("#line 0 \"M4_YY_OUTFILE_NAME\"\n"); - - /* Dump the user defined preproc directives. */ - if (userdef_buf.elts) - outn ((char *) (userdef_buf.elts)); - - skelout (); - /* %% [1.0] */ -} - -/* flexend - terminate flex - * - * note - * This routine does not return. - */ - -void flexend (exit_status) - int exit_status; - -{ - static int called_before = -1; /* prevent infinite recursion. */ - int tblsiz; - - if (++called_before) - FLEX_EXIT (exit_status); - - if (skelfile != NULL) { - if (ferror (skelfile)) - lerrsf (_("input error reading skeleton file %s"), - skelname); - - else if (fclose (skelfile)) - lerrsf (_("error closing skeleton file %s"), - skelname); - } - -#if 0 - fprintf (header_out, - "#ifdef YY_HEADER_EXPORT_START_CONDITIONS\n"); - fprintf (header_out, - "/* Beware! Start conditions are not prefixed. */\n"); - - /* Special case for "INITIAL" */ - fprintf (header_out, - "#undef INITIAL\n#define INITIAL 0\n"); - for (i = 2; i <= lastsc; i++) - fprintf (header_out, "#define %s %d\n", scname[i], i - 1); - fprintf (header_out, - "#endif /* YY_HEADER_EXPORT_START_CONDITIONS */\n\n"); - - /* Kill ALL flex-related macros. This is so the user - * can #include more than one generated header file. */ - fprintf (header_out, "#ifndef YY_HEADER_NO_UNDEFS\n"); - fprintf (header_out, - "/* Undefine all internal macros, etc., that do no belong in the header. */\n\n"); - - { - const char * undef_list[] = { - - "BEGIN", - "ECHO", - "EOB_ACT_CONTINUE_SCAN", - "EOB_ACT_END_OF_FILE", - "EOB_ACT_LAST_MATCH", - "FLEX_SCANNER", - "FLEX_STD", - "REJECT", - "YYFARGS0", - "YYFARGS1", - "YYFARGS2", - "YYFARGS3", - "YYLMAX", - "YYSTATE", - "YY_AT_BOL", - "YY_BREAK", - "YY_BUFFER_EOF_PENDING", - "YY_BUFFER_NEW", - "YY_BUFFER_NORMAL", - "YY_BUF_SIZE", - "M4_YY_CALL_LAST_ARG", - "M4_YY_CALL_ONLY_ARG", - "YY_CURRENT_BUFFER", - "YY_DECL", - "M4_YY_DECL_LAST_ARG", - "M4_YY_DEF_LAST_ARG", - "M4_YY_DEF_ONLY_ARG", - "YY_DO_BEFORE_ACTION", - "YY_END_OF_BUFFER", - "YY_END_OF_BUFFER_CHAR", - "YY_EXIT_FAILURE", - "YY_EXTRA_TYPE", - "YY_FATAL_ERROR", - "YY_FLEX_DEFINED_ECHO", - "YY_FLEX_LEX_COMPAT", - "YY_FLEX_MAJOR_VERSION", - "YY_FLEX_MINOR_VERSION", - "YY_FLEX_SUBMINOR_VERSION", - "YY_FLUSH_BUFFER", - "YY_G", - "YY_INPUT", - "YY_INTERACTIVE", - "YY_INT_ALIGNED", - "YY_LAST_ARG", - "YY_LESS_LINENO", - "YY_LEX_ARGS", - "YY_LEX_DECLARATION", - "YY_LEX_PROTO", - "YY_MAIN", - "YY_MORE_ADJ", - "YY_NEED_STRLEN", - "YY_NEW_FILE", - "YY_NULL", - "YY_NUM_RULES", - "YY_ONLY_ARG", - "YY_PARAMS", - "YY_PROTO", - "M4_YY_PROTO_LAST_ARG", - "M4_YY_PROTO_ONLY_ARG void", - "YY_READ_BUF_SIZE", - "YY_REENTRANT", - "YY_RESTORE_YY_MORE_OFFSET", - "YY_RULE_SETUP", - "YY_SC_TO_UI", - "YY_SKIP_YYWRAP", - "YY_START", - "YY_START_STACK_INCR", - "YY_STATE_EOF", - "YY_STDINIT", - "YY_TRAILING_HEAD_MASK", - "YY_TRAILING_MASK", - "YY_USER_ACTION", - "YY_USE_CONST", - "YY_USE_PROTOS", - "unput", - "yyTABLES_NAME", - "yy_create_buffer", - "yy_delete_buffer", - "yy_flex_debug", - "yy_flush_buffer", - "yy_init_buffer", - "yy_load_buffer_state", - "yy_new_buffer", - "yy_scan_buffer", - "yy_scan_bytes", - "yy_scan_string", - "yy_set_bol", - "yy_set_interactive", - "yy_switch_to_buffer", - "yypush_buffer_state", - "yypop_buffer_state", - "yyensure_buffer_stack", - "yyalloc", - "yyconst", - "yyextra", - "yyfree", - "yyget_debug", - "yyget_extra", - "yyget_in", - "yyget_leng", - "yyget_lineno", - "yyget_lloc", - "yyget_lval", - "yyget_out", - "yyget_text", - "yyin", - "yyleng", - "yyless", - "yylex", - "yylex_destroy", - "yylex_init", - "yylineno", - "yylloc", - "yylval", - "yymore", - "yyout", - "yyrealloc", - "yyrestart", - "yyset_debug", - "yyset_extra", - "yyset_in", - "yyset_lineno", - "yyset_lloc", - "yyset_lval", - "yyset_out", - "yytables_destroy", - "yytables_fload", - "yyterminate", - "yytext", - "yytext_ptr", - "yywrap", - - /* must be null-terminated */ - NULL}; - - - for (i=0; undef_list[i] != NULL; i++) - fprintf (header_out, "#undef %s\n", undef_list[i]); - } - - /* undef any of the auto-generated symbols. */ - for (i = 0; i < defs_buf.nelts; i++) { - - /* don't undef start conditions */ - if (sclookup (((char **) defs_buf.elts)[i]) > 0) - continue; - fprintf (header_out, "#undef %s\n", - ((char **) defs_buf.elts)[i]); - } - - fprintf (header_out, - "#endif /* !YY_HEADER_NO_UNDEFS */\n"); - fprintf (header_out, "\n"); - fprintf (header_out, "#undef %sIN_HEADER\n", prefix); - fprintf (header_out, "#endif /* %sHEADER_H */\n", prefix); - - if (ferror (header_out)) - lerrsf (_("error creating header file %s"), - headerfilename); - fflush (header_out); - fclose (header_out); -#endif - - if (exit_status != 0 && outfile_created) { - if (ferror (stdout)) - lerrsf (_("error writing output file %s"), - outfilename); - - else if ((_stdout_closed = 1) && fclose (stdout)) - lerrsf (_("error closing output file %s"), - outfilename); - - else if (unlink (outfilename)) - lerrsf (_("error deleting output file %s"), - outfilename); - } - - - if (backing_up_report && backing_up_file) { - if (num_backing_up == 0) - fprintf (backing_up_file, _("No backing up.\n")); - else if (fullspd || fulltbl) - fprintf (backing_up_file, - _ - ("%d backing up (non-accepting) states.\n"), - num_backing_up); - else - fprintf (backing_up_file, - _("Compressed tables always back up.\n")); - - if (ferror (backing_up_file)) - lerrsf (_("error writing backup file %s"), - backing_name); - - else if (fclose (backing_up_file)) - lerrsf (_("error closing backup file %s"), - backing_name); - } - - if (printstats) { - fprintf (stderr, _("%s version %s usage statistics:\n"), - program_name, flex_version); - - fprintf (stderr, _(" scanner options: -")); - - if (C_plus_plus) - putc ('+', stderr); - if (backing_up_report) - putc ('b', stderr); - if (ddebug) - putc ('d', stderr); - if (caseins) - putc ('i', stderr); - if (lex_compat) - putc ('l', stderr); - if (posix_compat) - putc ('X', stderr); - if (performance_report > 0) - putc ('p', stderr); - if (performance_report > 1) - putc ('p', stderr); - if (spprdflt) - putc ('s', stderr); - if (reentrant) - fputs ("--reentrant", stderr); - if (bison_bridge_lval) - fputs ("--bison-bridge", stderr); - if (bison_bridge_lloc) - fputs ("--bison-locations", stderr); - if (use_stdout) - putc ('t', stderr); - if (printstats) - putc ('v', stderr); /* always true! */ - if (nowarn) - putc ('w', stderr); - if (interactive == false) - putc ('B', stderr); - if (interactive == true) - putc ('I', stderr); - if (!gen_line_dirs) - putc ('L', stderr); - if (trace) - putc ('T', stderr); - - if (csize == unspecified) - /* We encountered an error fairly early on, so csize - * never got specified. Define it now, to prevent - * bogus table sizes being written out below. - */ - csize = 256; - - if (csize == 128) - putc ('7', stderr); - else - putc ('8', stderr); - - fprintf (stderr, " -C"); - - if (long_align) - putc ('a', stderr); - if (fulltbl) - putc ('f', stderr); - if (fullspd) - putc ('F', stderr); - if (useecs) - putc ('e', stderr); - if (usemecs) - putc ('m', stderr); - if (use_read) - putc ('r', stderr); - - if (did_outfilename) - fprintf (stderr, " -o%s", outfilename); - - if (skelname) - fprintf (stderr, " -S%s", skelname); - - if (strcmp (prefix, "yy")) - fprintf (stderr, " -P%s", prefix); - - putc ('\n', stderr); - - fprintf (stderr, _(" %d/%d NFA states\n"), - lastnfa, current_mns); - fprintf (stderr, _(" %d/%d DFA states (%d words)\n"), - lastdfa, current_max_dfas, totnst); - fprintf (stderr, _(" %d rules\n"), - num_rules + num_eof_rules - - 1 /* - 1 for def. rule */ ); - - if (num_backing_up == 0) - fprintf (stderr, _(" No backing up\n")); - else if (fullspd || fulltbl) - fprintf (stderr, - _ - (" %d backing-up (non-accepting) states\n"), - num_backing_up); - else - fprintf (stderr, - _ - (" Compressed tables always back-up\n")); - - if (bol_needed) - fprintf (stderr, - _(" Beginning-of-line patterns used\n")); - - fprintf (stderr, _(" %d/%d start conditions\n"), lastsc, - current_max_scs); - fprintf (stderr, - _ - (" %d epsilon states, %d double epsilon states\n"), - numeps, eps2); - - if (lastccl == 0) - fprintf (stderr, _(" no character classes\n")); - else - fprintf (stderr, - _ - (" %d/%d character classes needed %d/%d words of storage, %d reused\n"), - lastccl, current_maxccls, - cclmap[lastccl] + ccllen[lastccl], - current_max_ccl_tbl_size, cclreuse); - - fprintf (stderr, _(" %d state/nextstate pairs created\n"), - numsnpairs); - fprintf (stderr, - _(" %d/%d unique/duplicate transitions\n"), - numuniq, numdup); - - if (fulltbl) { - tblsiz = lastdfa * numecs; - fprintf (stderr, _(" %d table entries\n"), - tblsiz); - } - - else { - tblsiz = 2 * (lastdfa + numtemps) + 2 * tblend; - - fprintf (stderr, - _(" %d/%d base-def entries created\n"), - lastdfa + numtemps, current_max_dfas); - fprintf (stderr, - _ - (" %d/%d (peak %d) nxt-chk entries created\n"), - tblend, current_max_xpairs, peakpairs); - fprintf (stderr, - _ - (" %d/%d (peak %d) template nxt-chk entries created\n"), - numtemps * nummecs, - current_max_template_xpairs, - numtemps * numecs); - fprintf (stderr, _(" %d empty table entries\n"), - nummt); - fprintf (stderr, _(" %d protos created\n"), - numprots); - fprintf (stderr, - _(" %d templates created, %d uses\n"), - numtemps, tmpuses); - } - - if (useecs) { - tblsiz = tblsiz + csize; - fprintf (stderr, - _ - (" %d/%d equivalence classes created\n"), - numecs, csize); - } - - if (usemecs) { - tblsiz = tblsiz + numecs; - fprintf (stderr, - _ - (" %d/%d meta-equivalence classes created\n"), - nummecs, csize); - } - - fprintf (stderr, - _ - (" %d (%d saved) hash collisions, %d DFAs equal\n"), - hshcol, hshsave, dfaeql); - fprintf (stderr, _(" %d sets of reallocations needed\n"), - num_reallocs); - fprintf (stderr, _(" %d total table entries needed\n"), - tblsiz); - } - - FLEX_EXIT (exit_status); -} - - -/* flexinit - initialize flex */ - -void flexinit (argc, argv) - int argc; - char **argv; -{ - int i, sawcmpflag, rv, optind; - char *arg; - scanopt_t sopt; - - printstats = syntaxerror = trace = spprdflt = caseins = false; - lex_compat = posix_compat = C_plus_plus = backing_up_report = - ddebug = fulltbl = false; - fullspd = long_align = nowarn = yymore_used = continued_action = - false; - do_yylineno = yytext_is_array = in_rule = reject = do_stdinit = - false; - yymore_really_used = reject_really_used = unspecified; - interactive = csize = unspecified; - do_yywrap = gen_line_dirs = usemecs = useecs = true; - reentrant = bison_bridge_lval = bison_bridge_lloc = false; - performance_report = 0; - did_outfilename = 0; - prefix = "yy"; - yyclass = 0; - use_read = use_stdout = false; - tablesext = tablesverify = false; - gentables = true; - tablesfilename = tablesname = NULL; - ansi_func_defs = ansi_func_protos = true; - - sawcmpflag = false; - - /* Initialize dynamic array for holding the rule actions. */ - action_size = 2048; /* default size of action array in bytes */ - action_array = allocate_character_array (action_size); - defs1_offset = prolog_offset = action_offset = action_index = 0; - action_array[0] = '\0'; - - /* Initialize any buffers. */ - buf_init (&userdef_buf, sizeof (char)); /* one long string */ - buf_init (&defs_buf, sizeof (char *)); /* list of strings */ - buf_init (&yydmap_buf, sizeof (char)); /* one long string */ - buf_init (&top_buf, sizeof (char)); /* one long string */ - - { - const char * m4defs_init_str[] = {"m4_changequote\n", - "m4_changequote([[, ]])\n"}; - buf_init (&m4defs_buf, sizeof (char *)); - buf_append (&m4defs_buf, &m4defs_init_str, 2); - } - - /* initialize regex lib */ - flex_init_regex(); - - /* Enable C++ if program name ends with '+'. */ - program_name = basename2 (argv[0], 0); - - if (program_name[0] != '\0' && - program_name[strlen (program_name) - 1] == '+') - C_plus_plus = true; - - /* read flags */ - sopt = scanopt_init (flexopts, argc, argv, 0); - if (!sopt) { - /* This will only happen when flexopts array is altered. */ - fprintf (stderr, - _("Internal error. flexopts are malformed.\n")); - FLEX_EXIT (1); - } - - while ((rv = scanopt (sopt, &arg, &optind)) != 0) { - - if (rv < 0) { - /* Scanopt has already printed an option-specific error message. */ - fprintf (stderr, - _ - ("Try `%s --help' for more information.\n"), - program_name); - FLEX_EXIT (1); - } - - switch ((enum flexopt_flag_t) rv) { - case OPT_CPLUSPLUS: - C_plus_plus = true; - break; - - case OPT_BATCH: - interactive = false; - break; - - case OPT_BACKUP: - backing_up_report = true; - break; - - case OPT_DONOTHING: - break; - - case OPT_COMPRESSION: - if (!sawcmpflag) { - useecs = false; - usemecs = false; - fulltbl = false; - sawcmpflag = true; - } - - for (i = 0; arg && arg[i] != '\0'; i++) - switch (arg[i]) { - case 'a': - long_align = true; - break; - - case 'e': - useecs = true; - break; - - case 'F': - fullspd = true; - break; - - case 'f': - fulltbl = true; - break; - - case 'm': - usemecs = true; - break; - - case 'r': - use_read = true; - break; - - default: - lerrif (_ - ("unknown -C option '%c'"), - (int) arg[i]); - break; - } - break; - - case OPT_DEBUG: - ddebug = true; - break; - - case OPT_NO_DEBUG: - ddebug = false; - break; - - case OPT_FULL: - useecs = usemecs = false; - use_read = fulltbl = true; - break; - - case OPT_FAST: - useecs = usemecs = false; - use_read = fullspd = true; - break; - - case OPT_HELP: - usage (); - FLEX_EXIT (0); - - case OPT_INTERACTIVE: - interactive = true; - break; - - case OPT_CASE_INSENSITIVE: - caseins = true; - break; - - case OPT_LEX_COMPAT: - lex_compat = true; - break; - - case OPT_POSIX_COMPAT: - posix_compat = true; - break; - - case OPT_PREPROC_LEVEL: - preproc_level = strtol(arg,NULL,0); - break; - - case OPT_MAIN: - buf_strdefine (&userdef_buf, "YY_MAIN", "1"); - do_yywrap = false; - break; - - case OPT_NO_MAIN: - buf_strdefine (&userdef_buf, "YY_MAIN", "0"); - break; - - case OPT_NO_LINE: - gen_line_dirs = false; - break; - - case OPT_OUTFILE: - outfilename = arg; - did_outfilename = 1; - break; - - case OPT_PREFIX: - prefix = arg; - break; - - case OPT_PERF_REPORT: - ++performance_report; - break; - - case OPT_BISON_BRIDGE: - bison_bridge_lval = true; - break; - - case OPT_BISON_BRIDGE_LOCATIONS: - bison_bridge_lval = bison_bridge_lloc = true; - break; - - case OPT_REENTRANT: - reentrant = true; - break; - - case OPT_NO_REENTRANT: - reentrant = false; - break; - - case OPT_SKEL: - skelname = arg; - break; - - case OPT_DEFAULT: - spprdflt = false; - break; - - case OPT_NO_DEFAULT: - spprdflt = true; - break; - - case OPT_STDOUT: - use_stdout = true; - break; - - case OPT_NO_UNISTD_H: - //buf_strdefine (&userdef_buf, "YY_NO_UNISTD_H", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_UNISTD_H",0); - break; - - case OPT_TABLES_FILE: - tablesext = true; - tablesfilename = arg; - break; - - case OPT_TABLES_VERIFY: - tablesverify = true; - break; - - case OPT_TRACE: - trace = true; - break; - - case OPT_VERBOSE: - printstats = true; - break; - - case OPT_VERSION: - printf (_("%s %s\n"), program_name, flex_version); - FLEX_EXIT (0); - - case OPT_WARN: - nowarn = false; - break; - - case OPT_NO_WARN: - nowarn = true; - break; - - case OPT_7BIT: - csize = 128; - break; - - case OPT_8BIT: - csize = CSIZE; - break; - - case OPT_ALIGN: - long_align = true; - break; - - case OPT_NO_ALIGN: - long_align = false; - break; - - case OPT_ALWAYS_INTERACTIVE: - buf_m4_define (&m4defs_buf, "M4_YY_ALWAYS_INTERACTIVE", 0); - break; - - case OPT_NEVER_INTERACTIVE: - buf_m4_define( &m4defs_buf, "M4_YY_NEVER_INTERACTIVE", 0); - break; - - case OPT_ARRAY: - yytext_is_array = true; - break; - - case OPT_POINTER: - yytext_is_array = false; - break; - - case OPT_ECS: - useecs = true; - break; - - case OPT_NO_ECS: - useecs = false; - break; - - case OPT_HEADER_FILE: - headerfilename = arg; - break; - - case OPT_META_ECS: - usemecs = true; - break; - - case OPT_NO_META_ECS: - usemecs = false; - break; - - case OPT_PREPROCDEFINE: - { - /* arg is "symbol" or "symbol=definition". */ - char *def; - - for (def = arg; - *def != '\0' && *def != '='; ++def) ; - - buf_strappend (&userdef_buf, "#define "); - if (*def == '\0') { - buf_strappend (&userdef_buf, arg); - buf_strappend (&userdef_buf, - " 1\n"); - } - else { - buf_strnappend (&userdef_buf, arg, - def - arg); - buf_strappend (&userdef_buf, " "); - buf_strappend (&userdef_buf, - def + 1); - buf_strappend (&userdef_buf, "\n"); - } - } - break; - - case OPT_READ: - use_read = true; - break; - - case OPT_STACK: - //buf_strdefine (&userdef_buf, "YY_STACK_USED", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_STACK_USED",0); - break; - - case OPT_STDINIT: - do_stdinit = true; - break; - - case OPT_NO_STDINIT: - do_stdinit = false; - break; - - case OPT_YYCLASS: - yyclass = arg; - break; - - case OPT_YYLINENO: - do_yylineno = true; - break; - - case OPT_NO_YYLINENO: - do_yylineno = false; - break; - - case OPT_YYWRAP: - do_yywrap = true; - break; - - case OPT_NO_YYWRAP: - do_yywrap = false; - break; - - case OPT_YYMORE: - yymore_really_used = true; - break; - - case OPT_NO_YYMORE: - yymore_really_used = false; - break; - - case OPT_REJECT: - reject_really_used = true; - break; - - case OPT_NO_REJECT: - reject_really_used = false; - break; - - case OPT_NO_ANSI_FUNC_DEFS: - ansi_func_defs = false; - break; - - case OPT_NO_ANSI_FUNC_PROTOS: - ansi_func_protos = false; - break; - - case OPT_NO_YY_PUSH_STATE: - //buf_strdefine (&userdef_buf, "YY_NO_PUSH_STATE", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_PUSH_STATE",0); - break; - case OPT_NO_YY_POP_STATE: - //buf_strdefine (&userdef_buf, "YY_NO_POP_STATE", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_POP_STATE",0); - break; - case OPT_NO_YY_TOP_STATE: - //buf_strdefine (&userdef_buf, "YY_NO_TOP_STATE", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_TOP_STATE",0); - break; - case OPT_NO_UNPUT: - //buf_strdefine (&userdef_buf, "YY_NO_UNPUT", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_UNPUT",0); - break; - case OPT_NO_YY_SCAN_BUFFER: - //buf_strdefine (&userdef_buf, "YY_NO_SCAN_BUFFER", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_BUFFER",0); - break; - case OPT_NO_YY_SCAN_BYTES: - //buf_strdefine (&userdef_buf, "YY_NO_SCAN_BYTES", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_BYTES",0); - break; - case OPT_NO_YY_SCAN_STRING: - //buf_strdefine (&userdef_buf, "YY_NO_SCAN_STRING", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_STRING",0); - break; - case OPT_NO_YYGET_EXTRA: - //buf_strdefine (&userdef_buf, "YY_NO_GET_EXTRA", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_EXTRA",0); - break; - case OPT_NO_YYSET_EXTRA: - //buf_strdefine (&userdef_buf, "YY_NO_SET_EXTRA", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_EXTRA",0); - break; - case OPT_NO_YYGET_LENG: - //buf_strdefine (&userdef_buf, "YY_NO_GET_LENG", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LENG",0); - break; - case OPT_NO_YYGET_TEXT: - //buf_strdefine (&userdef_buf, "YY_NO_GET_TEXT", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_TEXT",0); - break; - case OPT_NO_YYGET_LINENO: - //buf_strdefine (&userdef_buf, "YY_NO_GET_LINENO", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LINENO",0); - break; - case OPT_NO_YYSET_LINENO: - //buf_strdefine (&userdef_buf, "YY_NO_SET_LINENO", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LINENO",0); - break; - case OPT_NO_YYGET_IN: - //buf_strdefine (&userdef_buf, "YY_NO_GET_IN", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_IN",0); - break; - case OPT_NO_YYSET_IN: - //buf_strdefine (&userdef_buf, "YY_NO_SET_IN", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_IN",0); - break; - case OPT_NO_YYGET_OUT: - //buf_strdefine (&userdef_buf, "YY_NO_GET_OUT", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_OUT",0); - break; - case OPT_NO_YYSET_OUT: - //buf_strdefine (&userdef_buf, "YY_NO_SET_OUT", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_OUT",0); - break; - case OPT_NO_YYGET_LVAL: - //buf_strdefine (&userdef_buf, "YY_NO_GET_LVAL", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LVAL",0); - break; - case OPT_NO_YYSET_LVAL: - //buf_strdefine (&userdef_buf, "YY_NO_SET_LVAL", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LVAL",0); - break; - case OPT_NO_YYGET_LLOC: - //buf_strdefine (&userdef_buf, "YY_NO_GET_LLOC", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LLOC",0); - break; - case OPT_NO_YYSET_LLOC: - //buf_strdefine (&userdef_buf, "YY_NO_SET_LLOC", "1"); - buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LLOC",0); - break; - - } /* switch */ - } /* while scanopt() */ - - scanopt_destroy (sopt); - - num_input_files = argc - optind; - input_files = argv + optind; - set_input_file (num_input_files > 0 ? input_files[0] : NULL); - - lastccl = lastsc = lastdfa = lastnfa = 0; - num_rules = num_eof_rules = default_rule = 0; - numas = numsnpairs = tmpuses = 0; - numecs = numeps = eps2 = num_reallocs = hshcol = dfaeql = totnst = - 0; - numuniq = numdup = hshsave = eofseen = datapos = dataline = 0; - num_backing_up = onesp = numprots = 0; - variable_trailing_context_rules = bol_needed = false; - - out_linenum = linenum = sectnum = 1; - firstprot = NIL; - - /* Used in mkprot() so that the first proto goes in slot 1 - * of the proto queue. - */ - lastprot = 1; - - set_up_initial_allocations (); -} - - -/* readin - read in the rules section of the input file(s) */ - -void readin () -{ - static char yy_stdinit[] = "FILE *yyin = stdin, *yyout = stdout;"; - static char yy_nostdinit[] = - "FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;"; - - line_directive_out ((FILE *) 0, 1); - - if (yyparse ()) { - pinpoint_message (_("fatal parse error")); - flexend (1); - } - - if (syntaxerror) - flexend (1); - - /* If the user explicitly requested posix compatibility by specifing the - * posix-compat option, then we check for conflicting options. However, if - * the POSIXLY_CORRECT variable is set, then we quietly make flex as - * posix-compatible as possible. This is the recommended behavior - * according to the GNU Coding Standards. - * - * Note: The posix option was added to flex to provide the posix behavior - * of the repeat operator in regular expressions, e.g., `ab{3}' - */ - if (posix_compat) { - /* TODO: This is where we try to make flex behave according to - * posiz, AND check for conflicting options. How far should we go - * with this? Should we disable all the neat-o flex features? - */ - /* Update: Estes says no, since other flex features don't violate posix. */ - } - - if (getenv ("POSIXLY_CORRECT")) { - posix_compat = true; - } - - if (backing_up_report) { - backing_up_file = fopen (backing_name, "w"); - if (backing_up_file == NULL) - lerrsf (_ - ("could not create backing-up info file %s"), - backing_name); - } - - else - backing_up_file = NULL; - - if (yymore_really_used == true) - yymore_used = true; - else if (yymore_really_used == false) - yymore_used = false; - - if (reject_really_used == true) - reject = true; - else if (reject_really_used == false) - reject = false; - - if (performance_report > 0) { - if (lex_compat) { - fprintf (stderr, - _ - ("-l AT&T lex compatibility option entails a large performance penalty\n")); - fprintf (stderr, - _ - (" and may be the actual source of other reported performance penalties\n")); - } - - else if (do_yylineno) { - fprintf (stderr, - _ - ("%%option yylineno entails a performance penalty ONLY on rules that can match newline characters\n")); - } - - if (performance_report > 1) { - if (interactive) - fprintf (stderr, - _ - ("-I (interactive) entails a minor performance penalty\n")); - - if (yymore_used) - fprintf (stderr, - _ - ("yymore() entails a minor performance penalty\n")); - } - - if (reject) - fprintf (stderr, - _ - ("REJECT entails a large performance penalty\n")); - - if (variable_trailing_context_rules) - fprintf (stderr, - _ - ("Variable trailing context rules entail a large performance penalty\n")); - } - - if (reject) - real_reject = true; - - if (variable_trailing_context_rules) - reject = true; - - if ((fulltbl || fullspd) && reject) { - if (real_reject) - flexerror (_ - ("REJECT cannot be used with -f or -F")); - else if (do_yylineno) - flexerror (_ - ("%option yylineno cannot be used with REJECT")); - else - flexerror (_ - ("variable trailing context rules cannot be used with -f or -F")); - } - - if (reject){ - out_m4_define( "M4_YY_USES_REJECT", NULL); - //outn ("\n#define YY_USES_REJECT"); - } - - if (!do_yywrap) { - outn ("\n#define yywrap(n) 1"); - outn ("#define YY_SKIP_YYWRAP"); - } - - if (ddebug) - outn ("\n#define FLEX_DEBUG"); - - OUT_BEGIN_CODE (); - if (csize == 256) - outn ("typedef unsigned char YY_CHAR;"); - else - outn ("typedef char YY_CHAR;"); - OUT_END_CODE (); - - if (C_plus_plus) { - outn ("#define yytext_ptr yytext"); - - if (interactive) - outn ("#define YY_INTERACTIVE"); - } - - else { - OUT_BEGIN_CODE (); - /* In reentrant scanner, stdinit is handled in flex.skl. */ - if (do_stdinit) { - if (reentrant){ - outn ("#ifdef VMS"); - outn ("#ifdef __VMS_POSIX"); - outn ("#define YY_STDINIT"); - outn ("#endif"); - outn ("#else"); - outn ("#define YY_STDINIT"); - outn ("#endif"); - } - - outn ("#ifdef VMS"); - outn ("#ifndef __VMS_POSIX"); - outn (yy_nostdinit); - outn ("#else"); - outn (yy_stdinit); - outn ("#endif"); - outn ("#else"); - outn (yy_stdinit); - outn ("#endif"); - } - - else { - if(!reentrant) - outn (yy_nostdinit); - } - OUT_END_CODE (); - } - - OUT_BEGIN_CODE (); - if (fullspd) - outn ("typedef yyconst struct yy_trans_info *yy_state_type;"); - else if (!C_plus_plus) - outn ("typedef int yy_state_type;"); - OUT_END_CODE (); - - if (lex_compat) - outn ("#define YY_FLEX_LEX_COMPAT"); - - if (!C_plus_plus && !reentrant) { - outn ("extern int yylineno;"); - OUT_BEGIN_CODE (); - outn ("int yylineno = 1;"); - OUT_END_CODE (); - } - - if (C_plus_plus) { - outn ("\n#include "); - - if (yyclass) { - outn ("int yyFlexLexer::yylex()"); - outn ("\t{"); - outn ("\tLexerError( \"yyFlexLexer::yylex invoked but %option yyclass used\" );"); - outn ("\treturn 0;"); - outn ("\t}"); - - out_str ("\n#define YY_DECL int %s::yylex()\n", - yyclass); - } - } - - else { - - /* Watch out: yytext_ptr is a variable when yytext is an array, - * but it's a macro when yytext is a pointer. - */ - if (yytext_is_array) { - if (!reentrant) - outn ("extern char yytext[];\n"); - } - else { - if (reentrant) { - outn ("#define yytext_ptr yytext_r"); - } - else { - outn ("extern char *yytext;"); - outn ("#define yytext_ptr yytext"); - } - } - - if (yyclass) - flexerror (_ - ("%option yyclass only meaningful for C++ scanners")); - } - - if (useecs) - numecs = cre8ecs (nextecm, ecgroup, csize); - else - numecs = csize; - - /* Now map the equivalence class for NUL to its expected place. */ - ecgroup[0] = ecgroup[csize]; - NUL_ec = ABS (ecgroup[0]); - - if (useecs) - ccl2ecl (); -} - - -/* set_up_initial_allocations - allocate memory for internal tables */ - -void set_up_initial_allocations () -{ - maximum_mns = (long_align ? MAXIMUM_MNS_LONG : MAXIMUM_MNS); - current_mns = INITIAL_MNS; - firstst = allocate_integer_array (current_mns); - lastst = allocate_integer_array (current_mns); - finalst = allocate_integer_array (current_mns); - transchar = allocate_integer_array (current_mns); - trans1 = allocate_integer_array (current_mns); - trans2 = allocate_integer_array (current_mns); - accptnum = allocate_integer_array (current_mns); - assoc_rule = allocate_integer_array (current_mns); - state_type = allocate_integer_array (current_mns); - - current_max_rules = INITIAL_MAX_RULES; - rule_type = allocate_integer_array (current_max_rules); - rule_linenum = allocate_integer_array (current_max_rules); - rule_useful = allocate_integer_array (current_max_rules); - rule_has_nl = allocate_bool_array (current_max_rules); - - current_max_scs = INITIAL_MAX_SCS; - scset = allocate_integer_array (current_max_scs); - scbol = allocate_integer_array (current_max_scs); - scxclu = allocate_integer_array (current_max_scs); - sceof = allocate_integer_array (current_max_scs); - scname = allocate_char_ptr_array (current_max_scs); - - current_maxccls = INITIAL_MAX_CCLS; - cclmap = allocate_integer_array (current_maxccls); - ccllen = allocate_integer_array (current_maxccls); - cclng = allocate_integer_array (current_maxccls); - ccl_has_nl = allocate_bool_array (current_maxccls); - - current_max_ccl_tbl_size = INITIAL_MAX_CCL_TBL_SIZE; - ccltbl = allocate_Character_array (current_max_ccl_tbl_size); - - current_max_dfa_size = INITIAL_MAX_DFA_SIZE; - - current_max_xpairs = INITIAL_MAX_XPAIRS; - nxt = allocate_integer_array (current_max_xpairs); - chk = allocate_integer_array (current_max_xpairs); - - current_max_template_xpairs = INITIAL_MAX_TEMPLATE_XPAIRS; - tnxt = allocate_integer_array (current_max_template_xpairs); - - current_max_dfas = INITIAL_MAX_DFAS; - base = allocate_integer_array (current_max_dfas); - def = allocate_integer_array (current_max_dfas); - dfasiz = allocate_integer_array (current_max_dfas); - accsiz = allocate_integer_array (current_max_dfas); - dhash = allocate_integer_array (current_max_dfas); - dss = allocate_int_ptr_array (current_max_dfas); - dfaacc = allocate_dfaacc_union (current_max_dfas); - - nultrans = (int *) 0; -} - - -/* extracts basename from path, optionally stripping the extension "\.*" - * (same concept as /bin/sh `basename`, but different handling of extension). */ -static char *basename2 (path, strip_ext) - char *path; - int strip_ext; /* boolean */ -{ - char *b, *e = 0; - - b = path; - for (b = path; *path; path++) - if (*path == '/') - b = path + 1; - else if (*path == '.') - e = path; - - if (strip_ext && e && e > b) - *e = '\0'; - return b; -} - -void usage () -{ - FILE *f = stdout; - - if (!did_outfilename) { - sprintf (outfile_path, outfile_template, - prefix, C_plus_plus ? "cc" : "c"); - outfilename = outfile_path; - } - - fprintf (f, _("Usage: %s [OPTIONS] [FILE]...\n"), program_name); - fprintf (f, - _ - ("Generates programs that perform pattern-matching on text.\n" - "\n" "Table Compression:\n" - " -Ca, --align trade off larger tables for better memory alignment\n" - " -Ce, --ecs construct equivalence classes\n" - " -Cf do not compress tables; use -f representation\n" - " -CF do not compress tables; use -F representation\n" - " -Cm, --meta-ecs construct meta-equivalence classes\n" - " -Cr, --read use read() instead of stdio for scanner input\n" - " -f, --full generate fast, large scanner. Same as -Cfr\n" - " -F, --fast use alternate table representation. Same as -CFr\n" - " -Cem default compression (same as --ecs --meta-ecs)\n" - "\n" "Debugging:\n" - " -d, --debug enable debug mode in scanner\n" - " -b, --backup write backing-up information to %s\n" - " -p, --perf-report write performance report to stderr\n" - " -s, --nodefault suppress default rule to ECHO unmatched text\n" - " -T, --trace %s should run in trace mode\n" - " -w, --nowarn do not generate warnings\n" - " -v, --verbose write summary of scanner statistics to stdout\n" - "\n" "Files:\n" - " -o, --outfile=FILE specify output filename\n" - " -S, --skel=FILE specify skeleton file\n" - " -t, --stdout write scanner on stdout instead of %s\n" - " --yyclass=NAME name of C++ class\n" - " --header-file=FILE create a C header file in addition to the scanner\n" - " --tables-file[=FILE] write tables to FILE\n" "\n" - "Scanner behavior:\n" - " -7, --7bit generate 7-bit scanner\n" - " -8, --8bit generate 8-bit scanner\n" - " -B, --batch generate batch scanner (opposite of -I)\n" - " -i, --case-insensitive ignore case in patterns\n" - " -l, --lex-compat maximal compatibility with original lex\n" - " -X, --posix-compat maximal compatibility with POSIX lex\n" - " -I, --interactive generate interactive scanner (opposite of -B)\n" - " --yylineno track line count in yylineno\n" - "\n" "Generated code:\n" - " -+, --c++ generate C++ scanner class\n" - " -Dmacro[=defn] #define macro defn (default defn is '1')\n" - " -L, --noline suppress #line directives in scanner\n" - " -P, --prefix=STRING use STRING as prefix instead of \"yy\"\n" - " -R, --reentrant generate a reentrant C scanner\n" - " --bison-bridge scanner for bison pure parser.\n" - " --bison-locations include yylloc support.\n" - " --stdinit initialize yyin/yyout to stdin/stdout\n" - " --noansi-definitions old-style function definitions\n" - " --noansi-prototypes empty parameter list in prototypes\n" - " --nounistd do not include \n" - " --noFUNCTION do not generate a particular FUNCTION\n" - "\n" "Miscellaneous:\n" - " -c do-nothing POSIX option\n" - " -n do-nothing POSIX option\n" - " -?\n" - " -h, --help produce this help message\n" - " -V, --version report %s version\n"), - backing_name, program_name, outfile_path, program_name); - -} diff --git a/src/bin/flex/misc.c b/src/bin/flex/misc.c deleted file mode 100644 index 238843705f..0000000000 --- a/src/bin/flex/misc.c +++ /dev/null @@ -1,1095 +0,0 @@ -/* misc - miscellaneous flex routines */ - -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -#include "flexdef.h" -#include "tables.h" - -#define CMD_IF_TABLES_SER "%if-tables-serialization" -#define CMD_TABLES_YYDMAP "%tables-yydmap" -#define CMD_DEFINE_YYTABLES "%define-yytables" -#define CMD_IF_CPP_ONLY "%if-c++-only" -#define CMD_IF_C_ONLY "%if-c-only" -#define CMD_IF_C_OR_CPP "%if-c-or-c++" -#define CMD_NOT_FOR_HEADER "%not-for-header" -#define CMD_OK_FOR_HEADER "%ok-for-header" -#define CMD_PUSH "%push" -#define CMD_POP "%pop" -#define CMD_IF_REENTRANT "%if-reentrant" -#define CMD_IF_NOT_REENTRANT "%if-not-reentrant" -#define CMD_IF_BISON_BRIDGE "%if-bison-bridge" -#define CMD_IF_NOT_BISON_BRIDGE "%if-not-bison-bridge" -#define CMD_ENDIF "%endif" - -/* we allow the skeleton to push and pop. */ -struct sko_state { - bool dc; /**< do_copy */ -}; -static struct sko_state *sko_stack=0; -static int sko_len=0,sko_sz=0; -static void sko_push(bool dc) -{ - if(!sko_stack){ - sko_sz = 1; - sko_stack = (struct sko_state*)flex_alloc(sizeof(struct sko_state)*sko_sz); - sko_len = 0; - } - if(sko_len >= sko_sz){ - sko_sz *= 2; - sko_stack = (struct sko_state*)flex_realloc(sko_stack,sizeof(struct sko_state)*sko_sz); - } - - /* initialize to zero and push */ - sko_stack[sko_len].dc = dc; - sko_len++; -} -static void sko_peek(bool *dc) -{ - if(sko_len <= 0) - flex_die("peek attempt when sko stack is empty"); - if(dc) - *dc = sko_stack[sko_len-1].dc; -} -static void sko_pop(bool* dc) -{ - sko_peek(dc); - sko_len--; - if(sko_len < 0) - flex_die("popped too many times in skeleton."); -} - -/* Append "#define defname value\n" to the running buffer. */ -void action_define (defname, value) - const char *defname; - int value; -{ - char buf[MAXLINE]; - char *cpy; - - if ((int) strlen (defname) > MAXLINE / 2) { - format_pinpoint_message (_ - ("name \"%s\" ridiculously long"), - defname); - return; - } - - sprintf (buf, "#define %s %d\n", defname, value); - add_action (buf); - - /* track #defines so we can undef them when we're done. */ - cpy = copy_string (defname); - buf_append (&defs_buf, &cpy, 1); -} - - -/** Append "m4_define([[defname]],[[value]])m4_dnl\n" to the running buffer. - * @param defname The macro name. - * @param value The macro value, can be NULL, which is the same as the empty string. - */ -void action_m4_define (const char *defname, const char * value) -{ - char buf[MAXLINE]; - - flexfatal ("DO NOT USE THIS FUNCTION!"); - - if ((int) strlen (defname) > MAXLINE / 2) { - format_pinpoint_message (_ - ("name \"%s\" ridiculously long"), - defname); - return; - } - - sprintf (buf, "m4_define([[%s]],[[%s]])m4_dnl\n", defname, value?value:""); - add_action (buf); -} - -/* Append "new_text" to the running buffer. */ -void add_action (new_text) - char *new_text; -{ - int len = strlen (new_text); - - while (len + action_index >= action_size - 10 /* slop */ ) { - int new_size = action_size * 2; - - if (new_size <= 0) - /* Increase just a little, to try to avoid overflow - * on 16-bit machines. - */ - action_size += action_size / 8; - else - action_size = new_size; - - action_array = - reallocate_character_array (action_array, - action_size); - } - - strcpy (&action_array[action_index], new_text); - - action_index += len; -} - - -/* allocate_array - allocate memory for an integer array of the given size */ - -void *allocate_array (size, element_size) - int size; - size_t element_size; -{ - register void *mem; - size_t num_bytes = element_size * size; - - mem = flex_alloc (num_bytes); - if (!mem) - flexfatal (_ - ("memory allocation failed in allocate_array()")); - - return mem; -} - - -/* all_lower - true if a string is all lower-case */ - -int all_lower (str) - register char *str; -{ - while (*str) { - if (!isascii ((Char) * str) || !islower (*str)) - return 0; - ++str; - } - - return 1; -} - - -/* all_upper - true if a string is all upper-case */ - -int all_upper (str) - register char *str; -{ - while (*str) { - if (!isascii ((Char) * str) || !isupper (*str)) - return 0; - ++str; - } - - return 1; -} - - -/* bubble - bubble sort an integer array in increasing order - * - * synopsis - * int v[n], n; - * void bubble( v, n ); - * - * description - * sorts the first n elements of array v and replaces them in - * increasing order. - * - * passed - * v - the array to be sorted - * n - the number of elements of 'v' to be sorted - */ - -void bubble (v, n) - int v[], n; -{ - register int i, j, k; - - for (i = n; i > 1; --i) - for (j = 1; j < i; ++j) - if (v[j] > v[j + 1]) { /* compare */ - k = v[j]; /* exchange */ - v[j] = v[j + 1]; - v[j + 1] = k; - } -} - - -/* check_char - checks a character to make sure it's within the range - * we're expecting. If not, generates fatal error message - * and exits. - */ - -void check_char (c) - int c; -{ - if (c >= CSIZE) - lerrsf (_("bad character '%s' detected in check_char()"), - readable_form (c)); - - if (c >= csize) - lerrsf (_ - ("scanner requires -8 flag to use the character %s"), - readable_form (c)); -} - - - -/* clower - replace upper-case letter to lower-case */ - -Char clower (c) - register int c; -{ - return (Char) ((isascii (c) && isupper (c)) ? tolower (c) : c); -} - - -/* copy_string - returns a dynamically allocated copy of a string */ - -char *copy_string (str) - register const char *str; -{ - register const char *c1; - register char *c2; - char *copy; - unsigned int size; - - /* find length */ - for (c1 = str; *c1; ++c1) ; - - size = (c1 - str + 1) * sizeof (char); - - copy = (char *) flex_alloc (size); - - if (copy == NULL) - flexfatal (_("dynamic memory failure in copy_string()")); - - for (c2 = copy; (*c2++ = *str++) != 0;) ; - - return copy; -} - - -/* copy_unsigned_string - - * returns a dynamically allocated copy of a (potentially) unsigned string - */ - -Char *copy_unsigned_string (str) - register Char *str; -{ - register Char *c; - Char *copy; - - /* find length */ - for (c = str; *c; ++c) ; - - copy = allocate_Character_array (c - str + 1); - - for (c = copy; (*c++ = *str++) != 0;) ; - - return copy; -} - - -/* cshell - shell sort a character array in increasing order - * - * synopsis - * - * Char v[n]; - * int n, special_case_0; - * cshell( v, n, special_case_0 ); - * - * description - * Does a shell sort of the first n elements of array v. - * If special_case_0 is true, then any element equal to 0 - * is instead assumed to have infinite weight. - * - * passed - * v - array to be sorted - * n - number of elements of v to be sorted - */ - -void cshell (v, n, special_case_0) - Char v[]; - int n, special_case_0; -{ - int gap, i, j, jg; - Char k; - - for (gap = n / 2; gap > 0; gap = gap / 2) - for (i = gap; i < n; ++i) - for (j = i - gap; j >= 0; j = j - gap) { - jg = j + gap; - - if (special_case_0) { - if (v[jg] == 0) - break; - - else if (v[j] != 0 - && v[j] <= v[jg]) - break; - } - - else if (v[j] <= v[jg]) - break; - - k = v[j]; - v[j] = v[jg]; - v[jg] = k; - } -} - - -/* dataend - finish up a block of data declarations */ - -void dataend () -{ - /* short circuit any output */ - if (gentables) { - - if (datapos > 0) - dataflush (); - - /* add terminator for initialization; { for vi */ - outn (" } ;\n"); - } - dataline = 0; - datapos = 0; -} - - -/* dataflush - flush generated data statements */ - -void dataflush () -{ - /* short circuit any output */ - if (!gentables) - return; - - outc ('\n'); - - if (++dataline >= NUMDATALINES) { - /* Put out a blank line so that the table is grouped into - * large blocks that enable the user to find elements easily. - */ - outc ('\n'); - dataline = 0; - } - - /* Reset the number of characters written on the current line. */ - datapos = 0; -} - - -/* flexerror - report an error message and terminate */ - -void flexerror (msg) - const char *msg; -{ - fprintf (stderr, "%s: %s\n", program_name, msg); - flexend (1); -} - - -/* flexfatal - report a fatal error message and terminate */ - -void flexfatal (msg) - const char *msg; -{ - fprintf (stderr, _("%s: fatal internal error, %s\n"), - program_name, msg); - FLEX_EXIT (1); -} - - -/* htoi - convert a hexadecimal digit string to an integer value */ - -int htoi (str) - Char str[]; -{ - unsigned int result; - - (void) sscanf ((char *) str, "%x", &result); - - return result; -} - - -/* lerrif - report an error message formatted with one integer argument */ - -void lerrif (msg, arg) - const char *msg; - int arg; -{ - char errmsg[MAXLINE]; - - (void) sprintf (errmsg, msg, arg); - flexerror (errmsg); -} - - -/* lerrsf - report an error message formatted with one string argument */ - -void lerrsf (msg, arg) - const char *msg, arg[]; -{ - char errmsg[MAXLINE]; - - (void) sprintf (errmsg, msg, arg); - flexerror (errmsg); -} - - -/* line_directive_out - spit out a "#line" statement */ - -void line_directive_out (output_file, do_infile) - FILE *output_file; - int do_infile; -{ - char directive[MAXLINE], filename[MAXLINE]; - char *s1, *s2, *s3; - static const char *line_fmt = "#line %d \"%s\"\n"; - - if (!gen_line_dirs) - return; - - s1 = do_infile ? infilename : "M4_YY_OUTFILE_NAME"; - - if (do_infile && !s1) - s1 = ""; - - s2 = filename; - s3 = &filename[sizeof (filename) - 2]; - - while (s2 < s3 && *s1) { - if (*s1 == '\\') - /* Escape the '\' */ - *s2++ = '\\'; - - *s2++ = *s1++; - } - - *s2 = '\0'; - - if (do_infile) - sprintf (directive, line_fmt, linenum, filename); - else { - if (output_file == stdout) - /* Account for the line directive itself. */ - ++out_linenum; - - sprintf (directive, line_fmt, out_linenum, filename); - } - - /* If output_file is nil then we should put the directive in - * the accumulated actions. - */ - if (output_file) { - fputs (directive, output_file); - } - else - add_action (directive); -} - - -/* mark_defs1 - mark the current position in the action array as - * representing where the user's section 1 definitions end - * and the prolog begins - */ -void mark_defs1 () -{ - defs1_offset = 0; - action_array[action_index++] = '\0'; - action_offset = prolog_offset = action_index; - action_array[action_index] = '\0'; -} - - -/* mark_prolog - mark the current position in the action array as - * representing the end of the action prolog - */ -void mark_prolog () -{ - action_array[action_index++] = '\0'; - action_offset = action_index; - action_array[action_index] = '\0'; -} - - -/* mk2data - generate a data statement for a two-dimensional array - * - * Generates a data statement initializing the current 2-D array to "value". - */ -void mk2data (value) - int value; -{ - /* short circuit any output */ - if (!gentables) - return; - - if (datapos >= NUMDATAITEMS) { - outc (','); - dataflush (); - } - - if (datapos == 0) - /* Indent. */ - out (" "); - - else - outc (','); - - ++datapos; - - out_dec ("%5d", value); -} - - -/* mkdata - generate a data statement - * - * Generates a data statement initializing the current array element to - * "value". - */ -void mkdata (value) - int value; -{ - /* short circuit any output */ - if (!gentables) - return; - - if (datapos >= NUMDATAITEMS) { - outc (','); - dataflush (); - } - - if (datapos == 0) - /* Indent. */ - out (" "); - else - outc (','); - - ++datapos; - - out_dec ("%5d", value); -} - - -/* myctoi - return the integer represented by a string of digits */ - -int myctoi (array) - const char *array; -{ - int val = 0; - - (void) sscanf (array, "%d", &val); - - return val; -} - - -/* myesc - return character corresponding to escape sequence */ - -Char myesc (array) - Char array[]; -{ - Char c, esc_char; - - switch (array[1]) { - case 'b': - return '\b'; - case 'f': - return '\f'; - case 'n': - return '\n'; - case 'r': - return '\r'; - case 't': - return '\t'; - -#if __STDC__ - case 'a': - return '\a'; - case 'v': - return '\v'; -#else - case 'a': - return '\007'; - case 'v': - return '\013'; -#endif - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - { /* \ */ - int sptr = 1; - - while (isascii (array[sptr]) && - isdigit (array[sptr])) - /* Don't increment inside loop control - * because if isdigit() is a macro it might - * expand into multiple increments ... - */ - ++sptr; - - c = array[sptr]; - array[sptr] = '\0'; - - esc_char = otoi (array + 1); - - array[sptr] = c; - - return esc_char; - } - - case 'x': - { /* \x */ - int sptr = 2; - - while (isascii (array[sptr]) && - isxdigit ((char) array[sptr])) - /* Don't increment inside loop control - * because if isdigit() is a macro it might - * expand into multiple increments ... - */ - ++sptr; - - c = array[sptr]; - array[sptr] = '\0'; - - esc_char = htoi (array + 2); - - array[sptr] = c; - - return esc_char; - } - - default: - return array[1]; - } -} - - -/* otoi - convert an octal digit string to an integer value */ - -int otoi (str) - Char str[]; -{ - unsigned int result; - - (void) sscanf ((char *) str, "%o", &result); - return result; -} - - -/* out - various flavors of outputing a (possibly formatted) string for the - * generated scanner, keeping track of the line count. - */ - -void out (str) - const char *str; -{ - fputs (str, stdout); - out_line_count (str); -} - -void out_dec (fmt, n) - const char *fmt; - int n; -{ - fprintf (stdout, fmt, n); - out_line_count (fmt); -} - -void out_dec2 (fmt, n1, n2) - const char *fmt; - int n1, n2; -{ - fprintf (stdout, fmt, n1, n2); - out_line_count (fmt); -} - -void out_hex (fmt, x) - const char *fmt; - unsigned int x; -{ - fprintf (stdout, fmt, x); - out_line_count (fmt); -} - -void out_line_count (str) - const char *str; -{ - register int i; - - for (i = 0; str[i]; ++i) - if (str[i] == '\n') - ++out_linenum; -} - -void out_str (fmt, str) - const char *fmt, str[]; -{ - fprintf (stdout,fmt, str); - out_line_count (fmt); - out_line_count (str); -} - -void out_str3 (fmt, s1, s2, s3) - const char *fmt, s1[], s2[], s3[]; -{ - fprintf (stdout,fmt, s1, s2, s3); - out_line_count (fmt); - out_line_count (s1); - out_line_count (s2); - out_line_count (s3); -} - -void out_str_dec (fmt, str, n) - const char *fmt, str[]; - int n; -{ - fprintf (stdout,fmt, str, n); - out_line_count (fmt); - out_line_count (str); -} - -void outc (c) - int c; -{ - fputc (c, stdout); - - if (c == '\n') - ++out_linenum; -} - -void outn (str) - const char *str; -{ - fputs (str,stdout); - fputc('\n',stdout); - out_line_count (str); - ++out_linenum; -} - -/** Print "m4_define( [[def]], [[val]])m4_dnl\n". - * @param def The m4 symbol to define. - * @param val The definition; may be NULL. - * @return buf - */ -void out_m4_define (const char* def, const char* val) -{ - const char * fmt = "m4_define( [[%s]], [[%s]])m4_dnl\n"; - fprintf(stdout, fmt, def, val?val:""); -} - - -/* readable_form - return the the human-readable form of a character - * - * The returned string is in static storage. - */ - -char *readable_form (c) - register int c; -{ - static char rform[10]; - - if ((c >= 0 && c < 32) || c >= 127) { - switch (c) { - case '\b': - return "\\b"; - case '\f': - return "\\f"; - case '\n': - return "\\n"; - case '\r': - return "\\r"; - case '\t': - return "\\t"; - -#if __STDC__ - case '\a': - return "\\a"; - case '\v': - return "\\v"; -#endif - - default: - (void) sprintf (rform, "\\%.3o", (unsigned int) c); - return rform; - } - } - - else if (c == ' ') - return "' '"; - - else { - rform[0] = c; - rform[1] = '\0'; - - return rform; - } -} - - -/* reallocate_array - increase the size of a dynamic array */ - -void *reallocate_array (array, size, element_size) - void *array; - int size; - size_t element_size; -{ - register void *new_array; - size_t num_bytes = element_size * size; - - new_array = flex_realloc (array, num_bytes); - if (!new_array) - flexfatal (_("attempt to increase array size failed")); - - return new_array; -} - - -/* skelout - write out one section of the skeleton file - * - * Description - * Copies skelfile or skel array to stdout until a line beginning with - * "%%" or EOF is found. - */ -void skelout () -{ - char buf_storage[MAXLINE]; - char *buf = buf_storage; - bool do_copy = true; - - /* "reset" the state by clearing the buffer and pushing a '1' */ - if(sko_len > 0) - sko_peek(&do_copy); - sko_len = 0; - sko_push(do_copy=true); - - - /* Loop pulling lines either from the skelfile, if we're using - * one, or from the skel[] array. - */ - while (skelfile ? - (fgets (buf, MAXLINE, skelfile) != NULL) : - ((buf = (char *) skel[skel_ind++]) != 0)) { - - if (skelfile) - chomp (buf); - - /* copy from skel array */ - if (buf[0] == '%') { /* control line */ - /* print the control line as a comment. */ - if (ddebug && buf[1] != '#') { - if (buf[strlen (buf) - 1] == '\\') - out_str ("/* %s */\\\n", buf); - else - out_str ("/* %s */\n", buf); - } - - /* We've been accused of using cryptic markers in the skel. - * So we'll use emacs-style-hyphenated-commands. - * We might consider a hash if this if-else-if-else - * chain gets too large. - */ -#define cmd_match(s) (strncmp(buf,(s),strlen(s))==0) - - if (buf[1] == '%') { - /* %% is a break point for skelout() */ - return; - } - else if (cmd_match (CMD_PUSH)){ - sko_push(do_copy); - if(ddebug){ - out_str("/*(state = (%s) */",do_copy?"true":"false"); - } - out_str("%s\n", buf[strlen (buf) - 1] =='\\' ? "\\" : ""); - } - else if (cmd_match (CMD_POP)){ - sko_pop(&do_copy); - if(ddebug){ - out_str("/*(state = (%s) */",do_copy?"true":"false"); - } - out_str("%s\n", buf[strlen (buf) - 1] =='\\' ? "\\" : ""); - } - else if (cmd_match (CMD_IF_REENTRANT)){ - sko_push(do_copy); - do_copy = reentrant && do_copy; - } - else if (cmd_match (CMD_IF_NOT_REENTRANT)){ - sko_push(do_copy); - do_copy = !reentrant && do_copy; - } - else if (cmd_match(CMD_IF_BISON_BRIDGE)){ - sko_push(do_copy); - do_copy = bison_bridge_lval && do_copy; - } - else if (cmd_match(CMD_IF_NOT_BISON_BRIDGE)){ - sko_push(do_copy); - do_copy = !bison_bridge_lval && do_copy; - } - else if (cmd_match (CMD_ENDIF)){ - sko_pop(&do_copy); - } - else if (cmd_match (CMD_IF_TABLES_SER)) { - do_copy = do_copy && tablesext; - } - else if (cmd_match (CMD_TABLES_YYDMAP)) { - if (tablesext && yydmap_buf.elts) - outn ((char *) (yydmap_buf.elts)); - } - else if (cmd_match (CMD_DEFINE_YYTABLES)) { - out_str("#define YYTABLES_NAME \"%s\"\n", - tablesname?tablesname:"yytables"); - } - else if (cmd_match (CMD_IF_CPP_ONLY)) { - /* only for C++ */ - sko_push(do_copy); - do_copy = C_plus_plus; - } - else if (cmd_match (CMD_IF_C_ONLY)) { - /* %- only for C */ - sko_push(do_copy); - do_copy = !C_plus_plus; - } - else if (cmd_match (CMD_IF_C_OR_CPP)) { - /* %* for C and C++ */ - sko_push(do_copy); - do_copy = true; - } - else if (cmd_match (CMD_NOT_FOR_HEADER)) { - /* %c begin linkage-only (non-header) code. */ - OUT_BEGIN_CODE (); - } - else if (cmd_match (CMD_OK_FOR_HEADER)) { - /* %e end linkage-only code. */ - OUT_END_CODE (); - } - else if (buf[1] == '#') { - /* %# a comment in the skel. ignore. */ - } - else { - flexfatal (_("bad line in skeleton file")); - } - } - - else if (do_copy) - outn (buf); - } /* end while */ -} - - -/* transition_struct_out - output a yy_trans_info structure - * - * outputs the yy_trans_info structure with the two elements, element_v and - * element_n. Formats the output with spaces and carriage returns. - */ - -void transition_struct_out (element_v, element_n) - int element_v, element_n; -{ - - /* short circuit any output */ - if (!gentables) - return; - - out_dec2 (" {%4d,%4d },", element_v, element_n); - - datapos += TRANS_STRUCT_PRINT_LENGTH; - - if (datapos >= 79 - TRANS_STRUCT_PRINT_LENGTH) { - outc ('\n'); - - if (++dataline % 10 == 0) - outc ('\n'); - - datapos = 0; - } -} - - -/* The following is only needed when building flex's parser using certain - * broken versions of bison. - */ -void *yy_flex_xmalloc (size) - int size; -{ - void *result = flex_alloc ((size_t) size); - - if (!result) - flexfatal (_ - ("memory allocation failed in yy_flex_xmalloc()")); - - return result; -} - - -/* zero_out - set a region of memory to 0 - * - * Sets region_ptr[0] through region_ptr[size_in_bytes - 1] to zero. - */ - -void zero_out (region_ptr, size_in_bytes) - char *region_ptr; - size_t size_in_bytes; -{ - register char *rp, *rp_end; - - rp = region_ptr; - rp_end = region_ptr + size_in_bytes; - - while (rp < rp_end) - *rp++ = 0; -} - -/* Remove all '\n' and '\r' characters, if any, from the end of str. - * str can be any null-terminated string, or NULL. - * returns str. */ -char *chomp (str) - char *str; -{ - char *p = str; - - if (!str || !*str) /* s is null or empty string */ - return str; - - /* find end of string minus one */ - while (*p) - ++p; - --p; - - /* eat newlines */ - while (p >= str && (*p == '\r' || *p == '\n')) - *p-- = 0; - return str; -} diff --git a/src/bin/flex/missing b/src/bin/flex/missing deleted file mode 100755 index 6a37006e8f..0000000000 --- a/src/bin/flex/missing +++ /dev/null @@ -1,336 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997, 1999, 2000, 2002 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 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# 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=: - -# 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 - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - - -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' - 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]" - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing 0.4 - GNU automake" - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - - aclocal*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the - proper tools for further handling them. - You can get \`$1Help2man' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - 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' is missing on your system. 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 [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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 [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then - # We have makeinfo, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - touch $file - ;; - - tar) - shift - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - fi - - # 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 you do not seem to have it handy on your - system. 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 prerequirements 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 diff --git a/src/bin/flex/mkinstalldirs b/src/bin/flex/mkinstalldirs deleted file mode 100644 index d2d5f21b61..0000000000 --- a/src/bin/flex/mkinstalldirs +++ /dev/null @@ -1,111 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." - -# process command line arguments -while test $# -gt 0 ; do - case $1 in - -h | --help | --h*) # -h for help - echo "$usage" 1>&2 - exit 0 - ;; - -m) # -m PERM arg - shift - test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } - dirmode=$1 - shift - ;; - --) # stop option processing - shift - break - ;; - -*) # unknown option - echo "$usage" 1>&2 - exit 1 - ;; - *) # first non-opt arg - break - ;; - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in - 0) exit 0 ;; -esac - -case $dirmode in - '') - if mkdir -p -- . 2>/dev/null; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - fi - ;; - *) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - fi - ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case $pathcomp in - -*) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# End: -# mkinstalldirs ends here diff --git a/src/bin/flex/mkskel.sh b/src/bin/flex/mkskel.sh deleted file mode 100644 index 02c397a81c..0000000000 --- a/src/bin/flex/mkskel.sh +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/sh - -# This file is part of flex. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: - -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. - -# Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. - -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE. - -cat < 0) - fprintf (stderr, - _ - ("Variable trailing context rule at line %d\n"), - rule_linenum[num_rules]); - - variable_trailing_context_rules = true; - } - - else { - rule_type[num_rules] = RULE_NORMAL; - - if (headcnt > 0 || trailcnt > 0) { - /* Do trailing context magic to not match the trailing - * characters. - */ - char *scanner_cp = "YY_G(yy_c_buf_p) = yy_cp"; - char *scanner_bp = "yy_bp"; - - add_action - ("*yy_cp = YY_G(yy_hold_char); /* undo effects of setting up yytext */\n"); - - if (headcnt > 0) { - sprintf (action_text, "%s = %s + %d;\n", - scanner_cp, scanner_bp, headcnt); - add_action (action_text); - } - - else { - sprintf (action_text, "%s -= %d;\n", - scanner_cp, trailcnt); - add_action (action_text); - } - - add_action - ("YY_DO_BEFORE_ACTION; /* set up yytext again */\n"); - } - } - - /* Okay, in the action code at this point yytext and yyleng have - * their proper final values for this rule, so here's the point - * to do any user action. But don't do it for continued actions, - * as that'll result in multiple YY_RULE_SETUP's. - */ - if (!continued_action) - add_action ("YY_RULE_SETUP\n"); - - line_directive_out ((FILE *) 0, 1); -} - - -/* link_machines - connect two machines together - * - * synopsis - * - * new = link_machines( first, last ); - * - * new - a machine constructed by connecting first to last - * first - the machine whose successor is to be last - * last - the machine whose predecessor is to be first - * - * note: this routine concatenates the machine first with the machine - * last to produce a machine new which will pattern-match first first - * and then last, and will fail if either of the sub-patterns fails. - * FIRST is set to new by the operation. last is unmolested. - */ - -int link_machines (first, last) - int first, last; -{ - if (first == NIL) - return last; - - else if (last == NIL) - return first; - - else { - mkxtion (finalst[first], last); - finalst[first] = finalst[last]; - lastst[first] = MAX (lastst[first], lastst[last]); - firstst[first] = MIN (firstst[first], firstst[last]); - - return first; - } -} - - -/* mark_beginning_as_normal - mark each "beginning" state in a machine - * as being a "normal" (i.e., not trailing context- - * associated) states - * - * The "beginning" states are the epsilon closure of the first state - */ - -void mark_beginning_as_normal (mach) - register int mach; -{ - switch (state_type[mach]) { - case STATE_NORMAL: - /* Oh, we've already visited here. */ - return; - - case STATE_TRAILING_CONTEXT: - state_type[mach] = STATE_NORMAL; - - if (transchar[mach] == SYM_EPSILON) { - if (trans1[mach] != NO_TRANSITION) - mark_beginning_as_normal (trans1[mach]); - - if (trans2[mach] != NO_TRANSITION) - mark_beginning_as_normal (trans2[mach]); - } - break; - - default: - flexerror (_ - ("bad state type in mark_beginning_as_normal()")); - break; - } -} - - -/* mkbranch - make a machine that branches to two machines - * - * synopsis - * - * branch = mkbranch( first, second ); - * - * branch - a machine which matches either first's pattern or second's - * first, second - machines whose patterns are to be or'ed (the | operator) - * - * Note that first and second are NEITHER destroyed by the operation. Also, - * the resulting machine CANNOT be used with any other "mk" operation except - * more mkbranch's. Compare with mkor() - */ - -int mkbranch (first, second) - int first, second; -{ - int eps; - - if (first == NO_TRANSITION) - return second; - - else if (second == NO_TRANSITION) - return first; - - eps = mkstate (SYM_EPSILON); - - mkxtion (eps, first); - mkxtion (eps, second); - - return eps; -} - - -/* mkclos - convert a machine into a closure - * - * synopsis - * new = mkclos( state ); - * - * new - a new state which matches the closure of "state" - */ - -int mkclos (state) - int state; -{ - return mkopt (mkposcl (state)); -} - - -/* mkopt - make a machine optional - * - * synopsis - * - * new = mkopt( mach ); - * - * new - a machine which optionally matches whatever mach matched - * mach - the machine to make optional - * - * notes: - * 1. mach must be the last machine created - * 2. mach is destroyed by the call - */ - -int mkopt (mach) - int mach; -{ - int eps; - - if (!SUPER_FREE_EPSILON (finalst[mach])) { - eps = mkstate (SYM_EPSILON); - mach = link_machines (mach, eps); - } - - /* Can't skimp on the following if FREE_EPSILON(mach) is true because - * some state interior to "mach" might point back to the beginning - * for a closure. - */ - eps = mkstate (SYM_EPSILON); - mach = link_machines (eps, mach); - - mkxtion (mach, finalst[mach]); - - return mach; -} - - -/* mkor - make a machine that matches either one of two machines - * - * synopsis - * - * new = mkor( first, second ); - * - * new - a machine which matches either first's pattern or second's - * first, second - machines whose patterns are to be or'ed (the | operator) - * - * note that first and second are both destroyed by the operation - * the code is rather convoluted because an attempt is made to minimize - * the number of epsilon states needed - */ - -int mkor (first, second) - int first, second; -{ - int eps, orend; - - if (first == NIL) - return second; - - else if (second == NIL) - return first; - - else { - /* See comment in mkopt() about why we can't use the first - * state of "first" or "second" if they satisfy "FREE_EPSILON". - */ - eps = mkstate (SYM_EPSILON); - - first = link_machines (eps, first); - - mkxtion (first, second); - - if (SUPER_FREE_EPSILON (finalst[first]) && - accptnum[finalst[first]] == NIL) { - orend = finalst[first]; - mkxtion (finalst[second], orend); - } - - else if (SUPER_FREE_EPSILON (finalst[second]) && - accptnum[finalst[second]] == NIL) { - orend = finalst[second]; - mkxtion (finalst[first], orend); - } - - else { - eps = mkstate (SYM_EPSILON); - - first = link_machines (first, eps); - orend = finalst[first]; - - mkxtion (finalst[second], orend); - } - } - - finalst[first] = orend; - return first; -} - - -/* mkposcl - convert a machine into a positive closure - * - * synopsis - * new = mkposcl( state ); - * - * new - a machine matching the positive closure of "state" - */ - -int mkposcl (state) - int state; -{ - int eps; - - if (SUPER_FREE_EPSILON (finalst[state])) { - mkxtion (finalst[state], state); - return state; - } - - else { - eps = mkstate (SYM_EPSILON); - mkxtion (eps, state); - return link_machines (state, eps); - } -} - - -/* mkrep - make a replicated machine - * - * synopsis - * new = mkrep( mach, lb, ub ); - * - * new - a machine that matches whatever "mach" matched from "lb" - * number of times to "ub" number of times - * - * note - * if "ub" is INFINITE_REPEAT then "new" matches "lb" or more occurrences of "mach" - */ - -int mkrep (mach, lb, ub) - int mach, lb, ub; -{ - int base_mach, tail, copy, i; - - base_mach = copysingl (mach, lb - 1); - - if (ub == INFINITE_REPEAT) { - copy = dupmachine (mach); - mach = link_machines (mach, - link_machines (base_mach, - mkclos (copy))); - } - - else { - tail = mkstate (SYM_EPSILON); - - for (i = lb; i < ub; ++i) { - copy = dupmachine (mach); - tail = mkopt (link_machines (copy, tail)); - } - - mach = - link_machines (mach, - link_machines (base_mach, tail)); - } - - return mach; -} - - -/* mkstate - create a state with a transition on a given symbol - * - * synopsis - * - * state = mkstate( sym ); - * - * state - a new state matching sym - * sym - the symbol the new state is to have an out-transition on - * - * note that this routine makes new states in ascending order through the - * state array (and increments LASTNFA accordingly). The routine DUPMACHINE - * relies on machines being made in ascending order and that they are - * CONTIGUOUS. Change it and you will have to rewrite DUPMACHINE (kludge - * that it admittedly is) - */ - -int mkstate (sym) - int sym; -{ - if (++lastnfa >= current_mns) { - if ((current_mns += MNS_INCREMENT) >= maximum_mns) - lerrif (_ - ("input rules are too complicated (>= %d NFA states)"), -current_mns); - - ++num_reallocs; - - firstst = reallocate_integer_array (firstst, current_mns); - lastst = reallocate_integer_array (lastst, current_mns); - finalst = reallocate_integer_array (finalst, current_mns); - transchar = - reallocate_integer_array (transchar, current_mns); - trans1 = reallocate_integer_array (trans1, current_mns); - trans2 = reallocate_integer_array (trans2, current_mns); - accptnum = - reallocate_integer_array (accptnum, current_mns); - assoc_rule = - reallocate_integer_array (assoc_rule, current_mns); - state_type = - reallocate_integer_array (state_type, current_mns); - } - - firstst[lastnfa] = lastnfa; - finalst[lastnfa] = lastnfa; - lastst[lastnfa] = lastnfa; - transchar[lastnfa] = sym; - trans1[lastnfa] = NO_TRANSITION; - trans2[lastnfa] = NO_TRANSITION; - accptnum[lastnfa] = NIL; - assoc_rule[lastnfa] = num_rules; - state_type[lastnfa] = current_state_type; - - /* Fix up equivalence classes base on this transition. Note that any - * character which has its own transition gets its own equivalence - * class. Thus only characters which are only in character classes - * have a chance at being in the same equivalence class. E.g. "a|b" - * puts 'a' and 'b' into two different equivalence classes. "[ab]" - * puts them in the same equivalence class (barring other differences - * elsewhere in the input). - */ - - if (sym < 0) { - /* We don't have to update the equivalence classes since - * that was already done when the ccl was created for the - * first time. - */ - } - - else if (sym == SYM_EPSILON) - ++numeps; - - else { - check_char (sym); - - if (useecs) - /* Map NUL's to csize. */ - mkechar (sym ? sym : csize, nextecm, ecgroup); - } - - return lastnfa; -} - - -/* mkxtion - make a transition from one state to another - * - * synopsis - * - * mkxtion( statefrom, stateto ); - * - * statefrom - the state from which the transition is to be made - * stateto - the state to which the transition is to be made - */ - -void mkxtion (statefrom, stateto) - int statefrom, stateto; -{ - if (trans1[statefrom] == NO_TRANSITION) - trans1[statefrom] = stateto; - - else if ((transchar[statefrom] != SYM_EPSILON) || - (trans2[statefrom] != NO_TRANSITION)) - flexfatal (_("found too many transitions in mkxtion()")); - - else { /* second out-transition for an epsilon state */ - ++eps2; - trans2[statefrom] = stateto; - } -} - -/* new_rule - initialize for a new rule */ - -void new_rule () -{ - if (++num_rules >= current_max_rules) { - ++num_reallocs; - current_max_rules += MAX_RULES_INCREMENT; - rule_type = reallocate_integer_array (rule_type, - current_max_rules); - rule_linenum = reallocate_integer_array (rule_linenum, - current_max_rules); - rule_useful = reallocate_integer_array (rule_useful, - current_max_rules); - rule_has_nl = reallocate_bool_array (rule_has_nl, - current_max_rules); - } - - if (num_rules > MAX_RULE) - lerrif (_("too many rules (> %d)!"), MAX_RULE); - - rule_linenum[num_rules] = linenum; - rule_useful[num_rules] = false; - rule_has_nl[num_rules] = false; -} diff --git a/src/bin/flex/options.c b/src/bin/flex/options.c deleted file mode 100644 index c6731738a1..0000000000 --- a/src/bin/flex/options.c +++ /dev/null @@ -1,280 +0,0 @@ -/* flex - tool to generate fast lexical analyzers */ - -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -#include "options.h" - -/* Be sure to synchronize these options with those defined in "options.h", - * the giant switch() statement in "main.c", and the %option processing in - * "scan.l". - */ - - -/* The command-line options, passed to scanopt_init() */ -optspec_t flexopts[] = { - - {"-7", OPT_7BIT, 0} - , - {"--7bit", OPT_7BIT, 0} - , /* Generate 7-bit scanner. */ - {"-8", OPT_8BIT, 0} - , - {"--8bit", OPT_8BIT, 0} - , /* Generate 8-bit scanner. */ - {"--align", OPT_ALIGN, 0} - , /* Trade off larger tables for better memory alignment. */ - {"--noalign", OPT_NO_ALIGN, 0} - , - {"--always-interactive", OPT_ALWAYS_INTERACTIVE, 0} - , - {"--array", OPT_ARRAY, 0} - , - {"-b", OPT_BACKUP, 0} - , - {"--backup", OPT_BACKUP, 0} - , /* Generate backing-up information to lex.backup. */ - {"-B", OPT_BATCH, 0} - , - {"--batch", OPT_BATCH, 0} - , /* Generate batch scanner (opposite of -I). */ - {"--bison-bridge", OPT_BISON_BRIDGE, 0} - , /* Scanner to be called by a bison pure parser. */ - {"--bison-locations", OPT_BISON_BRIDGE_LOCATIONS, 0} - , /* Scanner to be called by a bison pure parser. */ - {"-i", OPT_CASE_INSENSITIVE, 0} - , - {"--case-insensitive", OPT_CASE_INSENSITIVE, 0} - , /* Generate case-insensitive scanner. */ - - {"-C[aefFmr]", OPT_COMPRESSION, - "Specify degree of table compression (default is -Cem)"}, - {"-+", OPT_CPLUSPLUS, 0} - , - {"--c++", OPT_CPLUSPLUS, 0} - , /* Generate C++ scanner class. */ - {"-d", OPT_DEBUG, 0} - , - {"--debug", OPT_DEBUG, 0} - , /* Turn on debug mode in generated scanner. */ - {"--nodebug", OPT_NO_DEBUG, 0} - , - {"-s", OPT_NO_DEFAULT, 0} - , - {"--nodefault", OPT_NO_DEFAULT, 0} - , /* Suppress default rule to ECHO unmatched text. */ - {"--default", OPT_DEFAULT, 0} - , - {"-c", OPT_DONOTHING, 0} - , /* For POSIX lex compatibility. */ - {"-n", OPT_DONOTHING, 0} - , /* For POSIX lex compatibility. */ - {"--ecs", OPT_ECS, 0} - , /* Construct equivalence classes. */ - {"--noecs", OPT_NO_ECS, 0} - , - {"-F", OPT_FAST, 0} - , - {"--fast", OPT_FAST, 0} - , /* Same as -CFr. */ - {"-f", OPT_FULL, 0} - , - {"--full", OPT_FULL, 0} - , /* Same as -Cfr. */ - {"--header-file[=FILE]", OPT_HEADER_FILE, 0} - , - {"-?", OPT_HELP, 0} - , - {"-h", OPT_HELP, 0} - , - {"--help", OPT_HELP, 0} - , /* Produce this help message. */ - {"-I", OPT_INTERACTIVE, 0} - , - {"--interactive", OPT_INTERACTIVE, 0} - , /* Generate interactive scanner (opposite of -B). */ - {"-l", OPT_LEX_COMPAT, 0} - , - {"--lex-compat", OPT_LEX_COMPAT, 0} - , /* Maximal compatibility with original lex. */ - {"-X", OPT_POSIX_COMPAT, 0} - , - {"--posix-compat", OPT_POSIX_COMPAT, 0} - , /* Maximal compatibility with POSIX lex. */ - {"--preproc=NUM", OPT_PREPROC_LEVEL, 0} - , - {"-L", OPT_NO_LINE, 0} - , /* Suppress #line directives in scanner. */ - {"--noline", OPT_NO_LINE, 0} - , /* Suppress #line directives in scanner. */ - {"--main", OPT_MAIN, 0} - , /* use built-in main() function. */ - {"--nomain", OPT_NO_MAIN, 0} - , - {"--meta-ecs", OPT_META_ECS, 0} - , /* Construct meta-equivalence classes. */ - {"--nometa-ecs", OPT_NO_META_ECS, 0} - , - {"--never-interactive", OPT_NEVER_INTERACTIVE, 0} - , - {"-o FILE", OPT_OUTFILE, 0} - , - {"--outfile=FILE", OPT_OUTFILE, 0} - , /* Write to FILE (default is lex.yy.c) */ - {"-p", OPT_PERF_REPORT, 0} - , - {"--perf-report", OPT_PERF_REPORT, 0} - , /* Generate performance report to stderr. */ - {"--pointer", OPT_POINTER, 0} - , - {"-P PREFIX", OPT_PREFIX, 0} - , - {"--prefix=PREFIX", OPT_PREFIX, 0} - , /* Use PREFIX (default is yy) */ - {"-Dmacro", OPT_PREPROCDEFINE, 0} - , /* Define a preprocessor symbol. */ - {"--read", OPT_READ, 0} - , /* Use read(2) instead of stdio. */ - {"-R", OPT_REENTRANT, 0} - , - {"--reentrant", OPT_REENTRANT, 0} - , /* Generate a reentrant C scanner. */ - {"--noreentrant", OPT_NO_REENTRANT, 0} - , - {"--reject", OPT_REJECT, 0} - , - {"--noreject", OPT_NO_REJECT, 0} - , - {"-S FILE", OPT_SKEL, 0} - , - {"--skel=FILE", OPT_SKEL, 0} - , /* Use skeleton from FILE */ - {"--stack", OPT_STACK, 0} - , - {"--stdinit", OPT_STDINIT, 0} - , - {"--nostdinit", OPT_NO_STDINIT, 0} - , - {"-t", OPT_STDOUT, 0} - , - {"--stdout", OPT_STDOUT, 0} - , /* Write generated scanner to stdout. */ - {"-T", OPT_TRACE, 0} - , - {"--trace", OPT_TRACE, 0} - , /* Flex should run in trace mode. */ - {"--tables-file[=FILE]", OPT_TABLES_FILE, 0} - , /* Save tables to FILE */ - {"--tables-verify", OPT_TABLES_VERIFY, 0} - , /* Tables integrity check */ - {"--nounistd", OPT_NO_UNISTD_H, 0} - , /* Do not include unistd.h */ - {"-v", OPT_VERBOSE, 0} - , - {"--verbose", OPT_VERBOSE, 0} - , /* Write summary of scanner statistics to stdout. */ - {"-V", OPT_VERSION, 0} - , - {"--version", OPT_VERSION, 0} - , /* Report flex version. */ - {"--warn", OPT_WARN, 0} - , - {"-w", OPT_NO_WARN, 0} - , - {"--nowarn", OPT_NO_WARN, 0} - , /* Suppress warning messages. */ - {"--noansi-definitions", OPT_NO_ANSI_FUNC_DEFS, 0} - , - {"--noansi-prototypes", OPT_NO_ANSI_FUNC_PROTOS, 0} - , - {"--yyclass=NAME", OPT_YYCLASS, 0} - , - {"--yylineno", OPT_YYLINENO, 0} - , - {"--noyylineno", OPT_NO_YYLINENO, 0} - , - - {"--yymore", OPT_YYMORE, 0} - , - {"--noyymore", OPT_NO_YYMORE, 0} - , - {"--noyywrap", OPT_NO_YYWRAP, 0} - , - {"--yywrap", OPT_YYWRAP, 0} - , - - {"--nounput", OPT_NO_UNPUT, 0} - , - {"--noyy_push_state", OPT_NO_YY_PUSH_STATE, 0} - , - {"--noyy_pop_state", OPT_NO_YY_POP_STATE, 0} - , - {"--noyy_top_state", OPT_NO_YY_TOP_STATE, 0} - , - {"--noyy_scan_buffer", OPT_NO_YY_SCAN_BUFFER, 0} - , - {"--noyy_scan_bytes", OPT_NO_YY_SCAN_BYTES, 0} - , - {"--noyy_scan_string", OPT_NO_YY_SCAN_STRING, 0} - , - {"--noyyget_extra", OPT_NO_YYGET_EXTRA, 0} - , - {"--noyyset_extra", OPT_NO_YYSET_EXTRA, 0} - , - {"--noyyget_leng", OPT_NO_YYGET_LENG, 0} - , - {"--noyyget_text", OPT_NO_YYGET_TEXT, 0} - , - {"--noyyget_lineno", OPT_NO_YYGET_LINENO, 0} - , - {"--noyyset_lineno", OPT_NO_YYSET_LINENO, 0} - , - {"--noyyget_in", OPT_NO_YYGET_IN, 0} - , - {"--noyyset_in", OPT_NO_YYSET_IN, 0} - , - {"--noyyget_out", OPT_NO_YYGET_OUT, 0} - , - {"--noyyset_out", OPT_NO_YYSET_OUT, 0} - , - {"--noyyget_lval", OPT_NO_YYGET_LVAL, 0} - , - {"--noyyset_lval", OPT_NO_YYSET_LVAL, 0} - , - {"--noyyget_lloc", OPT_NO_YYGET_LLOC, 0} - , - {"--noyyset_lloc", OPT_NO_YYSET_LLOC, 0} - , - - {0, 0, 0} /* required final NULL entry. */ -}; - -/* vim:set tabstop=8 softtabstop=4 shiftwidth=4: */ diff --git a/src/bin/flex/options.h b/src/bin/flex/options.h deleted file mode 100644 index 1f3925b9e9..0000000000 --- a/src/bin/flex/options.h +++ /dev/null @@ -1,134 +0,0 @@ -/* flex - tool to generate fast lexical analyzers */ - -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -#ifndef OPTIONS_H -#define OPTIONS_H -#include "scanopt.h" - -extern optspec_t flexopts[]; - -enum flexopt_flag_t { - /* Use positive integers only, since they are return codes for scanopt. - * Order is not important. */ - OPT_7BIT = 1, - OPT_8BIT, - OPT_ALIGN, - OPT_ALWAYS_INTERACTIVE, - OPT_ARRAY, - OPT_BACKUP, - OPT_BATCH, - OPT_BISON_BRIDGE, - OPT_BISON_BRIDGE_LOCATIONS, - OPT_CASE_INSENSITIVE, - OPT_COMPRESSION, - OPT_CPLUSPLUS, - OPT_DEBUG, - OPT_DEFAULT, - OPT_DONOTHING, - OPT_ECS, - OPT_FAST, - OPT_FULL, - OPT_HEADER_FILE, - OPT_HELP, - OPT_INTERACTIVE, - OPT_LEX_COMPAT, - OPT_POSIX_COMPAT, - OPT_MAIN, - OPT_META_ECS, - OPT_NEVER_INTERACTIVE, - OPT_NO_ALIGN, - OPT_NO_ANSI_FUNC_DEFS, - OPT_NO_ANSI_FUNC_PROTOS, - OPT_NO_DEBUG, - OPT_NO_DEFAULT, - OPT_NO_ECS, - OPT_NO_LINE, - OPT_NO_MAIN, - OPT_NO_META_ECS, - OPT_NO_REENTRANT, - OPT_NO_REJECT, - OPT_NO_STDINIT, - OPT_NO_UNPUT, - OPT_NO_WARN, - OPT_NO_YYGET_EXTRA, - OPT_NO_YYGET_IN, - OPT_NO_YYGET_LENG, - OPT_NO_YYGET_LINENO, - OPT_NO_YYGET_LLOC, - OPT_NO_YYGET_LVAL, - OPT_NO_YYGET_OUT, - OPT_NO_YYGET_TEXT, - OPT_NO_YYLINENO, - OPT_NO_YYMORE, - OPT_NO_YYSET_EXTRA, - OPT_NO_YYSET_IN, - OPT_NO_YYSET_LINENO, - OPT_NO_YYSET_LLOC, - OPT_NO_YYSET_LVAL, - OPT_NO_YYSET_OUT, - OPT_NO_YYWRAP, - OPT_NO_YY_POP_STATE, - OPT_NO_YY_PUSH_STATE, - OPT_NO_YY_SCAN_BUFFER, - OPT_NO_YY_SCAN_BYTES, - OPT_NO_YY_SCAN_STRING, - OPT_NO_YY_TOP_STATE, - OPT_OUTFILE, - OPT_PERF_REPORT, - OPT_POINTER, - OPT_PREFIX, - OPT_PREPROCDEFINE, - OPT_PREPROC_LEVEL, - OPT_READ, - OPT_REENTRANT, - OPT_REJECT, - OPT_SKEL, - OPT_STACK, - OPT_STDINIT, - OPT_STDOUT, - OPT_TABLES_FILE, - OPT_TABLES_VERIFY, - OPT_TRACE, - OPT_NO_UNISTD_H, - OPT_VERBOSE, - OPT_VERSION, - OPT_WARN, - OPT_YYCLASS, - OPT_YYLINENO, - OPT_YYMORE, - OPT_YYWRAP -}; - -#endif - -/* vim:set tabstop=8 softtabstop=4 shiftwidth=4 textwidth=0: */ diff --git a/src/bin/flex/parse.c b/src/bin/flex/parse.c deleted file mode 100644 index 08b1e9e33c..0000000000 --- a/src/bin/flex/parse.c +++ /dev/null @@ -1,2103 +0,0 @@ - -/* A Bison parser, made from parse.y - by GNU Bison version 1.28 */ - -#define YYBISON 1 /* Identify Bison output. */ - -#define CHAR 257 -#define NUMBER 258 -#define SECTEND 259 -#define SCDECL 260 -#define XSCDECL 261 -#define NAME 262 -#define PREVCCL 263 -#define EOF_OP 264 -#define OPTION_OP 265 -#define OPT_OUTFILE 266 -#define OPT_PREFIX 267 -#define OPT_YYCLASS 268 -#define OPT_HEADER 269 -#define OPT_TABLES 270 -#define CCE_ALNUM 271 -#define CCE_ALPHA 272 -#define CCE_BLANK 273 -#define CCE_CNTRL 274 -#define CCE_DIGIT 275 -#define CCE_GRAPH 276 -#define CCE_LOWER 277 -#define CCE_PRINT 278 -#define CCE_PUNCT 279 -#define CCE_SPACE 280 -#define CCE_UPPER 281 -#define CCE_XDIGIT 282 -#define BEGIN_REPEAT_POSIX 283 -#define END_REPEAT_POSIX 284 -#define BEGIN_REPEAT_FLEX 285 -#define END_REPEAT_FLEX 286 - -#line 29 "parse.y" - -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -/* Some versions of bison are broken in that they use alloca() but don't - * declare it properly. The following is the patented (just kidding!) - * #ifdef chud to fix the problem, courtesy of Francois Pinard. - */ -#ifdef YYBISON -/* AIX requires this to be the first thing in the file. What a piece. */ -# ifdef _AIX - #pragma alloca -# endif -#endif - -#include "flexdef.h" -#include "tables.h" - -/* The remainder of the alloca() cruft has to come after including flexdef.h, - * so HAVE_ALLOCA_H is (possibly) defined. - */ -#ifdef YYBISON -# ifdef __GNUC__ -# ifndef alloca -# define alloca __builtin_alloca -# endif -# else -# if HAVE_ALLOCA_H -# include -# else -# ifdef __hpux -void *alloca (); -# else -# ifdef __TURBOC__ -# include -# else -char *alloca (); -# endif -# endif -# endif -# endif -#endif - -/* Bletch, ^^^^ that was ugly! */ - - -int pat, scnum, eps, headcnt, trailcnt, anyccl, lastchar, i, rulelen; -int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule; - -int *scon_stk; -int scon_stk_ptr; - -static int madeany = false; /* whether we've made the '.' character class */ -int previous_continued_action; /* whether the previous rule's action was '|' */ - -#define format_warn3(fmt, a1, a2) \ - do{ \ - char fw3_msg[MAXLINE];\ - snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\ - warn( fw3_msg );\ - }while(0) - -/* Expand a POSIX character class expression. */ -#define CCL_EXPR(func) \ - do{ \ - int c; \ - for ( c = 0; c < csize; ++c ) \ - if ( isascii(c) && func(c) ) \ - ccladd( currccl, c ); \ - }while(0) - -/* While POSIX defines isblank(), it's not ANSI C. */ -#define IS_BLANK(c) ((c) == ' ' || (c) == '\t') - -/* On some over-ambitious machines, such as DEC Alpha's, the default - * token type is "long" instead of "int"; this leads to problems with - * declaring yylval in flexdef.h. But so far, all the yacc's I've seen - * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the - * following should ensure that the default token type is "int". - */ -#define YYSTYPE int - -#ifndef YYSTYPE -#define YYSTYPE int -#endif -#include - -#ifndef __cplusplus -#ifndef __STDC__ -#define const -#endif -#endif - - - -#define YYFINAL 120 -#define YYFLAG -32768 -#define YYNTBASE 54 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 286 ? yytranslate[x] : 79) - -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 34, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 48, 2, 42, 2, 2, 2, 49, - 50, 40, 45, 41, 53, 47, 44, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 38, - 33, 39, 46, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 51, 2, 52, 37, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 35, 43, 36, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 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, 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 -}; - -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 6, 7, 11, 14, 15, 17, 19, 21, 23, - 26, 28, 30, 33, 36, 37, 41, 45, 49, 53, - 57, 63, 69, 70, 71, 74, 76, 78, 80, 81, - 86, 90, 91, 95, 97, 99, 101, 104, 108, 111, - 113, 117, 119, 122, 125, 127, 134, 140, 145, 148, - 151, 154, 161, 167, 172, 174, 176, 178, 182, 186, - 188, 192, 197, 202, 205, 208, 209, 211, 213, 215, - 217, 219, 221, 223, 225, 227, 229, 231, 233, 236 -}; - -static const short yyrhs[] = { 55, - 56, 57, 63, 64, 0, 0, 56, 58, 59, 0, - 56, 60, 0, 0, 1, 0, 5, 0, 6, 0, - 7, 0, 59, 8, 0, 8, 0, 1, 0, 11, - 61, 0, 61, 62, 0, 0, 12, 33, 8, 0, - 13, 33, 8, 0, 14, 33, 8, 0, 15, 33, - 8, 0, 16, 33, 8, 0, 63, 67, 64, 65, - 34, 0, 63, 67, 35, 63, 36, 0, 0, 0, - 37, 70, 0, 70, 0, 10, 0, 1, 0, 0, - 38, 66, 68, 39, 0, 38, 40, 39, 0, 0, - 68, 41, 69, 0, 69, 0, 1, 0, 8, 0, - 72, 71, 0, 72, 71, 42, 0, 71, 42, 0, - 71, 0, 71, 43, 73, 0, 73, 0, 71, 44, - 0, 73, 74, 0, 74, 0, 73, 29, 4, 41, - 4, 30, 0, 73, 29, 4, 41, 30, 0, 73, - 29, 4, 30, 0, 74, 40, 0, 74, 45, 0, - 74, 46, 0, 74, 31, 4, 41, 4, 32, 0, - 74, 31, 4, 41, 32, 0, 74, 31, 4, 32, - 0, 47, 0, 75, 0, 9, 0, 48, 78, 48, - 0, 49, 71, 50, 0, 3, 0, 51, 76, 52, - 0, 51, 37, 76, 52, 0, 76, 3, 53, 3, - 0, 76, 3, 0, 76, 77, 0, 0, 17, 0, - 18, 0, 19, 0, 20, 0, 21, 0, 22, 0, - 23, 0, 24, 0, 25, 0, 26, 0, 27, 0, - 28, 0, 78, 3, 0, 0 -}; - -#endif - -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 142, 171, 179, 180, 181, 182, 186, 194, 197, 201, - 204, 207, 211, 214, 215, 218, 223, 225, 227, 229, - 233, 235, 237, 240, 253, 289, 313, 336, 340, 344, - 347, 364, 368, 370, 372, 376, 399, 455, 458, 501, - 519, 525, 530, 557, 565, 568, 596, 610, 632, 639, - 645, 651, 679, 693, 712, 734, 755, 765, 768, 771, - 785, 788, 795, 849, 860, 867, 875, 876, 877, 878, - 879, 880, 881, 882, 883, 884, 885, 891, 894, 907 -}; -#endif - - -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) - -static const char * const yytname[] = { "$","error","$undefined.","CHAR","NUMBER", -"SECTEND","SCDECL","XSCDECL","NAME","PREVCCL","EOF_OP","OPTION_OP","OPT_OUTFILE", -"OPT_PREFIX","OPT_YYCLASS","OPT_HEADER","OPT_TABLES","CCE_ALNUM","CCE_ALPHA", -"CCE_BLANK","CCE_CNTRL","CCE_DIGIT","CCE_GRAPH","CCE_LOWER","CCE_PRINT","CCE_PUNCT", -"CCE_SPACE","CCE_UPPER","CCE_XDIGIT","BEGIN_REPEAT_POSIX","END_REPEAT_POSIX", -"BEGIN_REPEAT_FLEX","END_REPEAT_FLEX","'='","'\\n'","'{'","'}'","'^'","'<'", -"'>'","'*'","','","'$'","'|'","'/'","'+'","'?'","'.'","'\\\"'","'('","')'","'['", -"']'","'-'","goal","initlex","sect1","sect1end","startconddecl","namelist1", -"options","optionlist","option","sect2","initforrule","flexrule","scon_stk_ptr", -"scon","namelist2","sconname","rule","re","re2","series","singleton","fullccl", -"ccl","ccl_expr","string", NULL -}; -#endif - -static const short yyr1[] = { 0, - 54, 55, 56, 56, 56, 56, 57, 58, 58, 59, - 59, 59, 60, 61, 61, 62, 62, 62, 62, 62, - 63, 63, 63, 64, 65, 65, 65, 65, 66, 67, - 67, 67, 68, 68, 68, 69, 70, 70, 70, 70, - 71, 71, 72, 73, 73, 73, 73, 73, 74, 74, - 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, - 75, 75, 76, 76, 76, 76, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 78, 78 -}; - -static const short yyr2[] = { 0, - 5, 0, 3, 2, 0, 1, 1, 1, 1, 2, - 1, 1, 2, 2, 0, 3, 3, 3, 3, 3, - 5, 5, 0, 0, 2, 1, 1, 1, 0, 4, - 3, 0, 3, 1, 1, 1, 2, 3, 2, 1, - 3, 1, 2, 2, 1, 6, 5, 4, 2, 2, - 2, 6, 5, 4, 1, 1, 1, 3, 3, 1, - 3, 4, 4, 2, 2, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 0 -}; - -static const short yydefact[] = { 2, - 0, 6, 0, 7, 8, 9, 15, 23, 0, 4, - 13, 32, 12, 11, 3, 0, 0, 0, 0, 0, - 14, 29, 1, 24, 10, 0, 0, 0, 0, 0, - 0, 0, 23, 0, 16, 17, 18, 19, 20, 31, - 35, 36, 0, 34, 32, 28, 60, 57, 27, 0, - 55, 80, 0, 66, 0, 26, 40, 0, 42, 45, - 56, 30, 0, 22, 25, 0, 0, 66, 0, 21, - 39, 0, 43, 37, 0, 44, 0, 49, 50, 51, - 33, 79, 58, 59, 0, 64, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 61, 65, - 41, 38, 0, 0, 62, 0, 48, 0, 54, 0, - 63, 0, 47, 0, 53, 46, 52, 0, 0, 0 -}; - -static const short yydefgoto[] = { 118, - 1, 3, 8, 9, 15, 10, 11, 21, 12, 23, - 55, 32, 24, 43, 44, 56, 57, 58, 59, 60, - 61, 69, 100, 66 -}; - -static const short yypact[] = {-32768, - 75,-32768, 61,-32768,-32768,-32768,-32768,-32768, 29,-32768, - 83, 6,-32768,-32768, 24, -19, 9, 32, 37, 46, --32768, 47,-32768, 57,-32768, 96, 100, 101, 102, 103, - 73, 30,-32768, -1,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768, -28,-32768, 67,-32768,-32768,-32768,-32768, 26, --32768,-32768, 26, 76, 80,-32768, 58, 26, 42, 38, --32768,-32768, 107,-32768,-32768, 1, -9,-32768, 0,-32768, --32768, 26,-32768, 64, 112, 38, 113,-32768,-32768,-32768, --32768,-32768,-32768,-32768, 36, 65,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 42,-32768, -25, 53,-32768, 116,-32768, 3,-32768, 8, --32768, 90,-32768, 89,-32768,-32768,-32768, 122, 123,-32768 -}; - -static const short yypgoto[] = {-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 91, 104, --32768,-32768,-32768,-32768, 62, 77, -43,-32768, 54, -58, --32768, 63,-32768,-32768 -}; - - -#define YYLAST 131 - - -static const short yytable[] = { 46, - 76, 47, 86, 82, 107, -24, 112, 48, 49, 67, - 62, 114, 63, 26, 74, 108, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 47, 13, - 41, 25, 113, 72, 48, 50, 14, 42, 86, 115, - 84, 27, 76, 22, 47, 51, 52, 53, 83, 54, - 48, 99, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 28, 4, 5, 6, 77, 29, - 75, 7, 51, 52, 53, 2, 54, 78, 30, -5, - -5, -5, 79, 80, 109, -5, 31, 105, 51, 52, - 53, 33, 54, 110, 16, 17, 18, 19, 20, 71, - 72, 73, 64, 35, 22, 102, 72, 36, 37, 38, - 39, 40, 68, 70, 42, 103, 104, 106, 111, 116, - 117, 119, 120, 45, 81, 101, 65, 34, 0, 0, - 85 -}; - -static const short yycheck[] = { 1, - 59, 3, 3, 3, 30, 0, 4, 9, 10, 53, - 39, 4, 41, 33, 58, 41, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 3, 1, - 1, 8, 30, 43, 9, 37, 8, 8, 3, 32, - 50, 33, 101, 38, 3, 47, 48, 49, 48, 51, - 9, 52, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 33, 5, 6, 7, 31, 33, - 29, 11, 47, 48, 49, 1, 51, 40, 33, 5, - 6, 7, 45, 46, 32, 11, 40, 52, 47, 48, - 49, 35, 51, 41, 12, 13, 14, 15, 16, 42, - 43, 44, 36, 8, 38, 42, 43, 8, 8, 8, - 8, 39, 37, 34, 8, 4, 4, 53, 3, 30, - 32, 0, 0, 33, 63, 72, 50, 24, -1, -1, - 68 -}; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/lib/bison.simple" -/* This file comes from bison-1.28. */ - -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -#ifndef YYSTACK_USE_ALLOCA -#ifdef alloca -#define YYSTACK_USE_ALLOCA -#else /* alloca not defined */ -#ifdef __GNUC__ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) -#define YYSTACK_USE_ALLOCA -#include -#else /* not sparc */ -/* We think this test detects Watcom and Microsoft C. */ -/* This used to test MSDOS, but that is a bad idea - since that symbol is in the user namespace. */ -#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) -#if 0 /* No need for malloc.h, which pollutes the namespace; - instead, just don't use alloca. */ -#include -#endif -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -/* I don't know what this was needed for, but it pollutes the namespace. - So I turned it off. rms, 2 May 1997. */ -/* #include */ - #pragma alloca -#define YYSTACK_USE_ALLOCA -#else /* not MSDOS, or __TURBOC__, or _AIX */ -#if 0 -#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, - and on HPUX 10. Eventually we can turn this on. */ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#endif /* __hpux */ -#endif -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc */ -#endif /* not GNU C */ -#endif /* alloca not defined */ -#endif /* YYSTACK_USE_ALLOCA not defined */ - -#ifdef YYSTACK_USE_ALLOCA -#define YYSTACK_ALLOC alloca -#else -#define YYSTACK_ALLOC malloc -#endif - -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab -#define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ -while (0) - -#define YYTERROR 1 -#define YYERRCODE 256 - -#ifndef YYPURE -#define YYLEX yylex() -#endif - -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) -#endif -#else /* not YYLSP_NEEDED */ -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval) -#endif -#endif /* not YYLSP_NEEDED */ -#endif - -/* If nonreentrant, generate the variables here */ - -#ifndef YYPURE - -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ - -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ -#endif - -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ - -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ -#endif - -/* YYINITDEPTH indicates the initial size of the parser's stacks */ - -#ifndef YYINITDEPTH -#define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ - -#if YYMAXDEPTH == 0 -#undef YYMAXDEPTH -#endif - -#ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 -#endif - -/* Define __yy_memcpy. Note that the size argument - should be passed with type unsigned int, because that is what the non-GCC - definitions require. With GCC, __builtin_memcpy takes an arg - of type size_t, but it can handle unsigned int. */ - -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (to, from, count) - char *to; - char *from; - unsigned int count; -{ - register char *f = from; - register char *t = to; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#else /* __cplusplus */ - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *to, char *from, unsigned int count) -{ - register char *t = to; - register char *f = from; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#endif -#endif - -#line 217 "/usr/lib/bison.simple" - -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ - -#ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -#ifdef YYPARSE_PARAM -int yyparse (void *); -#else -int yyparse (void); -#endif -#endif - -int -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL -{ - register int yystate; - register int yyn; - register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ - -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else -#define YYPOPSTACK (yyvsp--, yyssp--) -#endif - - int yystacksize = YYINITDEPTH; - int yyfree_stacks = 0; - -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif - - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ - - int yylen; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss - 1; - yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif - -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: - - *++yyssp = yystate; - - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif - - /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; - -#ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif - - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif -#else /* no yyoverflow */ - /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 2; - } - yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; -#ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -#endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); -#endif -#endif /* no yyoverflow */ - - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - - if (yyssp >= yyss + yystacksize - 1) - YYABORT; - } - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif - - goto yybackup; - yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to lookahead token. */ - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - - if (yychar == YYEMPTY) - { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif - yychar = YYLEX; - } - - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ - { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif - } - else - { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -#endif - fprintf (stderr, ")\n"); - } -#endif - } - - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) - goto yydefault; - - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrlab; - - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; - - yystate = yyn; - goto yynewstate; - -/* Do the default action for the current state. */ -yydefault: - - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - -/* Do a reduction. yyn is the number of a rule to reduce with. */ -yyreduce: - yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ - -#if YYDEBUG != 0 - if (yydebug) - { - int i; - - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif - - - switch (yyn) { - -case 1: -#line 143 "parse.y" -{ /* add default rule */ - int def_rule; - - pat = cclinit(); - cclnegate( pat ); - - def_rule = mkstate( -pat ); - - /* Remember the number of the default rule so we - * don't generate "can't match" warnings for it. - */ - default_rule = num_rules; - - finish_rule( def_rule, false, 0, 0, 0); - - for ( i = 1; i <= lastsc; ++i ) - scset[i] = mkbranch( scset[i], def_rule ); - - if ( spprdflt ) - add_action( - "YY_FATAL_ERROR( \"flex scanner jammed\" )" ); - else - add_action( "ECHO" ); - - add_action( ";\n\tYY_BREAK\n" ); - ; - break;} -case 2: -#line 172 "parse.y" -{ /* initialize for processing rules */ - - /* Create default DFA start condition. */ - scinstal( "INITIAL", false ); - ; - break;} -case 6: -#line 183 "parse.y" -{ synerr( _("unknown error processing section 1") ); ; - break;} -case 7: -#line 187 "parse.y" -{ - check_options(); - scon_stk = allocate_integer_array( lastsc + 1 ); - scon_stk_ptr = 0; - ; - break;} -case 8: -#line 195 "parse.y" -{ xcluflg = false; ; - break;} -case 9: -#line 198 "parse.y" -{ xcluflg = true; ; - break;} -case 10: -#line 202 "parse.y" -{ scinstal( nmstr, xcluflg ); ; - break;} -case 11: -#line 205 "parse.y" -{ scinstal( nmstr, xcluflg ); ; - break;} -case 12: -#line 208 "parse.y" -{ synerr( _("bad start condition list") ); ; - break;} -case 16: -#line 219 "parse.y" -{ - outfilename = copy_string( nmstr ); - did_outfilename = 1; - ; - break;} -case 17: -#line 224 "parse.y" -{ prefix = copy_string( nmstr ); ; - break;} -case 18: -#line 226 "parse.y" -{ yyclass = copy_string( nmstr ); ; - break;} -case 19: -#line 228 "parse.y" -{ headerfilename = copy_string( nmstr ); ; - break;} -case 20: -#line 230 "parse.y" -{ tablesext = true; tablesfilename = copy_string( nmstr ); ; - break;} -case 21: -#line 234 "parse.y" -{ scon_stk_ptr = yyvsp[-3]; ; - break;} -case 22: -#line 236 "parse.y" -{ scon_stk_ptr = yyvsp[-3]; ; - break;} -case 24: -#line 241 "parse.y" -{ - /* Initialize for a parse of one rule. */ - trlcontxt = variable_trail_rule = varlength = false; - trailcnt = headcnt = rulelen = 0; - current_state_type = STATE_NORMAL; - previous_continued_action = continued_action; - in_rule = true; - - new_rule(); - ; - break;} -case 25: -#line 254 "parse.y" -{ - pat = yyvsp[0]; - finish_rule( pat, variable_trail_rule, - headcnt, trailcnt , previous_continued_action); - - if ( scon_stk_ptr > 0 ) - { - for ( i = 1; i <= scon_stk_ptr; ++i ) - scbol[scon_stk[i]] = - mkbranch( scbol[scon_stk[i]], - pat ); - } - - else - { - /* Add to all non-exclusive start conditions, - * including the default (0) start condition. - */ - - for ( i = 1; i <= lastsc; ++i ) - if ( ! scxclu[i] ) - scbol[i] = mkbranch( scbol[i], - pat ); - } - - if ( ! bol_needed ) - { - bol_needed = true; - - if ( performance_report > 1 ) - pinpoint_message( - "'^' operator results in sub-optimal performance" ); - } - ; - break;} -case 26: -#line 290 "parse.y" -{ - pat = yyvsp[0]; - finish_rule( pat, variable_trail_rule, - headcnt, trailcnt , previous_continued_action); - - if ( scon_stk_ptr > 0 ) - { - for ( i = 1; i <= scon_stk_ptr; ++i ) - scset[scon_stk[i]] = - mkbranch( scset[scon_stk[i]], - pat ); - } - - else - { - for ( i = 1; i <= lastsc; ++i ) - if ( ! scxclu[i] ) - scset[i] = - mkbranch( scset[i], - pat ); - } - ; - break;} -case 27: -#line 314 "parse.y" -{ - if ( scon_stk_ptr > 0 ) - build_eof_action(); - - else - { - /* This EOF applies to all start conditions - * which don't already have EOF actions. - */ - for ( i = 1; i <= lastsc; ++i ) - if ( ! sceof[i] ) - scon_stk[++scon_stk_ptr] = i; - - if ( scon_stk_ptr == 0 ) - warn( - "all start conditions already have <> rules" ); - - else - build_eof_action(); - } - ; - break;} -case 28: -#line 337 "parse.y" -{ synerr( _("unrecognized rule") ); ; - break;} -case 29: -#line 341 "parse.y" -{ yyval = scon_stk_ptr; ; - break;} -case 30: -#line 345 "parse.y" -{ yyval = yyvsp[-2]; ; - break;} -case 31: -#line 348 "parse.y" -{ - yyval = scon_stk_ptr; - - for ( i = 1; i <= lastsc; ++i ) - { - int j; - - for ( j = 1; j <= scon_stk_ptr; ++j ) - if ( scon_stk[j] == i ) - break; - - if ( j > scon_stk_ptr ) - scon_stk[++scon_stk_ptr] = i; - } - ; - break;} -case 32: -#line 365 "parse.y" -{ yyval = scon_stk_ptr; ; - break;} -case 35: -#line 373 "parse.y" -{ synerr( _("bad start condition list") ); ; - break;} -case 36: -#line 377 "parse.y" -{ - if ( (scnum = sclookup( nmstr )) == 0 ) - format_pinpoint_message( - "undeclared start condition %s", - nmstr ); - else - { - for ( i = 1; i <= scon_stk_ptr; ++i ) - if ( scon_stk[i] == scnum ) - { - format_warn( - "<%s> specified twice", - scname[scnum] ); - break; - } - - if ( i > scon_stk_ptr ) - scon_stk[++scon_stk_ptr] = scnum; - } - ; - break;} -case 37: -#line 400 "parse.y" -{ - if ( transchar[lastst[yyvsp[0]]] != SYM_EPSILON ) - /* Provide final transition \now/ so it - * will be marked as a trailing context - * state. - */ - yyvsp[0] = link_machines( yyvsp[0], - mkstate( SYM_EPSILON ) ); - - mark_beginning_as_normal( yyvsp[0] ); - current_state_type = STATE_NORMAL; - - if ( previous_continued_action ) - { - /* We need to treat this as variable trailing - * context so that the backup does not happen - * in the action but before the action switch - * statement. If the backup happens in the - * action, then the rules "falling into" this - * one's action will *also* do the backup, - * erroneously. - */ - if ( ! varlength || headcnt != 0 ) - warn( - "trailing context made variable due to preceding '|' action" ); - - /* Mark as variable. */ - varlength = true; - headcnt = 0; - - } - - if ( lex_compat || (varlength && headcnt == 0) ) - { /* variable trailing context rule */ - /* Mark the first part of the rule as the - * accepting "head" part of a trailing - * context rule. - * - * By the way, we didn't do this at the - * beginning of this production because back - * then current_state_type was set up for a - * trail rule, and add_accept() can create - * a new state ... - */ - add_accept( yyvsp[-1], - num_rules | YY_TRAILING_HEAD_MASK ); - variable_trail_rule = true; - } - - else - trailcnt = rulelen; - - yyval = link_machines( yyvsp[-1], yyvsp[0] ); - ; - break;} -case 38: -#line 456 "parse.y" -{ synerr( _("trailing context used twice") ); ; - break;} -case 39: -#line 459 "parse.y" -{ - headcnt = 0; - trailcnt = 1; - rulelen = 1; - varlength = false; - - current_state_type = STATE_TRAILING_CONTEXT; - - if ( trlcontxt ) - { - synerr( _("trailing context used twice") ); - yyval = mkstate( SYM_EPSILON ); - } - - else if ( previous_continued_action ) - { - /* See the comment in the rule for "re2 re" - * above. - */ - warn( - "trailing context made variable due to preceding '|' action" ); - - varlength = true; - } - - if ( lex_compat || varlength ) - { - /* Again, see the comment in the rule for - * "re2 re" above. - */ - add_accept( yyvsp[-1], - num_rules | YY_TRAILING_HEAD_MASK ); - variable_trail_rule = true; - } - - trlcontxt = true; - - eps = mkstate( SYM_EPSILON ); - yyval = link_machines( yyvsp[-1], - link_machines( eps, mkstate( '\n' ) ) ); - ; - break;} -case 40: -#line 502 "parse.y" -{ - yyval = yyvsp[0]; - - if ( trlcontxt ) - { - if ( lex_compat || (varlength && headcnt == 0) ) - /* Both head and trail are - * variable-length. - */ - variable_trail_rule = true; - else - trailcnt = rulelen; - } - ; - break;} -case 41: -#line 520 "parse.y" -{ - varlength = true; - yyval = mkor( yyvsp[-2], yyvsp[0] ); - ; - break;} -case 42: -#line 526 "parse.y" -{ yyval = yyvsp[0]; ; - break;} -case 43: -#line 531 "parse.y" -{ - /* This rule is written separately so the - * reduction will occur before the trailing - * series is parsed. - */ - - if ( trlcontxt ) - synerr( _("trailing context used twice") ); - else - trlcontxt = true; - - if ( varlength ) - /* We hope the trailing context is - * fixed-length. - */ - varlength = false; - else - headcnt = rulelen; - - rulelen = 0; - - current_state_type = STATE_TRAILING_CONTEXT; - yyval = yyvsp[-1]; - ; - break;} -case 44: -#line 558 "parse.y" -{ - /* This is where concatenation of adjacent patterns - * gets done. - */ - yyval = link_machines( yyvsp[-1], yyvsp[0] ); - ; - break;} -case 45: -#line 566 "parse.y" -{ yyval = yyvsp[0]; ; - break;} -case 46: -#line 569 "parse.y" -{ - varlength = true; - - if ( yyvsp[-3] > yyvsp[-1] || yyvsp[-3] < 0 ) - { - synerr( _("bad iteration values") ); - yyval = yyvsp[-5]; - } - else - { - if ( yyvsp[-3] == 0 ) - { - if ( yyvsp[-1] <= 0 ) - { - synerr( - _("bad iteration values") ); - yyval = yyvsp[-5]; - } - else - yyval = mkopt( - mkrep( yyvsp[-5], 1, yyvsp[-1] ) ); - } - else - yyval = mkrep( yyvsp[-5], yyvsp[-3], yyvsp[-1] ); - } - ; - break;} -case 47: -#line 597 "parse.y" -{ - varlength = true; - - if ( yyvsp[-2] <= 0 ) - { - synerr( _("iteration value must be positive") ); - yyval = yyvsp[-4]; - } - - else - yyval = mkrep( yyvsp[-4], yyvsp[-2], INFINITE_REPEAT ); - ; - break;} -case 48: -#line 611 "parse.y" -{ - /* The series could be something like "(foo)", - * in which case we have no idea what its length - * is, so we punt here. - */ - varlength = true; - - if ( yyvsp[-1] <= 0 ) - { - synerr( _("iteration value must be positive") - ); - yyval = yyvsp[-3]; - } - - else - yyval = link_machines( yyvsp[-3], - copysingl( yyvsp[-3], yyvsp[-1] - 1 ) ); - ; - break;} -case 49: -#line 633 "parse.y" -{ - varlength = true; - - yyval = mkclos( yyvsp[-1] ); - ; - break;} -case 50: -#line 640 "parse.y" -{ - varlength = true; - yyval = mkposcl( yyvsp[-1] ); - ; - break;} -case 51: -#line 646 "parse.y" -{ - varlength = true; - yyval = mkopt( yyvsp[-1] ); - ; - break;} -case 52: -#line 652 "parse.y" -{ - varlength = true; - - if ( yyvsp[-3] > yyvsp[-1] || yyvsp[-3] < 0 ) - { - synerr( _("bad iteration values") ); - yyval = yyvsp[-5]; - } - else - { - if ( yyvsp[-3] == 0 ) - { - if ( yyvsp[-1] <= 0 ) - { - synerr( - _("bad iteration values") ); - yyval = yyvsp[-5]; - } - else - yyval = mkopt( - mkrep( yyvsp[-5], 1, yyvsp[-1] ) ); - } - else - yyval = mkrep( yyvsp[-5], yyvsp[-3], yyvsp[-1] ); - } - ; - break;} -case 53: -#line 680 "parse.y" -{ - varlength = true; - - if ( yyvsp[-2] <= 0 ) - { - synerr( _("iteration value must be positive") ); - yyval = yyvsp[-4]; - } - - else - yyval = mkrep( yyvsp[-4], yyvsp[-2], INFINITE_REPEAT ); - ; - break;} -case 54: -#line 694 "parse.y" -{ - /* The singleton could be something like "(foo)", - * in which case we have no idea what its length - * is, so we punt here. - */ - varlength = true; - - if ( yyvsp[-1] <= 0 ) - { - synerr( _("iteration value must be positive") ); - yyval = yyvsp[-3]; - } - - else - yyval = link_machines( yyvsp[-3], - copysingl( yyvsp[-3], yyvsp[-1] - 1 ) ); - ; - break;} -case 55: -#line 713 "parse.y" -{ - if ( ! madeany ) - { - /* Create the '.' character class. */ - anyccl = cclinit(); - ccladd( anyccl, '\n' ); - cclnegate( anyccl ); - - if ( useecs ) - mkeccl( ccltbl + cclmap[anyccl], - ccllen[anyccl], nextecm, - ecgroup, csize, csize ); - - madeany = true; - } - - ++rulelen; - - yyval = mkstate( -anyccl ); - ; - break;} -case 56: -#line 735 "parse.y" -{ - if ( ! cclsorted ) - /* Sort characters for fast searching. We - * use a shell sort since this list could - * be large. - */ - cshell( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]], true ); - - if ( useecs ) - mkeccl( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]], - nextecm, ecgroup, csize, csize ); - - ++rulelen; - - if (ccl_has_nl[yyvsp[0]]) - rule_has_nl[num_rules] = true; - - yyval = mkstate( -yyvsp[0] ); - ; - break;} -case 57: -#line 756 "parse.y" -{ - ++rulelen; - - if (ccl_has_nl[yyvsp[0]]) - rule_has_nl[num_rules] = true; - - yyval = mkstate( -yyvsp[0] ); - ; - break;} -case 58: -#line 766 "parse.y" -{ yyval = yyvsp[-1]; ; - break;} -case 59: -#line 769 "parse.y" -{ yyval = yyvsp[-1]; ; - break;} -case 60: -#line 772 "parse.y" -{ - ++rulelen; - - if ( caseins && yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' ) - yyvsp[0] = clower( yyvsp[0] ); - - if (yyvsp[0] == nlch) - rule_has_nl[num_rules] = true; - - yyval = mkstate( yyvsp[0] ); - ; - break;} -case 61: -#line 786 "parse.y" -{ yyval = yyvsp[-1]; ; - break;} -case 62: -#line 789 "parse.y" -{ - cclnegate( yyvsp[-1] ); - yyval = yyvsp[-1]; - ; - break;} -case 63: -#line 796 "parse.y" -{ - - if (caseins) - { - /* Squish the character range to lowercase only if BOTH - * ends of the range are uppercase. - */ - if (isupper (yyvsp[-2]) && isupper (yyvsp[0])) - { - yyvsp[-2] = tolower (yyvsp[-2]); - yyvsp[0] = tolower (yyvsp[0]); - } - - /* If one end of the range has case and the other - * does not, or the cases are different, then we're not - * sure what range the user is trying to express. - * Examples: [@-z] or [S-t] - */ - else if (has_case (yyvsp[-2]) != has_case (yyvsp[0]) - || (has_case (yyvsp[-2]) && (b_islower (yyvsp[-2]) != b_islower (yyvsp[0])))) - format_warn3 ( - _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"), - yyvsp[-2], yyvsp[0]); - - /* If the range spans uppercase characters but not - * lowercase (or vice-versa), then should we automatically - * include lowercase characters in the range? - * Example: [@-_] spans [a-z] but not [A-Z] - */ - else if (!has_case (yyvsp[-2]) && !has_case (yyvsp[0]) && !range_covers_case (yyvsp[-2], yyvsp[0])) - format_warn3 ( - _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"), - yyvsp[-2], yyvsp[0]); - } - - if ( yyvsp[-2] > yyvsp[0] ) - synerr( _("negative range in character class") ); - - else - { - for ( i = yyvsp[-2]; i <= yyvsp[0]; ++i ) - ccladd( yyvsp[-3], i ); - - /* Keep track if this ccl is staying in - * alphabetical order. - */ - cclsorted = cclsorted && (yyvsp[-2] > lastchar); - lastchar = yyvsp[0]; - } - - yyval = yyvsp[-3]; - ; - break;} -case 64: -#line 850 "parse.y" -{ - if ( caseins && yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' ) - yyvsp[0] = clower( yyvsp[0] ); - - ccladd( yyvsp[-1], yyvsp[0] ); - cclsorted = cclsorted && (yyvsp[0] > lastchar); - lastchar = yyvsp[0]; - yyval = yyvsp[-1]; - ; - break;} -case 65: -#line 861 "parse.y" -{ - /* Too hard to properly maintain cclsorted. */ - cclsorted = false; - yyval = yyvsp[-1]; - ; - break;} -case 66: -#line 868 "parse.y" -{ - cclsorted = true; - lastchar = 0; - currccl = yyval = cclinit(); - ; - break;} -case 67: -#line 875 "parse.y" -{ CCL_EXPR(isalnum); ; - break;} -case 68: -#line 876 "parse.y" -{ CCL_EXPR(isalpha); ; - break;} -case 69: -#line 877 "parse.y" -{ CCL_EXPR(IS_BLANK); ; - break;} -case 70: -#line 878 "parse.y" -{ CCL_EXPR(iscntrl); ; - break;} -case 71: -#line 879 "parse.y" -{ CCL_EXPR(isdigit); ; - break;} -case 72: -#line 880 "parse.y" -{ CCL_EXPR(isgraph); ; - break;} -case 73: -#line 881 "parse.y" -{ CCL_EXPR(islower); ; - break;} -case 74: -#line 882 "parse.y" -{ CCL_EXPR(isprint); ; - break;} -case 75: -#line 883 "parse.y" -{ CCL_EXPR(ispunct); ; - break;} -case 76: -#line 884 "parse.y" -{ CCL_EXPR(isspace); ; - break;} -case 77: -#line 885 "parse.y" -{ - if ( caseins ) - CCL_EXPR(islower); - else - CCL_EXPR(isupper); - ; - break;} -case 78: -#line 891 "parse.y" -{ CCL_EXPR(isxdigit); ; - break;} -case 79: -#line 895 "parse.y" -{ - if ( caseins && yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' ) - yyvsp[0] = clower( yyvsp[0] ); - - if ( yyvsp[0] == nlch ) - rule_has_nl[num_rules] = true; - - ++rulelen; - - yyval = link_machines( yyvsp[-1], mkstate( yyvsp[0] ) ); - ; - break;} -case 80: -#line 908 "parse.y" -{ yyval = mkstate( SYM_EPSILON ); ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 543 "/usr/lib/bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - - *++yyvsp = yyval; - -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } -#endif - - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTBASE]; - - goto yynewstate; - -yyerrlab: /* here on detecting error */ - - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ - { - ++yynerrs; - -#ifdef YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); - - if (count < 5) - { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; - } - } - yyerror(msg); - free(msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror("parse error"); - } - - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ - - if (yyerrstatus == 3) - { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif - - yychar = YYEMPTY; - } - - /* Else will try to reuse lookahead token - after shifting the error token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; - -yyerrdefault: /* current state does not do anything special for the error token. */ - -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif - -yyerrpop: /* pop the current state because it cannot handle the error token */ - - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - -yyerrhandle: - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; - - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; - - if (yyn == YYFINAL) - YYACCEPT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - yystate = yyn; - goto yynewstate; - - yyacceptlab: - /* YYACCEPT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 0; - - yyabortlab: - /* YYABORT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 1; -} -#line 911 "parse.y" - - - -/* build_eof_action - build the "<>" action for the active start - * conditions - */ - -void build_eof_action() - { - register int i; - char action_text[MAXLINE]; - - for ( i = 1; i <= scon_stk_ptr; ++i ) - { - if ( sceof[scon_stk[i]] ) - format_pinpoint_message( - "multiple <> rules for start condition %s", - scname[scon_stk[i]] ); - - else - { - sceof[scon_stk[i]] = true; - sprintf( action_text, "case YY_STATE_EOF(%s):\n", - scname[scon_stk[i]] ); - add_action( action_text ); - } - } - - line_directive_out( (FILE *) 0, 1 ); - - /* This isn't a normal rule after all - don't count it as - * such, so we don't have any holes in the rule numbering - * (which make generating "rule can never match" warnings - * more difficult. - */ - --num_rules; - ++num_eof_rules; - } - - -/* format_synerr - write out formatted syntax error */ - -void format_synerr( msg, arg ) -const char *msg, arg[]; - { - char errmsg[MAXLINE]; - - (void) sprintf( errmsg, msg, arg ); - synerr( errmsg ); - } - - -/* synerr - report a syntax error */ - -void synerr( str ) -const char *str; - { - syntaxerror = true; - pinpoint_message( str ); - } - - -/* format_warn - write out formatted warning */ - -void format_warn( msg, arg ) -const char *msg, arg[]; - { - char warn_msg[MAXLINE]; - - (void) sprintf( warn_msg, msg, arg ); - warn( warn_msg ); - } - - -/* warn - report a warning, unless -w was given */ - -void warn( str ) -const char *str; - { - line_warning( str, linenum ); - } - -/* format_pinpoint_message - write out a message formatted with one string, - * pinpointing its location - */ - -void format_pinpoint_message( msg, arg ) -const char *msg, arg[]; - { - char errmsg[MAXLINE]; - - (void) sprintf( errmsg, msg, arg ); - pinpoint_message( errmsg ); - } - - -/* pinpoint_message - write out a message, pinpointing its location */ - -void pinpoint_message( str ) -const char *str; - { - line_pinpoint( str, linenum ); - } - - -/* line_warning - report a warning at a given line, unless -w was given */ - -void line_warning( str, line ) -const char *str; -int line; - { - char warning[MAXLINE]; - - if ( ! nowarn ) - { - sprintf( warning, "warning, %s", str ); - line_pinpoint( warning, line ); - } - } - - -/* line_pinpoint - write out a message, pinpointing it at the given line */ - -void line_pinpoint( str, line ) -const char *str; -int line; - { - fprintf( stderr, "%s:%d: %s\n", infilename, line, str ); - } - - -/* yyerror - eat up an error message from the parser; - * currently, messages are ignore - */ - -void yyerror( msg ) -const char *msg; - { - } diff --git a/src/bin/flex/parse.h b/src/bin/flex/parse.h deleted file mode 100644 index 8fbb8029b6..0000000000 --- a/src/bin/flex/parse.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef YYSTYPE -#define YYSTYPE int -#endif -#define CHAR 257 -#define NUMBER 258 -#define SECTEND 259 -#define SCDECL 260 -#define XSCDECL 261 -#define NAME 262 -#define PREVCCL 263 -#define EOF_OP 264 -#define OPTION_OP 265 -#define OPT_OUTFILE 266 -#define OPT_PREFIX 267 -#define OPT_YYCLASS 268 -#define OPT_HEADER 269 -#define OPT_TABLES 270 -#define CCE_ALNUM 271 -#define CCE_ALPHA 272 -#define CCE_BLANK 273 -#define CCE_CNTRL 274 -#define CCE_DIGIT 275 -#define CCE_GRAPH 276 -#define CCE_LOWER 277 -#define CCE_PRINT 278 -#define CCE_PUNCT 279 -#define CCE_SPACE 280 -#define CCE_UPPER 281 -#define CCE_XDIGIT 282 -#define BEGIN_REPEAT_POSIX 283 -#define END_REPEAT_POSIX 284 -#define BEGIN_REPEAT_FLEX 285 -#define END_REPEAT_FLEX 286 - - -extern YYSTYPE yylval; diff --git a/src/bin/flex/parse.y b/src/bin/flex/parse.y deleted file mode 100644 index c40d75b7f0..0000000000 --- a/src/bin/flex/parse.y +++ /dev/null @@ -1,1049 +0,0 @@ -/* parse.y - parser for flex input */ - -%token CHAR NUMBER SECTEND SCDECL XSCDECL NAME PREVCCL EOF_OP -%token OPTION_OP OPT_OUTFILE OPT_PREFIX OPT_YYCLASS OPT_HEADER -%token OPT_TABLES - -%token CCE_ALNUM CCE_ALPHA CCE_BLANK CCE_CNTRL CCE_DIGIT CCE_GRAPH -%token CCE_LOWER CCE_PRINT CCE_PUNCT CCE_SPACE CCE_UPPER CCE_XDIGIT - -/* - *POSIX and AT&T lex place the - * precedence of the repeat operator, {}, below that of concatenation. - * Thus, ab{3} is ababab. Most other POSIX utilities use an Extended - * Regular Expression (ERE) precedence that has the repeat operator - * higher than concatenation. This causes ab{3} to yield abbb. - * - * In order to support the POSIX and AT&T precedence and the flex - * precedence we define two token sets for the begin and end tokens of - * the repeat operator, '{' and '}'. The lexical scanner chooses - * which tokens to return based on whether posix_compat or lex_compat - * are specified. Specifying either posix_compat or lex_compat will - * cause flex to parse scanner files as per the AT&T and - * POSIX-mandated behavior. - */ - -%token BEGIN_REPEAT_POSIX END_REPEAT_POSIX BEGIN_REPEAT_FLEX END_REPEAT_FLEX - - -%{ -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -/* Some versions of bison are broken in that they use alloca() but don't - * declare it properly. The following is the patented (just kidding!) - * #ifdef chud to fix the problem, courtesy of Francois Pinard. - */ -#ifdef YYBISON -/* AIX requires this to be the first thing in the file. What a piece. */ -# ifdef _AIX - #pragma alloca -# endif -#endif - -#include "flexdef.h" -#include "tables.h" - -/* The remainder of the alloca() cruft has to come after including flexdef.h, - * so HAVE_ALLOCA_H is (possibly) defined. - */ -#ifdef YYBISON -# ifdef __GNUC__ -# ifndef alloca -# define alloca __builtin_alloca -# endif -# else -# if HAVE_ALLOCA_H -# include -# else -# ifdef __hpux -void *alloca (); -# else -# ifdef __TURBOC__ -# include -# else -char *alloca (); -# endif -# endif -# endif -# endif -#endif - -/* Bletch, ^^^^ that was ugly! */ - - -int pat, scnum, eps, headcnt, trailcnt, anyccl, lastchar, i, rulelen; -int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule; - -int *scon_stk; -int scon_stk_ptr; - -static int madeany = false; /* whether we've made the '.' character class */ -int previous_continued_action; /* whether the previous rule's action was '|' */ - -#define format_warn3(fmt, a1, a2) \ - do{ \ - char fw3_msg[MAXLINE];\ - snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\ - warn( fw3_msg );\ - }while(0) - -/* Expand a POSIX character class expression. */ -#define CCL_EXPR(func) \ - do{ \ - int c; \ - for ( c = 0; c < csize; ++c ) \ - if ( isascii(c) && func(c) ) \ - ccladd( currccl, c ); \ - }while(0) - -/* While POSIX defines isblank(), it's not ANSI C. */ -#define IS_BLANK(c) ((c) == ' ' || (c) == '\t') - -/* On some over-ambitious machines, such as DEC Alpha's, the default - * token type is "long" instead of "int"; this leads to problems with - * declaring yylval in flexdef.h. But so far, all the yacc's I've seen - * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the - * following should ensure that the default token type is "int". - */ -#define YYSTYPE int - -%} - -%% -goal : initlex sect1 sect1end sect2 initforrule - { /* add default rule */ - int def_rule; - - pat = cclinit(); - cclnegate( pat ); - - def_rule = mkstate( -pat ); - - /* Remember the number of the default rule so we - * don't generate "can't match" warnings for it. - */ - default_rule = num_rules; - - finish_rule( def_rule, false, 0, 0, 0); - - for ( i = 1; i <= lastsc; ++i ) - scset[i] = mkbranch( scset[i], def_rule ); - - if ( spprdflt ) - add_action( - "YY_FATAL_ERROR( \"flex scanner jammed\" )" ); - else - add_action( "ECHO" ); - - add_action( ";\n\tYY_BREAK\n" ); - } - ; - -initlex : - { /* initialize for processing rules */ - - /* Create default DFA start condition. */ - scinstal( "INITIAL", false ); - } - ; - -sect1 : sect1 startconddecl namelist1 - | sect1 options - | - | error - { synerr( _("unknown error processing section 1") ); } - ; - -sect1end : SECTEND - { - check_options(); - scon_stk = allocate_integer_array( lastsc + 1 ); - scon_stk_ptr = 0; - } - ; - -startconddecl : SCDECL - { xcluflg = false; } - - | XSCDECL - { xcluflg = true; } - ; - -namelist1 : namelist1 NAME - { scinstal( nmstr, xcluflg ); } - - | NAME - { scinstal( nmstr, xcluflg ); } - - | error - { synerr( _("bad start condition list") ); } - ; - -options : OPTION_OP optionlist - ; - -optionlist : optionlist option - | - ; - -option : OPT_OUTFILE '=' NAME - { - outfilename = copy_string( nmstr ); - did_outfilename = 1; - } - | OPT_PREFIX '=' NAME - { prefix = copy_string( nmstr ); } - | OPT_YYCLASS '=' NAME - { yyclass = copy_string( nmstr ); } - | OPT_HEADER '=' NAME - { headerfilename = copy_string( nmstr ); } - | OPT_TABLES '=' NAME - { tablesext = true; tablesfilename = copy_string( nmstr ); } - ; - -sect2 : sect2 scon initforrule flexrule '\n' - { scon_stk_ptr = $2; } - | sect2 scon '{' sect2 '}' - { scon_stk_ptr = $2; } - | - ; - -initforrule : - { - /* Initialize for a parse of one rule. */ - trlcontxt = variable_trail_rule = varlength = false; - trailcnt = headcnt = rulelen = 0; - current_state_type = STATE_NORMAL; - previous_continued_action = continued_action; - in_rule = true; - - new_rule(); - } - ; - -flexrule : '^' rule - { - pat = $2; - finish_rule( pat, variable_trail_rule, - headcnt, trailcnt , previous_continued_action); - - if ( scon_stk_ptr > 0 ) - { - for ( i = 1; i <= scon_stk_ptr; ++i ) - scbol[scon_stk[i]] = - mkbranch( scbol[scon_stk[i]], - pat ); - } - - else - { - /* Add to all non-exclusive start conditions, - * including the default (0) start condition. - */ - - for ( i = 1; i <= lastsc; ++i ) - if ( ! scxclu[i] ) - scbol[i] = mkbranch( scbol[i], - pat ); - } - - if ( ! bol_needed ) - { - bol_needed = true; - - if ( performance_report > 1 ) - pinpoint_message( - "'^' operator results in sub-optimal performance" ); - } - } - - | rule - { - pat = $1; - finish_rule( pat, variable_trail_rule, - headcnt, trailcnt , previous_continued_action); - - if ( scon_stk_ptr > 0 ) - { - for ( i = 1; i <= scon_stk_ptr; ++i ) - scset[scon_stk[i]] = - mkbranch( scset[scon_stk[i]], - pat ); - } - - else - { - for ( i = 1; i <= lastsc; ++i ) - if ( ! scxclu[i] ) - scset[i] = - mkbranch( scset[i], - pat ); - } - } - - | EOF_OP - { - if ( scon_stk_ptr > 0 ) - build_eof_action(); - - else - { - /* This EOF applies to all start conditions - * which don't already have EOF actions. - */ - for ( i = 1; i <= lastsc; ++i ) - if ( ! sceof[i] ) - scon_stk[++scon_stk_ptr] = i; - - if ( scon_stk_ptr == 0 ) - warn( - "all start conditions already have <> rules" ); - - else - build_eof_action(); - } - } - - | error - { synerr( _("unrecognized rule") ); } - ; - -scon_stk_ptr : - { $$ = scon_stk_ptr; } - ; - -scon : '<' scon_stk_ptr namelist2 '>' - { $$ = $2; } - - | '<' '*' '>' - { - $$ = scon_stk_ptr; - - for ( i = 1; i <= lastsc; ++i ) - { - int j; - - for ( j = 1; j <= scon_stk_ptr; ++j ) - if ( scon_stk[j] == i ) - break; - - if ( j > scon_stk_ptr ) - scon_stk[++scon_stk_ptr] = i; - } - } - - | - { $$ = scon_stk_ptr; } - ; - -namelist2 : namelist2 ',' sconname - - | sconname - - | error - { synerr( _("bad start condition list") ); } - ; - -sconname : NAME - { - if ( (scnum = sclookup( nmstr )) == 0 ) - format_pinpoint_message( - "undeclared start condition %s", - nmstr ); - else - { - for ( i = 1; i <= scon_stk_ptr; ++i ) - if ( scon_stk[i] == scnum ) - { - format_warn( - "<%s> specified twice", - scname[scnum] ); - break; - } - - if ( i > scon_stk_ptr ) - scon_stk[++scon_stk_ptr] = scnum; - } - } - ; - -rule : re2 re - { - if ( transchar[lastst[$2]] != SYM_EPSILON ) - /* Provide final transition \now/ so it - * will be marked as a trailing context - * state. - */ - $2 = link_machines( $2, - mkstate( SYM_EPSILON ) ); - - mark_beginning_as_normal( $2 ); - current_state_type = STATE_NORMAL; - - if ( previous_continued_action ) - { - /* We need to treat this as variable trailing - * context so that the backup does not happen - * in the action but before the action switch - * statement. If the backup happens in the - * action, then the rules "falling into" this - * one's action will *also* do the backup, - * erroneously. - */ - if ( ! varlength || headcnt != 0 ) - warn( - "trailing context made variable due to preceding '|' action" ); - - /* Mark as variable. */ - varlength = true; - headcnt = 0; - - } - - if ( lex_compat || (varlength && headcnt == 0) ) - { /* variable trailing context rule */ - /* Mark the first part of the rule as the - * accepting "head" part of a trailing - * context rule. - * - * By the way, we didn't do this at the - * beginning of this production because back - * then current_state_type was set up for a - * trail rule, and add_accept() can create - * a new state ... - */ - add_accept( $1, - num_rules | YY_TRAILING_HEAD_MASK ); - variable_trail_rule = true; - } - - else - trailcnt = rulelen; - - $$ = link_machines( $1, $2 ); - } - - | re2 re '$' - { synerr( _("trailing context used twice") ); } - - | re '$' - { - headcnt = 0; - trailcnt = 1; - rulelen = 1; - varlength = false; - - current_state_type = STATE_TRAILING_CONTEXT; - - if ( trlcontxt ) - { - synerr( _("trailing context used twice") ); - $$ = mkstate( SYM_EPSILON ); - } - - else if ( previous_continued_action ) - { - /* See the comment in the rule for "re2 re" - * above. - */ - warn( - "trailing context made variable due to preceding '|' action" ); - - varlength = true; - } - - if ( lex_compat || varlength ) - { - /* Again, see the comment in the rule for - * "re2 re" above. - */ - add_accept( $1, - num_rules | YY_TRAILING_HEAD_MASK ); - variable_trail_rule = true; - } - - trlcontxt = true; - - eps = mkstate( SYM_EPSILON ); - $$ = link_machines( $1, - link_machines( eps, mkstate( '\n' ) ) ); - } - - | re - { - $$ = $1; - - if ( trlcontxt ) - { - if ( lex_compat || (varlength && headcnt == 0) ) - /* Both head and trail are - * variable-length. - */ - variable_trail_rule = true; - else - trailcnt = rulelen; - } - } - ; - - -re : re '|' series - { - varlength = true; - $$ = mkor( $1, $3 ); - } - - | series - { $$ = $1; } - ; - - -re2 : re '/' - { - /* This rule is written separately so the - * reduction will occur before the trailing - * series is parsed. - */ - - if ( trlcontxt ) - synerr( _("trailing context used twice") ); - else - trlcontxt = true; - - if ( varlength ) - /* We hope the trailing context is - * fixed-length. - */ - varlength = false; - else - headcnt = rulelen; - - rulelen = 0; - - current_state_type = STATE_TRAILING_CONTEXT; - $$ = $1; - } - ; - -series : series singleton - { - /* This is where concatenation of adjacent patterns - * gets done. - */ - $$ = link_machines( $1, $2 ); - } - - | singleton - { $$ = $1; } - - | series BEGIN_REPEAT_POSIX NUMBER ',' NUMBER END_REPEAT_POSIX - { - varlength = true; - - if ( $3 > $5 || $3 < 0 ) - { - synerr( _("bad iteration values") ); - $$ = $1; - } - else - { - if ( $3 == 0 ) - { - if ( $5 <= 0 ) - { - synerr( - _("bad iteration values") ); - $$ = $1; - } - else - $$ = mkopt( - mkrep( $1, 1, $5 ) ); - } - else - $$ = mkrep( $1, $3, $5 ); - } - } - - | series BEGIN_REPEAT_POSIX NUMBER ',' END_REPEAT_POSIX - { - varlength = true; - - if ( $3 <= 0 ) - { - synerr( _("iteration value must be positive") ); - $$ = $1; - } - - else - $$ = mkrep( $1, $3, INFINITE_REPEAT ); - } - - | series BEGIN_REPEAT_POSIX NUMBER END_REPEAT_POSIX - { - /* The series could be something like "(foo)", - * in which case we have no idea what its length - * is, so we punt here. - */ - varlength = true; - - if ( $3 <= 0 ) - { - synerr( _("iteration value must be positive") - ); - $$ = $1; - } - - else - $$ = link_machines( $1, - copysingl( $1, $3 - 1 ) ); - } - - ; - -singleton : singleton '*' - { - varlength = true; - - $$ = mkclos( $1 ); - } - - | singleton '+' - { - varlength = true; - $$ = mkposcl( $1 ); - } - - | singleton '?' - { - varlength = true; - $$ = mkopt( $1 ); - } - - | singleton BEGIN_REPEAT_FLEX NUMBER ',' NUMBER END_REPEAT_FLEX - { - varlength = true; - - if ( $3 > $5 || $3 < 0 ) - { - synerr( _("bad iteration values") ); - $$ = $1; - } - else - { - if ( $3 == 0 ) - { - if ( $5 <= 0 ) - { - synerr( - _("bad iteration values") ); - $$ = $1; - } - else - $$ = mkopt( - mkrep( $1, 1, $5 ) ); - } - else - $$ = mkrep( $1, $3, $5 ); - } - } - - | singleton BEGIN_REPEAT_FLEX NUMBER ',' END_REPEAT_FLEX - { - varlength = true; - - if ( $3 <= 0 ) - { - synerr( _("iteration value must be positive") ); - $$ = $1; - } - - else - $$ = mkrep( $1, $3, INFINITE_REPEAT ); - } - - | singleton BEGIN_REPEAT_FLEX NUMBER END_REPEAT_FLEX - { - /* The singleton could be something like "(foo)", - * in which case we have no idea what its length - * is, so we punt here. - */ - varlength = true; - - if ( $3 <= 0 ) - { - synerr( _("iteration value must be positive") ); - $$ = $1; - } - - else - $$ = link_machines( $1, - copysingl( $1, $3 - 1 ) ); - } - - | '.' - { - if ( ! madeany ) - { - /* Create the '.' character class. */ - anyccl = cclinit(); - ccladd( anyccl, '\n' ); - cclnegate( anyccl ); - - if ( useecs ) - mkeccl( ccltbl + cclmap[anyccl], - ccllen[anyccl], nextecm, - ecgroup, csize, csize ); - - madeany = true; - } - - ++rulelen; - - $$ = mkstate( -anyccl ); - } - - | fullccl - { - if ( ! cclsorted ) - /* Sort characters for fast searching. We - * use a shell sort since this list could - * be large. - */ - cshell( ccltbl + cclmap[$1], ccllen[$1], true ); - - if ( useecs ) - mkeccl( ccltbl + cclmap[$1], ccllen[$1], - nextecm, ecgroup, csize, csize ); - - ++rulelen; - - if (ccl_has_nl[$1]) - rule_has_nl[num_rules] = true; - - $$ = mkstate( -$1 ); - } - - | PREVCCL - { - ++rulelen; - - if (ccl_has_nl[$1]) - rule_has_nl[num_rules] = true; - - $$ = mkstate( -$1 ); - } - - | '"' string '"' - { $$ = $2; } - - | '(' re ')' - { $$ = $2; } - - | CHAR - { - ++rulelen; - - if ( caseins && $1 >= 'A' && $1 <= 'Z' ) - $1 = clower( $1 ); - - if ($1 == nlch) - rule_has_nl[num_rules] = true; - - $$ = mkstate( $1 ); - } - ; - -fullccl : '[' ccl ']' - { $$ = $2; } - - | '[' '^' ccl ']' - { - cclnegate( $3 ); - $$ = $3; - } - ; - -ccl : ccl CHAR '-' CHAR - { - - if (caseins) - { - /* Squish the character range to lowercase only if BOTH - * ends of the range are uppercase. - */ - if (isupper ($2) && isupper ($4)) - { - $2 = tolower ($2); - $4 = tolower ($4); - } - - /* If one end of the range has case and the other - * does not, or the cases are different, then we're not - * sure what range the user is trying to express. - * Examples: [@-z] or [S-t] - */ - else if (has_case ($2) != has_case ($4) - || (has_case ($2) && (b_islower ($2) != b_islower ($4)))) - format_warn3 ( - _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"), - $2, $4); - - /* If the range spans uppercase characters but not - * lowercase (or vice-versa), then should we automatically - * include lowercase characters in the range? - * Example: [@-_] spans [a-z] but not [A-Z] - */ - else if (!has_case ($2) && !has_case ($4) && !range_covers_case ($2, $4)) - format_warn3 ( - _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"), - $2, $4); - } - - if ( $2 > $4 ) - synerr( _("negative range in character class") ); - - else - { - for ( i = $2; i <= $4; ++i ) - ccladd( $1, i ); - - /* Keep track if this ccl is staying in - * alphabetical order. - */ - cclsorted = cclsorted && ($2 > lastchar); - lastchar = $4; - } - - $$ = $1; - } - - | ccl CHAR - { - if ( caseins && $2 >= 'A' && $2 <= 'Z' ) - $2 = clower( $2 ); - - ccladd( $1, $2 ); - cclsorted = cclsorted && ($2 > lastchar); - lastchar = $2; - $$ = $1; - } - - | ccl ccl_expr - { - /* Too hard to properly maintain cclsorted. */ - cclsorted = false; - $$ = $1; - } - - | - { - cclsorted = true; - lastchar = 0; - currccl = $$ = cclinit(); - } - ; - -ccl_expr: CCE_ALNUM { CCL_EXPR(isalnum); } - | CCE_ALPHA { CCL_EXPR(isalpha); } - | CCE_BLANK { CCL_EXPR(IS_BLANK); } - | CCE_CNTRL { CCL_EXPR(iscntrl); } - | CCE_DIGIT { CCL_EXPR(isdigit); } - | CCE_GRAPH { CCL_EXPR(isgraph); } - | CCE_LOWER { CCL_EXPR(islower); } - | CCE_PRINT { CCL_EXPR(isprint); } - | CCE_PUNCT { CCL_EXPR(ispunct); } - | CCE_SPACE { CCL_EXPR(isspace); } - | CCE_UPPER { - if ( caseins ) - CCL_EXPR(islower); - else - CCL_EXPR(isupper); - } - | CCE_XDIGIT { CCL_EXPR(isxdigit); } - ; - -string : string CHAR - { - if ( caseins && $2 >= 'A' && $2 <= 'Z' ) - $2 = clower( $2 ); - - if ( $2 == nlch ) - rule_has_nl[num_rules] = true; - - ++rulelen; - - $$ = link_machines( $1, mkstate( $2 ) ); - } - - | - { $$ = mkstate( SYM_EPSILON ); } - ; - -%% - - -/* build_eof_action - build the "<>" action for the active start - * conditions - */ - -void build_eof_action() - { - register int i; - char action_text[MAXLINE]; - - for ( i = 1; i <= scon_stk_ptr; ++i ) - { - if ( sceof[scon_stk[i]] ) - format_pinpoint_message( - "multiple <> rules for start condition %s", - scname[scon_stk[i]] ); - - else - { - sceof[scon_stk[i]] = true; - sprintf( action_text, "case YY_STATE_EOF(%s):\n", - scname[scon_stk[i]] ); - add_action( action_text ); - } - } - - line_directive_out( (FILE *) 0, 1 ); - - /* This isn't a normal rule after all - don't count it as - * such, so we don't have any holes in the rule numbering - * (which make generating "rule can never match" warnings - * more difficult. - */ - --num_rules; - ++num_eof_rules; - } - - -/* format_synerr - write out formatted syntax error */ - -void format_synerr( msg, arg ) -const char *msg, arg[]; - { - char errmsg[MAXLINE]; - - (void) sprintf( errmsg, msg, arg ); - synerr( errmsg ); - } - - -/* synerr - report a syntax error */ - -void synerr( str ) -const char *str; - { - syntaxerror = true; - pinpoint_message( str ); - } - - -/* format_warn - write out formatted warning */ - -void format_warn( msg, arg ) -const char *msg, arg[]; - { - char warn_msg[MAXLINE]; - - (void) sprintf( warn_msg, msg, arg ); - warn( warn_msg ); - } - - -/* warn - report a warning, unless -w was given */ - -void warn( str ) -const char *str; - { - line_warning( str, linenum ); - } - -/* format_pinpoint_message - write out a message formatted with one string, - * pinpointing its location - */ - -void format_pinpoint_message( msg, arg ) -const char *msg, arg[]; - { - char errmsg[MAXLINE]; - - (void) sprintf( errmsg, msg, arg ); - pinpoint_message( errmsg ); - } - - -/* pinpoint_message - write out a message, pinpointing its location */ - -void pinpoint_message( str ) -const char *str; - { - line_pinpoint( str, linenum ); - } - - -/* line_warning - report a warning at a given line, unless -w was given */ - -void line_warning( str, line ) -const char *str; -int line; - { - char warning[MAXLINE]; - - if ( ! nowarn ) - { - sprintf( warning, "warning, %s", str ); - line_pinpoint( warning, line ); - } - } - - -/* line_pinpoint - write out a message, pinpointing it at the given line */ - -void line_pinpoint( str, line ) -const char *str; -int line; - { - fprintf( stderr, "%s:%d: %s\n", infilename, line, str ); - } - - -/* yyerror - eat up an error message from the parser; - * currently, messages are ignore - */ - -void yyerror( msg ) -const char *msg; - { - } diff --git a/src/bin/flex/regex.c b/src/bin/flex/regex.c deleted file mode 100644 index d124b4bd31..0000000000 --- a/src/bin/flex/regex.c +++ /dev/null @@ -1,164 +0,0 @@ -/** regex - regular expression functions related to POSIX regex lib. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -#include "flexdef.h" - - -static const char* REGEXP_LINEDIR = "^#line ([[:digit:]]+) \"(.*)\""; -static const char* REGEXP_BLANK_LINE = "^[[:space:]]*$"; - -regex_t regex_linedir; /**< matches line directives */ -regex_t regex_blank_line; /**< matches blank lines */ - - -/** Initialize the regular expressions. - * @return true upon success. - */ -bool flex_init_regex(void) -{ - flex_regcomp(®ex_linedir, REGEXP_LINEDIR, REG_EXTENDED); - flex_regcomp(®ex_blank_line, REGEXP_BLANK_LINE, REG_EXTENDED); - - return true; -} - -/** Compiles a regular expression or dies trying. - * @param preg Same as for regcomp(). - * @param regex Same as for regcomp(). - * @param cflags Same as for regcomp(). - */ -void flex_regcomp(regex_t *preg, const char *regex, int cflags) -{ - int err; - - memset (preg, 0, sizeof (regex_t)); - - if ((err = regcomp (preg, regex, cflags)) != 0) { - const int errbuf_sz = 200; - char * errbuf=0; - - errbuf = (char*)flex_alloc(errbuf_sz *sizeof(char)); - regerror (err, preg, errbuf, errbuf_sz); - sprintf (errbuf, "regcomp failed: %s\n", errbuf); - - flexfatal (errbuf); - free(errbuf); - } -} - -/** Extract a copy of the match, or NULL if no match. - * @param m A match as returned by regexec(). - * @param src The source string that was passed to regexec(). - * @return The allocated string. - */ -char *regmatch_dup (regmatch_t * m, const char *src) -{ - char *str; - int len; - - if (m == NULL || m->rm_so < 0) - return NULL; - len = m->rm_eo - m->rm_so; - str = (char *) flex_alloc ((len + 1) * sizeof (char)); - strncpy (str, src + m->rm_so, len); - str[len] = 0; - return str; -} - -/** Copy the match. - * @param m A match as returned by regexec(). - * @param dest The destination buffer. - * @param src The source string that was passed to regexec(). - * @return dest - */ -char *regmatch_cpy (regmatch_t * m, char *dest, const char *src) -{ - if (m == NULL || m->rm_so < 0) { - if (dest) - dest[0] = '\0'; - return dest; - } - - snprintf (dest, regmatch_len(m), "%s", src + m->rm_so); - return dest; -} - -/** Get the length in characters of the match. - * @param m A match as returned by regexec(). - * @param src The source string that was passed to regexec(). - * @return The length of the match. - */ -int regmatch_len (regmatch_t * m) -{ - if (m == NULL || m->rm_so < 0) { - return 0; - } - - return m->rm_eo - m->rm_so; -} - - - -/** Convert a regmatch_t object to an integer using the strtol() function. - * @param m A match as returned by regexec(). - * @param src The source string that was passed to regexec(). - * @param endptr Same as the second argument to strtol(). - * @param base Same as the third argument to strtol(). - * @return The converted integer or error (Return value is the same as for strtol()). - */ -int regmatch_strtol (regmatch_t * m, const char *src, char **endptr, - int base) -{ - int n = 0; - -#define bufsz 20 - char buf[bufsz]; - char *s; - - if (m == NULL || m->rm_so < 0) - return 0; - - if (regmatch_len (m) < bufsz) - s = regmatch_cpy (m, buf, src); - else - s = regmatch_dup (m, src); - - n = strtol (s, endptr, base); - - if (s != buf) - free (s); - - return n; -} - -/** Check for empty or non-existent match. - * @param m A match as returned by regexec(). - * @return false if match length is non-zero. - * Note that reg_empty returns true even if match did not occur at all. - */ -bool regmatch_empty (regmatch_t * m) -{ - return (m == NULL || m->rm_so < 0 || m->rm_so == m->rm_eo); -} - -/* vim:set expandtab cindent tabstop=4 softtabstop=4 shiftwidth=4 textwidth=0: */ diff --git a/src/bin/flex/scan.c b/src/bin/flex/scan.c deleted file mode 100644 index 1c22e6ac2c..0000000000 --- a/src/bin/flex/scan.c +++ /dev/null @@ -1,4645 +0,0 @@ -#define YY_INT_ALIGNED short int - - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 28 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ - -#include -#include -#include -#include - - -/* end standard C headers. */ - - -/* 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 -#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 */ - - - - - - -#ifdef __cplusplus - -/* C++ compilers don't understand traditional function definitions. */ -#ifdef YY_TRADITIONAL_FUNC_DEFS -#undef YY_TRADITIONAL_FUNC_DEFS -#endif - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* We're not in a C++ compiler, so by default, - we generate C99 function defs, unless you explicitly ask - for traditional defs by defining YY_TRADITIONAL_FUNC_DEFS */ - -#if __STDC__ - -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* For compilers that can't handle prototypes. - * e.g., - * The function prototype - * int foo(int x, char* y); - * - * ...should be written as - * int foo YY_PARAMS((int x, char* y)); - * - * ...which could possibly generate - * int foo (); - */ -#ifdef YY_NO_PROTOS -#define YY_PARAMS(proto) () -#else -#define YY_PARAMS(proto) proto -#endif - - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* 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) - - - -/* Define these macros to be no-ops. */ -#define YY_G(var) (var) -#define YY_PROTO_LAST_ARG -#define YY_PROTO_ONLY_ARG void -#define YY_DEF_LAST_ARG -#ifdef YY_TRADITIONAL_FUNC_DEFS -#define YY_DEF_ONLY_ARG -#else -#define YY_DEF_ONLY_ARG void -#endif -#define YY_DECL_LAST_ARG -#define YY_CALL_LAST_ARG -#define YY_CALL_ONLY_ARG - - - -/* For compilers that need traditional function definitions. - * e.g., - * The function prototype taking 2 arguments - * int foo (int x, char* y) - * - * ...should be written as - * int foo YYFARGS2(int,x, char*,y) - * - * ...which could possibly generate - * int foo (x,y,yyscanner) - * int x; - * char * y; - * yyscan_t yyscanner; - */ -#ifdef YY_TRADITIONAL_FUNC_DEFS -/* Generate traditional function defs */ -#define YYFARGS0(v) (YY_DEF_ONLY_ARG) YY_DECL_LAST_ARG -#define YYFARGS1(t1,n1) (n1 YY_DEF_LAST_ARG) t1 n1; YY_DECL_LAST_ARG -#define YYFARGS2(t1,n1,t2,n2) (n1,n2 YY_DEF_LAST_ARG) t1 n1; t2 n2; YY_DECL_LAST_ARG -#define YYFARGS3(t1,n1,t2,n2,t3,n3) (n1,n2,n3 YY_DEF_LAST_ARG) t1 n1; t2 n2; t3 n3; YY_DECL_LAST_ARG -#else -/* Generate C99 function defs. */ -#define YYFARGS0(v) (YY_DEF_ONLY_ARG) -#define YYFARGS1(t1,n1) (t1 n1 YY_DEF_LAST_ARG) -#define YYFARGS2(t1,n1,t2,n2) (t1 n1,t2 n2 YY_DEF_LAST_ARG) -#define YYFARGS3(t1,n1,t2,n2,t3,n3) (t1 n1,t2 n2,t3 n3 YY_DEF_LAST_ARG) -#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_G(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_G(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 YY_CALL_LAST_ARG ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#define YY_BUF_SIZE 16384 -#endif - - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int yyleng; - - -extern FILE *yyin, *yyout; - - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -#ifdef YY_USE_LINENO -/* Note: We specifically omit the test for yy_rule_can_match_eol because it requires - * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE yylex. - * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-yylineno scanner, because yy_act is - * normally declared as a register variable-- so it's not worth it. - */ -#define YY_LESS_LINENO(n) \ - do { \ - int yyl;\ - for ( yyl = n; yyl < yyleng; ++yyl )\ - if ( yytext[yyl] == '\n' )\ - --yylineno;\ - }while(0) -#else -#define YY_LESS_LINENO(n) -#endif - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* 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_G(yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - YY_G(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, YY_G(yytext_ptr) YY_CALL_LAST_ARG ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - - FILE *yy_input_file; - - - - - - - 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; - - /* 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 */ - - -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -static YY_BUFFER_STATE yy_current_buffer = 0; -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ - - -/* 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". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - - -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-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 = 1; /* 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; -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ - -void yyrestart YY_PARAMS(( FILE *input_file YY_PROTO_LAST_ARG )); - - -void yy_switch_to_buffer YY_PARAMS(( YY_BUFFER_STATE new_buffer YY_PROTO_LAST_ARG )); -void yy_load_buffer_state YY_PARAMS(( YY_PROTO_ONLY_ARG )); -YY_BUFFER_STATE yy_create_buffer YY_PARAMS(( FILE *file, int size YY_PROTO_LAST_ARG )); -void yy_delete_buffer YY_PARAMS(( YY_BUFFER_STATE b YY_PROTO_LAST_ARG )); -void yy_init_buffer YY_PARAMS(( YY_BUFFER_STATE b, FILE *file YY_PROTO_LAST_ARG )); -void yy_flush_buffer YY_PARAMS(( YY_BUFFER_STATE b YY_PROTO_LAST_ARG )); - -#define YY_FLUSH_BUFFER yy_flush_buffer( YY_G(yy_current_buffer) YY_CALL_LAST_ARG) - -YY_BUFFER_STATE yy_scan_buffer YY_PARAMS(( char *base, yy_size_t size YY_PROTO_LAST_ARG )); -YY_BUFFER_STATE yy_scan_string YY_PARAMS(( yyconst char *yy_str YY_PROTO_LAST_ARG )); -YY_BUFFER_STATE yy_scan_bytes YY_PARAMS(( yyconst char *bytes, int len YY_PROTO_LAST_ARG )); - - - -void *yyalloc YY_PARAMS(( yy_size_t YY_PROTO_LAST_ARG )); -void *yyrealloc YY_PARAMS(( void *, yy_size_t YY_PROTO_LAST_ARG )); -void yyfree YY_PARAMS(( void * YY_PROTO_LAST_ARG )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_G(yy_current_buffer) ) \ - YY_G(yy_current_buffer) = \ - yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG); \ - YY_G(yy_current_buffer)->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_G(yy_current_buffer) ) \ - YY_G(yy_current_buffer) = \ - yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG); \ - YY_G(yy_current_buffer)->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_G(yy_current_buffer)->yy_at_bol) - -/* Begin user sect3 */ -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -typedef unsigned char YY_CHAR; -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -#ifndef YY_REENTRANT -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -#endif -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -typedef int yy_state_type; -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ -extern int yylineno; -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -int yylineno = 1; -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ -extern char *yytext; -#define yytext_ptr yytext - - -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -static yy_state_type yy_get_previous_state YY_PARAMS(( YY_PROTO_ONLY_ARG )); -static yy_state_type yy_try_NUL_trans YY_PARAMS(( yy_state_type current_state YY_PROTO_LAST_ARG)); -static int yy_get_next_buffer YY_PARAMS(( YY_PROTO_ONLY_ARG )); -static void yy_fatal_error YY_PARAMS(( yyconst char msg[] YY_PROTO_LAST_ARG )); -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ - - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - YY_G(yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - YY_G(yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - YY_G(yy_c_buf_p) = yy_cp; - -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -#define YY_NUM_RULES 201 -#define YY_END_OF_BUFFER 202 -/* 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[973] = - { 0, - 0, 0, 0, 0, 122, 122, 199, 199, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 202, 200, 9, 20, 200, 18, 1, 19, 200, 200, - 200, 200, 17, 143, 135, 136, 143, 128, 143, 142, - 143, 143, 143, 142, 134, 124, 143, 143, 126, 127, - 122, 123, 122, 121, 120, 121, 199, 199, 30, 31, - 30, 30, 30, 30, 30, 30, 37, 36, 38, 200, - 149, 149, 144, 149, 145, 146, 148, 150, 177, 178, - - 177, 175, 174, 176, 151, 153, 151, 152, 151, 156, - 156, 156, 156, 158, 160, 158, 158, 158, 158, 159, - 187, 191, 187, 190, 192, 192, 188, 188, 188, 185, - 186, 200, 117, 200, 23, 24, 23, 22, 193, 195, - 193, 196, 197, 183, 183, 184, 183, 183, 183, 183, - 183, 183, 183, 116, 40, 39, 116, 116, 116, 116, - 41, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 28, 25, 28, 26, 35, 34, 200, 33, - 32, 9, 20, 0, 18, 1, 19, 0, 0, 0, - - 16, 10, 0, 0, 0, 0, 4, 16, 5, 0, - 2, 17, 135, 136, 0, 0, 0, 130, 0, 0, - 140, 140, 0, 198, 198, 198, 129, 0, 134, 124, - 0, 0, 0, 126, 127, 139, 125, 0, 122, 123, - 121, 120, 120, 118, 119, 199, 199, 30, 31, 30, - 30, 30, 30, 37, 36, 38, 0, 144, 0, 144, - 147, 148, 178, 174, 153, 0, 154, 155, 160, 157, - 187, 191, 0, 189, 0, 180, 188, 188, 188, 0, - 117, 0, 23, 24, 23, 21, 193, 195, 194, 183, - 183, 183, 184, 179, 183, 183, 183, 40, 39, 0, - - 115, 0, 0, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 42, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 0, 27, 26, 35, 34, 0, - 16, 10, 0, 14, 0, 0, 0, 0, 0, 4, - 16, 5, 0, 6, 0, 131, 0, 132, 0, 0, - 140, 140, 0, 140, 140, 140, 198, 198, 0, 141, - 125, 133, 0, 139, 0, 118, 119, 30, 30, 30, - 29, 30, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 188, 188, 179, 179, 183, 183, - - 0, 0, 116, 116, 116, 116, 116, 116, 116, 54, - 116, 116, 116, 59, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 0, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 0, 0, - 0, 14, 0, 0, 0, 0, 0, 0, 4, 8, - 5, 0, 140, 140, 140, 140, 140, 140, 198, 141, - 0, 0, 30, 30, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 188, 188, 183, - 183, 43, 44, 116, 116, 116, 116, 116, 116, 116, - - 116, 116, 116, 60, 61, 116, 116, 116, 116, 66, - 116, 116, 116, 116, 116, 116, 116, 71, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 80, 0, 0, - 0, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 0, 15, 0, 0, 0, 0, 0, 8, 8, 8, - 0, 140, 140, 140, 140, 140, 140, 0, 0, 30, - 30, 173, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 188, 188, 183, 183, 45, 116, - 116, 47, 116, 51, 116, 116, 116, 116, 57, 116, - 116, 62, 116, 116, 116, 116, 116, 116, 116, 116, - - 116, 116, 116, 74, 116, 116, 116, 116, 78, 116, - 0, 0, 0, 0, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 3, 0, 0, 0, 8, 7, 8, - 0, 140, 140, 140, 0, 0, 30, 30, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 181, 182, 181, 182, 116, 116, 116, 50, 116, 116, - 116, 116, 116, 116, 112, 116, 116, 116, 116, 116, - 116, 116, 116, 110, 116, 73, 116, 76, 116, 77, - 116, 0, 0, 0, 0, 116, 116, 92, 0, 116, - 82, 116, 0, 83, 0, 12, 0, 13, 0, 138, - - 0, 137, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 116, 116, 116, 116, 116, 116, - 116, 55, 116, 58, 116, 116, 116, 116, 116, 109, - 116, 70, 116, 116, 75, 116, 79, 0, 0, 0, - 0, 90, 111, 0, 0, 0, 0, 0, 0, 116, - 116, 0, 0, 0, 0, 0, 0, 137, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 116, 116, 116, 116, 116, 116, 116, 56, 116, 116, - 116, 67, 116, 116, 116, 116, 116, 116, 0, 0, - 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, - - 0, 81, 116, 0, 0, 102, 0, 0, 0, 0, - 0, 11, 0, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 0, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 72, 116, - 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 103, 0, 91, 0, 0, 0, 0, 0, - 104, 172, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 64, 116, 116, 116, 116, 116, 0, 0, 0, - 0, 0, 0, 0, 0, 97, 0, 107, 105, 98, - 0, 0, 0, 108, 106, 116, 116, 116, 116, 116, - - 116, 116, 112, 63, 116, 69, 116, 113, 116, 0, - 0, 0, 0, 0, 0, 93, 95, 0, 94, 96, - 0, 116, 116, 116, 52, 116, 116, 116, 116, 65, - 116, 85, 0, 0, 0, 0, 86, 99, 100, 116, - 116, 116, 116, 116, 116, 116, 114, 84, 0, 88, - 0, 116, 116, 116, 116, 116, 116, 87, 89, 116, - 116, 49, 53, 116, 116, 116, 48, 116, 116, 68, - 46, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 4, 4, 5, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 6, 7, 8, 9, 1, 10, 11, - 11, 12, 13, 14, 15, 11, 16, 17, 17, 17, - 17, 17, 17, 17, 18, 19, 20, 21, 1, 22, - 23, 24, 11, 1, 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, 48, - 27, 28, 29, 30, 31, 1, 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, 48, 57, 58, 59, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 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[60] = - { 0, - 1, 1, 2, 1, 3, 4, 1, 1, 1, 5, - 1, 6, 7, 1, 8, 5, 9, 9, 9, 9, - 1, 1, 1, 1, 10, 11, 1, 12, 13, 1, - 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 17, 1, 18 - } ; - -static yyconst flex_int16_t yy_base[1070] = - { 0, - 0, 59, 117, 175, 121, 129, 3236, 3235, 234, 3228, - 138, 144, 293, 0, 3206, 3205, 145, 152, 187, 193, - 124, 179, 350, 353, 382, 0, 132, 153, 205, 211, - 439, 443, 471, 0, 530, 0, 354, 444, 587, 588, - 3234, 3240, 217, 3240, 3230, 0, 222, 3240, 3229, 151, - 639, 3219, 0, 3240, 592, 3240, 3227, 3240, 226, 3240, - 3207, 133, 581, 344, 600, 3240, 3225, 595, 3205, 3240, - 0, 3240, 3223, 0, 3223, 310, 3221, 3240, 0, 3240, - 3220, 3240, 0, 3186, 3165, 3161, 0, 3217, 3240, 3215, - 3240, 449, 3215, 3213, 3240, 3185, 0, 3240, 3240, 3240, - - 3211, 3240, 438, 3240, 3240, 3240, 3210, 3240, 594, 3240, - 3191, 596, 197, 3240, 3240, 3208, 0, 3189, 600, 3240, - 0, 3240, 3206, 3240, 157, 3196, 0, 3171, 3150, 3240, - 3240, 463, 3240, 603, 616, 3240, 620, 3189, 0, 3240, - 3201, 3240, 0, 0, 357, 3240, 3200, 3143, 3240, 3189, - 0, 3164, 3143, 3240, 3196, 3240, 3194, 3190, 3162, 3161, - 3240, 583, 575, 597, 3157, 3158, 568, 0, 3155, 3145, - 3153, 433, 143, 3136, 588, 3151, 3135, 3153, 3139, 3147, - 3150, 3125, 3240, 3240, 3174, 621, 0, 3240, 3176, 3240, - 3240, 651, 3240, 3175, 0, 657, 3240, 3174, 625, 3136, - - 0, 0, 690, 695, 699, 718, 0, 3129, 0, 628, - 3240, 0, 667, 3240, 3171, 3116, 658, 3240, 3169, 3135, - 173, 432, 625, 3240, 358, 0, 3240, 3111, 725, 3240, - 3166, 3111, 3155, 3144, 3240, 0, 3240, 3129, 0, 3240, - 0, 0, 3162, 0, 0, 3160, 3240, 0, 3240, 0, - 3121, 3117, 783, 0, 3158, 3240, 662, 3157, 3155, 3155, - 3240, 0, 3240, 725, 3240, 811, 3240, 3240, 3240, 3240, - 0, 3240, 185, 3240, 0, 3240, 0, 3115, 3111, 674, - 3240, 700, 719, 3240, 726, 3240, 0, 3240, 3240, 0, - 697, 3095, 3240, 866, 0, 3112, 3108, 3149, 3240, 3144, - - 3240, 3109, 3108, 0, 686, 3097, 3097, 623, 3095, 3131, - 3093, 645, 3092, 3091, 3097, 3107, 636, 3083, 3097, 3085, - 0, 3082, 3240, 3083, 3084, 708, 3096, 718, 717, 3098, - 713, 3081, 3080, 895, 3122, 3240, 748, 0, 3240, 3082, - 0, 0, 938, 3240, 3123, 945, 3076, 3073, 3083, 0, - 3075, 0, 758, 3240, 766, 3240, 767, 3240, 770, 3075, - 705, 753, 913, 968, 1011, 1023, 739, 0, 3061, 774, - 3240, 3240, 3083, 0, 3072, 0, 0, 3081, 3070, 1060, - 3240, 0, 1119, 3094, 826, 916, 907, 913, 1101, 645, - 1110, 121, 914, 827, 3078, 3067, 0, 1178, 3076, 3065, - - 3059, 3058, 3070, 3075, 3066, 3073, 3062, 3069, 3056, 0, - 3065, 3048, 3067, 0, 3047, 3054, 3061, 3043, 3058, 3078, - 3047, 3059, 3054, 3052, 3051, 3042, 3046, 3048, 3049, 3038, - 3046, 3047, 810, 3037, 3029, 3026, 3044, 3031, 983, 3032, - 3031, 3024, 3036, 3031, 3024, 3033, 3032, 3018, 3030, 848, - 1149, 3240, 852, 1153, 1042, 3033, 3024, 3018, 0, 995, - 0, 3025, 1213, 1147, 1253, 3040, 1186, 1274, 3240, 3240, - 3014, 3022, 3024, 3008, 0, 3027, 1195, 730, 915, 933, - 1014, 1136, 1123, 1188, 1189, 1194, 1190, 3021, 3005, 3019, - 3003, 3240, 3240, 3006, 2994, 3034, 2992, 2995, 3007, 3000, - - 1259, 3006, 2991, 0, 0, 3006, 2990, 2991, 3005, 0, - 3023, 2988, 2996, 3020, 2983, 2978, 2992, 0, 2980, 2996, - 2987, 2983, 2975, 2990, 2974, 2973, 2977, 0, 813, 2988, - 2975, 2977, 2987, 2982, 2966, 2971, 2966, 2982, 2962, 2980, - 3009, 3240, 1214, 1220, 2954, 2963, 2957, 0, 1218, 1224, - 2983, 2985, 1286, 1298, 1252, 1004, 1009, 2968, 2980, 2952, - 2966, 3240, 1160, 1256, 1255, 1263, 1203, 1197, 100, 1276, - 1303, 1304, 1124, 1284, 2950, 2964, 2948, 2962, 0, 2947, - 183, 0, 2949, 0, 2980, 1279, 2942, 2957, 0, 2949, - 2942, 0, 2958, 2943, 2952, 2972, 2943, 2936, 2948, 2968, - - 2927, 2932, 2929, 0, 2939, 2927, 2927, 2941, 0, 2925, - 2927, 2923, 2940, 2924, 2924, 2919, 2932, 2936, 2930, 2929, - 2921, 2932, 2915, 2959, 1229, 2915, 2923, 1337, 3240, 2955, - 2933, 1299, 1026, 1255, 2932, 2931, 0, 0, 1299, 1315, - 925, 1320, 1323, 1325, 1324, 1327, 1328, 1329, 1331, 1330, - 0, 0, 0, 0, 2939, 2917, 2903, 0, 1323, 2906, - 2914, 2906, 2898, 2896, 2931, 2911, 2900, 2909, 2902, 2905, - 2904, 2890, 2904, 0, 2905, 0, 2885, 0, 2920, 0, - 2898, 2902, 2893, 2886, 2899, 2895, 2878, 0, 1341, 2882, - 0, 2883, 1350, 0, 1350, 3240, 1354, 3240, 2876, 3240, - - 2900, 3240, 2902, 2901, 2900, 2899, 2898, 2897, 2896, 2895, - 2894, 2893, 2892, 1337, 2872, 2874, 2864, 2860, 2862, 2857, - 2861, 0, 2855, 0, 2867, 2852, 2855, 2851, 2803, 0, - 2796, 0, 2796, 2776, 0, 317, 0, 2753, 2754, 2751, - 2728, 0, 0, 2741, 2716, 2725, 1355, 2717, 2732, 2714, - 2703, 2672, 2652, 2654, 1329, 2646, 1357, 3240, 2630, 2612, - 2597, 2596, 2578, 2574, 2573, 2572, 2569, 2550, 2545, 2552, - 2521, 2525, 2513, 2521, 2526, 2520, 2502, 0, 2504, 2496, - 2502, 0, 2469, 2447, 2448, 2420, 2427, 2430, 2410, 2410, - 1321, 2407, 2421, 2402, 3240, 2407, 2401, 2399, 2393, 2373, - - 2364, 0, 2384, 2378, 2359, 3240, 2364, 2360, 2373, 2350, - 1394, 3240, 1397, 3240, 3240, 3240, 3240, 3240, 3240, 3240, - 3240, 3240, 3240, 3240, 2368, 2310, 2298, 2279, 2272, 2257, - 2226, 2228, 2221, 2210, 2206, 2220, 2206, 2207, 0, 2192, - 2179, 2185, 2143, 808, 2142, 2135, 2114, 2111, 2121, 2104, - 2088, 2064, 3240, 2055, 0, 2036, 2035, 2047, 2048, 2036, - 3240, 3240, 2024, 2015, 2003, 2009, 1995, 1995, 1991, 2005, - 2001, 0, 1984, 1964, 1975, 1963, 1957, 1932, 1924, 1918, - 1883, 1881, 1878, 1886, 1891, 3240, 1876, 3240, 3240, 3240, - 1876, 1871, 1840, 3240, 3240, 1831, 1828, 1803, 1822, 1813, - - 1812, 1805, 0, 0, 1812, 0, 1792, 0, 1803, 1803, - 1784, 1794, 1759, 1737, 1723, 3240, 3240, 1708, 3240, 3240, - 1707, 1701, 1675, 1663, 0, 1663, 1633, 1630, 1373, 0, - 1350, 3240, 1369, 1368, 1353, 1356, 3240, 3240, 3240, 1360, - 1343, 1347, 1330, 1321, 1265, 1247, 0, 3240, 124, 3240, - 405, 419, 551, 585, 661, 729, 812, 3240, 3240, 911, - 910, 0, 0, 1013, 1100, 1108, 0, 1192, 1195, 0, - 0, 3240, 1408, 1426, 1444, 1462, 1480, 1498, 1516, 1534, - 1552, 1570, 1588, 1606, 1624, 1642, 1660, 1671, 1687, 1697, - 1713, 1731, 1741, 1757, 1775, 1793, 1811, 1829, 1840, 1856, - - 1867, 1883, 1901, 1919, 1932, 1943, 1959, 1977, 1995, 2013, - 2031, 2042, 2058, 2070, 1352, 2086, 2104, 2120, 2138, 2147, - 2154, 2170, 2181, 2197, 2215, 2233, 2243, 2251, 2269, 2287, - 2305, 2323, 2341, 2359, 2377, 2395, 2406, 2422, 2433, 2440, - 2456, 2469, 2480, 2496, 2514, 2532, 2550, 2561, 2577, 2589, - 2605, 2623, 2639, 2657, 2675, 2686, 2695, 2711, 2729, 2747, - 2757, 2765, 2783, 2801, 2819, 2830, 2846, 2864, 2882 - } ; - -static yyconst flex_int16_t yy_def[1070] = - { 0, - 972, 972, 973, 973, 974, 975, 976, 976, 972, 9, - 977, 977, 972, 13, 978, 978, 979, 979, 980, 980, - 981, 981, 982, 982, 972, 25, 983, 983, 984, 984, - 985, 985, 972, 33, 972, 35, 986, 986, 987, 987, - 972, 972, 972, 972, 972, 988, 972, 972, 972, 972, - 989, 972, 990, 972, 972, 972, 972, 972, 972, 972, - 972, 991, 992, 993, 972, 972, 972, 972, 972, 972, - 994, 972, 994, 995, 996, 995, 997, 972, 998, 972, - 998, 972, 999, 999, 999, 998, 1000, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 1001, 972, 972, 972, - - 972, 972, 972, 972, 972, 972, 972, 972, 992, 972, - 972, 992, 1002, 972, 972, 972, 1003, 972, 992, 972, - 1004, 972, 1004, 972, 1005, 972, 1006, 1006, 1006, 972, - 972, 1007, 972, 1007, 1008, 972, 1008, 972, 1009, 972, - 1009, 972, 1010, 1011, 1011, 972, 1011, 1011, 972, 1011, - 1012, 1012, 1012, 972, 972, 972, 972, 1013, 972, 972, - 972, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, - 1014, 1014, 1015, 1014, 1014, 1014, 1014, 1014, 1014, 1014, - 1014, 1014, 972, 972, 1016, 972, 1017, 972, 972, 972, - 972, 972, 972, 972, 988, 972, 972, 972, 972, 972, - - 1018, 1019, 972, 972, 972, 972, 1020, 1018, 1021, 1022, - 972, 1023, 972, 972, 972, 972, 1024, 972, 972, 972, - 1025, 1025, 1026, 972, 972, 1027, 972, 1028, 972, 972, - 972, 972, 972, 972, 972, 1029, 972, 972, 1030, 972, - 1031, 1032, 1032, 1033, 1034, 1035, 972, 1036, 972, 1037, - 1037, 1037, 972, 1038, 972, 972, 972, 972, 972, 972, - 972, 1039, 972, 972, 972, 1040, 972, 972, 972, 972, - 1041, 972, 1042, 972, 1042, 972, 1043, 1043, 1043, 1044, - 972, 1044, 1045, 972, 1045, 972, 1046, 972, 972, 1047, - 1047, 1047, 972, 972, 1048, 1048, 1048, 972, 972, 1049, - - 972, 972, 972, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 972, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1051, 972, 972, 1052, 972, 972, - 1053, 1054, 1055, 972, 972, 972, 972, 972, 972, 1056, - 1053, 1057, 1058, 972, 1058, 972, 1059, 972, 1059, 972, - 1060, 1060, 1060, 972, 1060, 1060, 972, 1061, 1062, 972, - 972, 972, 972, 1063, 972, 1064, 1065, 1066, 1066, 972, - 972, 380, 380, 1040, 1040, 1040, 1040, 1040, 1040, 1040, - 1040, 1040, 1040, 1040, 1043, 1043, 294, 294, 1048, 1048, - - 972, 972, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 972, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 972, 1055, - 1055, 972, 1055, 1055, 972, 972, 972, 972, 1056, 1067, - 1057, 972, 364, 1060, 366, 364, 1060, 366, 972, 972, - 972, 972, 1066, 1066, 383, 972, 1040, 1040, 1040, 1040, - 1040, 1040, 1040, 1040, 1040, 1040, 1040, 1043, 1043, 1048, - 1048, 972, 972, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 972, 972, - 972, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 972, 972, 1055, 1055, 972, 972, 972, 1067, 1067, 1067, - 972, 463, 1060, 366, 1060, 1060, 1060, 972, 972, 1066, - 1066, 972, 1040, 1040, 1040, 1040, 1040, 1040, 1040, 1040, - 1040, 1040, 1040, 1040, 1043, 1043, 1048, 1048, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 972, 972, 972, 972, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 972, 1068, 972, 972, 1067, 972, 1067, - 972, 1060, 1060, 1060, 972, 972, 1066, 1066, 1040, 1040, - 1040, 1040, 1040, 1040, 1040, 1040, 1040, 1040, 1040, 1040, - 1043, 1043, 1048, 1048, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 972, 972, 972, 972, 1050, 1050, 1050, 972, 1050, - 1050, 1050, 972, 1050, 1068, 972, 1068, 972, 972, 972, - - 972, 972, 1040, 1040, 1040, 1040, 1040, 1040, 1040, 1040, - 1040, 1040, 1040, 1040, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 972, 972, 972, - 972, 1050, 1050, 972, 972, 972, 972, 972, 972, 1050, - 1050, 972, 972, 972, 972, 972, 1069, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 1040, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - - 972, 1050, 1050, 972, 972, 972, 972, 972, 972, 972, - 1069, 972, 1069, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 1050, 972, 972, 972, 972, 972, - 972, 972, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 1050, 1050, 1050, 1050, 1050, - - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 972, 972, 972, 972, 972, 972, 972, 972, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 972, 972, 972, - 972, 1050, 1050, 1050, 1050, 1050, 1050, 972, 972, 1050, - 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, - 1050, 0, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972 - } ; - -static yyconst flex_int16_t yy_nxt[3300] = - { 0, - 42, 43, 44, 42, 45, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 46, 46, 42, 42, 42, 42, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 42, 42, 42, 42, - 47, 48, 42, 49, 42, 50, 42, 51, 42, 42, - 42, 42, 42, 42, 52, 42, 42, 42, 42, 42, - 42, 42, 42, 53, 53, 42, 42, 42, 42, 53, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - - 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 42, 42, 42, 55, 56, - 476, 57, 58, 72, 59, 73, 42, 60, 60, 60, - 75, 72, 60, 73, 133, 645, 134, 76, 61, 88, - 89, 476, 90, 62, 63, 88, 89, 100, 90, 101, - 111, 112, 199, 113, 100, 133, 101, 134, 102, 222, - 223, 103, 103, 103, 103, 102, 274, 485, 103, 103, - 103, 103, 958, 64, 60, 60, 65, 66, 322, 67, - 58, 42, 59, 68, 275, 60, 60, 60, 323, 106, - 60, 107, 108, 200, 274, 106, 69, 107, 108, 362, - - 363, 62, 63, 104, 70, 111, 112, 136, 113, 137, - 104, 268, 275, 136, 109, 137, 138, 656, 192, 193, - 109, 194, 138, 196, 197, 268, 198, 218, 218, 657, - 219, 64, 60, 60, 79, 79, 80, 79, 81, 79, - 79, 79, 79, 79, 79, 82, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 83, 83, - 79, 79, 79, 79, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 84, 83, 83, 83, 83, 83, 83, 85, - 79, 79, 79, 91, 92, 93, 91, 94, 91, 91, - - 91, 91, 91, 91, 95, 91, 95, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 96, 97, 97, 91, - 91, 91, 91, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 91, - 91, 91, 115, 787, 116, 115, 184, 116, 291, 185, - 227, 227, 227, 227, 117, 292, 244, 117, 245, 788, - 186, 186, 186, 186, 367, 367, 118, 119, 120, 118, - 119, 120, 121, 121, 122, 121, 123, 124, 121, 121, - 121, 125, 121, 121, 121, 121, 121, 126, 121, 121, - - 121, 121, 121, 121, 121, 121, 127, 127, 121, 121, - 121, 121, 127, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 128, 127, 127, 127, 127, 127, 127, 129, 130, 121, - 131, 140, 959, 141, 142, 140, 184, 141, 142, 185, - 257, 258, 364, 259, 264, 264, 264, 264, 362, 363, - 186, 186, 186, 186, 319, 281, 143, 282, 320, 960, - 143, 144, 145, 146, 144, 147, 144, 144, 144, 148, - 144, 144, 149, 144, 144, 144, 150, 144, 144, 144, - 144, 144, 144, 144, 144, 151, 151, 144, 144, 144, - - 144, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 152, - 151, 151, 151, 151, 151, 151, 153, 144, 144, 144, - 154, 155, 156, 154, 157, 158, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 159, 160, 154, - 154, 154, 161, 154, 154, 154, 154, 154, 154, 154, - 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 168, 168, 171, 172, 173, 174, 175, 168, 176, 177, - 178, 179, 180, 181, 168, 182, 154, 154, 154, 188, - 188, 189, 189, 213, 214, 961, 215, 225, 225, 314, - - 216, 229, 230, 236, 231, 281, 308, 282, 232, 310, - 225, 225, 225, 225, 309, 233, 225, 225, 284, 315, - 285, 234, 284, 325, 285, 305, 199, 306, 311, 235, - 354, 307, 355, 326, 962, 226, 327, 337, 337, 337, - 337, 365, 365, 190, 190, 191, 191, 202, 226, 217, - 226, 237, 192, 193, 226, 194, 407, 217, 196, 197, - 358, 198, 359, 257, 258, 476, 259, 200, 213, 214, - 203, 215, 204, 408, 204, 216, 281, 412, 282, 366, - 204, 413, 418, 204, 205, 206, 419, 204, 207, 208, - 482, 343, 344, 209, 345, 210, 343, 344, 291, 345, - - 343, 344, 281, 345, 282, 292, 346, 346, 346, 346, - 963, 346, 346, 346, 346, 346, 346, 346, 346, 343, - 344, 284, 345, 285, 217, 403, 229, 230, 284, 231, - 285, 362, 363, 232, 346, 346, 346, 346, 347, 404, - 233, 264, 264, 264, 264, 348, 234, 426, 432, 429, - 476, 433, 435, 430, 235, 224, 224, 427, 431, 436, - 354, 565, 355, 349, 337, 337, 337, 337, 354, 358, - 355, 359, 358, 463, 359, 470, 470, 470, 470, 362, - 363, 964, 217, 380, 380, 381, 380, 382, 380, 380, - 380, 380, 380, 380, 383, 380, 380, 380, 380, 380, - - 380, 380, 380, 380, 380, 380, 380, 383, 383, 380, - 380, 380, 380, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 380, - 380, 380, 385, 386, 387, 388, 476, 476, 389, 522, - 542, 965, 543, 390, 452, 523, 543, 391, 611, 880, - 392, 487, 393, 881, 612, 394, 397, 397, 477, 397, - 397, 397, 397, 397, 397, 397, 397, 398, 397, 397, - 397, 397, 397, 397, 397, 397, 397, 397, 397, 397, - 398, 398, 397, 397, 397, 397, 398, 398, 398, 398, - - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 397, 397, 397, 439, 440, 476, 441, 464, - 464, 442, 443, 476, 476, 476, 476, 444, 445, 451, - 452, 361, 453, 446, 447, 476, 455, 344, 448, 345, - 966, 479, 480, 476, 454, 454, 454, 454, 478, 967, - 486, 346, 346, 346, 346, 566, 705, 465, 361, 361, - 567, 361, 361, 361, 361, 361, 361, 361, 361, 361, - 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, - 361, 361, 466, 466, 362, 363, 549, 361, 361, 466, - - 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, - 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, - 466, 466, 466, 466, 361, 361, 361, 467, 467, 529, - 362, 363, 530, 531, 476, 362, 363, 362, 363, 468, - 468, 468, 468, 455, 344, 568, 345, 468, 778, 362, - 363, 550, 362, 363, 468, 468, 468, 468, 468, 468, - 380, 380, 381, 380, 382, 380, 380, 380, 380, 380, - 380, 383, 380, 380, 380, 380, 380, 380, 380, 380, - 380, 380, 380, 380, 383, 383, 380, 380, 380, 380, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 380, 380, 380, 383, - 383, 476, 383, 475, 383, 383, 383, 383, 383, 383, - 476, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 476, 476, 383, 383, 383, 383, 481, - 451, 452, 968, 453, 544, 452, 476, 453, 483, 649, - 969, 484, 570, 553, 553, 454, 454, 454, 454, 454, - 454, 454, 454, 362, 363, 383, 383, 383, 398, 398, - 476, 398, 398, 398, 398, 398, 398, 398, 398, 569, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - - 398, 398, 556, 556, 398, 398, 398, 398, 476, 476, - 476, 639, 362, 363, 476, 476, 542, 476, 543, 549, - 572, 544, 452, 476, 453, 628, 629, 970, 630, 574, - 971, 696, 571, 697, 398, 398, 398, 552, 552, 563, - 573, 564, 643, 644, 552, 552, 552, 552, 552, 552, - 552, 552, 552, 552, 552, 552, 552, 552, 552, 552, - 552, 552, 552, 552, 552, 552, 552, 552, 552, 554, - 554, 554, 554, 586, 550, 476, 476, 554, 362, 363, - 221, 362, 363, 476, 554, 554, 554, 554, 554, 554, - 557, 557, 557, 557, 640, 587, 476, 957, 557, 641, - - 722, 588, 633, 633, 476, 557, 557, 557, 557, 557, - 557, 642, 362, 363, 634, 634, 634, 634, 660, 476, - 646, 650, 634, 476, 476, 362, 363, 361, 661, 634, - 634, 634, 634, 634, 634, 476, 647, 648, 628, 629, - 476, 630, 703, 476, 476, 476, 704, 476, 476, 476, - 476, 476, 696, 844, 697, 718, 696, 476, 697, 812, - 956, 813, 706, 708, 712, 719, 321, 321, 807, 714, - 845, 808, 709, 707, 955, 744, 745, 710, 711, 713, - 746, 809, 954, 747, 752, 753, 748, 770, 953, 754, - 796, 749, 755, 952, 797, 756, 812, 798, 813, 812, - - 951, 813, 950, 949, 948, 947, 946, 799, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 74, 74, 74, 74, 74, 74, - 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, - 74, 74, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, - 87, 87, 87, 87, 87, 87, 87, 87, 42, 42, - - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 110, 110, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, - 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, - 114, 114, 114, 114, 114, 114, 114, 114, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, - - 132, 132, 132, 132, 132, 132, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 183, 183, 183, 183, 183, 183, 183, 183, - 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 195, 195, - 195, 195, 945, 944, 195, 195, 195, 201, 201, 201, - 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, - - 201, 201, 201, 201, 212, 212, 212, 212, 943, 942, - 212, 212, 212, 221, 941, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 224, 940, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, 224, 228, - 228, 228, 939, 938, 228, 228, 228, 239, 937, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 241, 936, 241, 241, 241, - 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, - 241, 241, 241, 242, 935, 242, 242, 242, 242, 242, - - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 246, 246, 246, 246, 246, 246, 246, 246, 246, - 246, 246, 246, 246, 246, 246, 246, 246, 246, 248, - 934, 248, 248, 248, 933, 248, 248, 248, 932, 931, - 248, 248, 930, 929, 928, 248, 248, 250, 250, 250, - 250, 927, 926, 250, 250, 250, 254, 925, 924, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 262, 262, 262, 262, 923, 922, - 262, 262, 262, 267, 921, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - - 267, 270, 920, 270, 270, 270, 270, 270, 270, 270, - 270, 270, 270, 919, 270, 270, 270, 270, 270, 271, - 918, 271, 917, 916, 271, 271, 271, 271, 915, 914, - 271, 271, 273, 913, 273, 273, 273, 273, 273, 273, - 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, - 277, 277, 277, 277, 912, 911, 277, 277, 277, 280, - 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - 280, 280, 280, 280, 280, 280, 280, 283, 283, 283, - 283, 283, 910, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 287, 909, 287, 908, 287, - - 287, 287, 287, 287, 287, 287, 907, 287, 287, 287, - 287, 287, 287, 289, 906, 289, 289, 289, 289, 289, - 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, - 289, 290, 905, 290, 290, 290, 904, 290, 290, 290, - 903, 902, 290, 290, 901, 900, 899, 290, 290, 295, - 295, 295, 295, 898, 897, 295, 295, 295, 300, 896, - 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, - 300, 300, 300, 300, 300, 300, 304, 304, 895, 304, - 304, 894, 893, 892, 304, 304, 335, 891, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - - 335, 335, 335, 335, 338, 890, 889, 338, 338, 338, - 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, - 341, 888, 341, 341, 341, 341, 341, 341, 341, 341, - 341, 341, 341, 341, 341, 341, 341, 341, 342, 887, - 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, - 342, 342, 342, 342, 342, 342, 350, 350, 886, 885, - 350, 350, 350, 352, 352, 884, 883, 352, 352, 352, - 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, - 353, 353, 353, 353, 353, 353, 353, 353, 212, 212, - 212, 212, 882, 879, 212, 212, 212, 357, 357, 357, - - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 361, 878, 361, 361, 361, - 361, 361, 361, 361, 361, 361, 361, 877, 361, 361, - 361, 361, 361, 221, 876, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 368, 368, 875, 874, 873, 872, 368, 369, 369, - 369, 369, 871, 870, 369, 369, 369, 869, 369, 374, - 868, 374, 374, 374, 374, 374, 374, 374, 374, 374, - 374, 374, 374, 374, 374, 374, 374, 239, 867, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - - 239, 239, 239, 239, 239, 241, 866, 241, 241, 241, - 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, - 241, 241, 241, 242, 865, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 376, 864, 376, 376, 376, 376, 376, 376, 376, - 376, 376, 376, 376, 376, 376, 376, 376, 376, 377, - 863, 377, 377, 377, 377, 377, 377, 377, 377, 377, - 377, 377, 377, 377, 377, 377, 377, 246, 246, 246, - 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, - 246, 246, 246, 246, 246, 248, 862, 248, 248, 248, - - 861, 248, 248, 248, 860, 859, 248, 248, 858, 857, - 856, 248, 248, 250, 250, 250, 250, 855, 854, 250, - 250, 250, 254, 853, 852, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 262, 262, 262, 262, 851, 850, 262, 262, 262, 384, - 384, 849, 848, 847, 384, 384, 271, 846, 271, 843, - 842, 271, 271, 271, 271, 841, 840, 271, 271, 273, - 839, 273, 273, 273, 273, 273, 273, 273, 273, 273, - 273, 273, 273, 273, 273, 273, 273, 277, 277, 277, - 277, 838, 837, 277, 277, 277, 280, 280, 280, 280, - - 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - 280, 280, 280, 280, 283, 283, 283, 283, 283, 836, - 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 287, 835, 287, 834, 287, 287, 287, 287, - 287, 287, 287, 833, 287, 287, 287, 287, 287, 287, - 290, 832, 290, 290, 290, 831, 290, 290, 290, 830, - 829, 290, 290, 828, 827, 826, 290, 290, 295, 295, - 295, 295, 825, 824, 295, 295, 295, 300, 823, 300, - 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, - 300, 300, 300, 300, 300, 304, 304, 822, 304, 304, - - 821, 820, 819, 304, 304, 335, 818, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 338, 817, 816, 338, 338, 338, 338, - 338, 338, 338, 338, 338, 338, 338, 338, 338, 341, - 815, 341, 341, 341, 341, 341, 341, 341, 341, 341, - 341, 341, 341, 341, 341, 341, 341, 342, 814, 342, - 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, - 342, 342, 342, 342, 342, 450, 450, 450, 450, 450, - 450, 450, 450, 450, 450, 450, 450, 450, 450, 450, - 450, 450, 450, 459, 459, 459, 459, 810, 806, 459, - - 459, 459, 461, 461, 461, 461, 805, 804, 461, 461, - 461, 353, 353, 353, 353, 353, 353, 353, 353, 353, - 353, 353, 353, 353, 353, 353, 353, 353, 353, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 361, 803, 361, - 361, 361, 361, 361, 361, 361, 361, 361, 361, 802, - 361, 361, 361, 361, 361, 469, 469, 801, 800, 795, - 794, 469, 369, 369, 369, 369, 793, 792, 369, 369, - 369, 791, 369, 374, 790, 374, 374, 374, 374, 374, - 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, - - 374, 376, 789, 376, 376, 376, 376, 376, 376, 376, - 376, 376, 376, 376, 376, 376, 376, 376, 376, 377, - 786, 377, 377, 377, 377, 377, 377, 377, 377, 377, - 377, 377, 377, 377, 377, 377, 377, 250, 250, 250, - 250, 785, 784, 250, 250, 250, 548, 783, 548, 548, - 548, 548, 548, 548, 548, 548, 548, 548, 548, 548, - 548, 548, 548, 548, 695, 695, 695, 695, 695, 695, - 695, 695, 695, 695, 695, 695, 695, 695, 695, 695, - 695, 695, 811, 811, 811, 811, 811, 811, 811, 811, - 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, - - 782, 781, 780, 779, 778, 777, 776, 775, 774, 773, - 772, 771, 769, 768, 767, 766, 765, 764, 763, 762, - 761, 760, 759, 758, 757, 751, 750, 743, 742, 741, - 740, 739, 738, 737, 736, 735, 734, 733, 732, 731, - 730, 729, 728, 727, 726, 725, 724, 723, 722, 721, - 720, 717, 716, 715, 702, 701, 700, 629, 699, 698, - 624, 694, 693, 692, 691, 690, 689, 688, 687, 686, - 685, 684, 683, 682, 681, 680, 679, 678, 677, 676, - 675, 674, 673, 672, 671, 670, 669, 668, 667, 666, - 665, 664, 663, 662, 659, 658, 655, 654, 653, 652, - - 651, 638, 637, 636, 635, 632, 631, 627, 626, 625, - 624, 623, 622, 621, 620, 619, 618, 617, 616, 615, - 614, 613, 610, 609, 608, 607, 606, 605, 604, 603, - 602, 601, 600, 599, 598, 597, 596, 595, 594, 593, - 592, 591, 590, 589, 585, 584, 583, 582, 581, 580, - 579, 578, 577, 576, 575, 562, 561, 560, 559, 558, - 555, 551, 547, 546, 545, 541, 540, 539, 538, 537, - 536, 535, 534, 533, 532, 528, 527, 526, 525, 524, - 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, - 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, - - 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, - 491, 490, 489, 488, 476, 474, 473, 472, 471, 370, - 462, 460, 458, 457, 456, 344, 449, 336, 438, 437, - 434, 428, 425, 424, 423, 422, 421, 420, 417, 416, - 415, 414, 411, 410, 409, 406, 405, 402, 401, 301, - 298, 400, 399, 294, 396, 395, 260, 258, 260, 255, - 379, 378, 247, 243, 375, 373, 372, 371, 230, 370, - 360, 218, 356, 214, 351, 340, 197, 193, 339, 336, - 334, 333, 332, 331, 330, 329, 328, 324, 318, 317, - 316, 313, 312, 303, 302, 301, 299, 298, 297, 296, - - 276, 294, 293, 288, 286, 279, 278, 276, 272, 266, - 269, 266, 265, 263, 261, 258, 260, 256, 255, 253, - 252, 251, 249, 247, 243, 240, 238, 230, 220, 214, - 211, 197, 193, 972, 98, 98, 86, 78, 78, 41, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972 - - } ; - -static yyconst flex_int16_t yy_chk[3300] = - { 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, 1, 1, 1, 1, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, - 569, 3, 3, 5, 3, 5, 21, 3, 3, 3, - 6, 6, 3, 6, 27, 569, 27, 6, 3, 11, - 11, 392, 11, 3, 3, 12, 12, 17, 12, 17, - 21, 21, 50, 21, 18, 28, 18, 28, 17, 62, - 62, 17, 17, 17, 17, 18, 125, 392, 18, 18, - 18, 18, 949, 3, 3, 3, 4, 4, 173, 4, - 4, 22, 4, 4, 125, 4, 4, 4, 173, 19, - 4, 19, 19, 50, 273, 20, 4, 20, 20, 221, - - 221, 4, 4, 17, 4, 22, 22, 29, 22, 29, - 18, 113, 273, 30, 19, 30, 29, 581, 43, 43, - 20, 43, 30, 47, 47, 113, 47, 59, 59, 581, - 59, 4, 4, 4, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 13, 13, 13, 13, 13, 13, 13, - - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 23, 736, 23, 24, 37, 24, 145, 37, - 64, 64, 64, 64, 23, 145, 76, 24, 76, 736, - 37, 37, 37, 37, 225, 225, 23, 23, 23, 24, - 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 31, 951, 31, 31, 32, 38, 32, 32, 38, - 92, 92, 222, 92, 103, 103, 103, 103, 222, 222, - 38, 38, 38, 38, 172, 132, 31, 132, 172, 952, - 32, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 39, - 40, 39, 40, 55, 55, 953, 55, 63, 63, 167, - - 55, 65, 65, 68, 65, 134, 163, 134, 65, 164, - 109, 109, 112, 112, 163, 65, 119, 119, 135, 167, - 135, 65, 137, 175, 137, 162, 199, 162, 164, 65, - 210, 162, 210, 175, 954, 63, 175, 186, 186, 186, - 186, 223, 223, 39, 40, 39, 40, 51, 109, 55, - 112, 68, 192, 192, 119, 192, 308, 65, 196, 196, - 217, 196, 217, 257, 257, 390, 257, 199, 213, 213, - 51, 213, 51, 308, 51, 213, 280, 312, 280, 223, - 51, 312, 317, 51, 51, 51, 317, 51, 51, 51, - 390, 203, 203, 51, 203, 51, 204, 204, 291, 204, - - 205, 205, 282, 205, 282, 291, 203, 203, 203, 203, - 955, 204, 204, 204, 204, 205, 205, 205, 205, 206, - 206, 283, 206, 283, 213, 305, 229, 229, 285, 229, - 285, 361, 361, 229, 206, 206, 206, 206, 203, 305, - 229, 264, 264, 264, 264, 205, 229, 326, 329, 328, - 478, 329, 331, 328, 229, 367, 367, 326, 328, 331, - 353, 478, 353, 206, 337, 337, 337, 337, 355, 357, - 355, 357, 359, 362, 359, 370, 370, 370, 370, 362, - 362, 956, 229, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 266, 266, 266, 266, 385, 394, 266, 433, - 450, 957, 450, 266, 453, 433, 453, 266, 529, 844, - 266, 394, 266, 844, 529, 266, 294, 294, 385, 294, - 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, - 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, - 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, - - 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, - 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, - 294, 294, 294, 294, 294, 334, 334, 387, 334, 363, - 363, 334, 334, 388, 393, 479, 386, 334, 334, 343, - 343, 363, 343, 334, 334, 641, 346, 346, 334, 346, - 960, 387, 388, 480, 343, 343, 343, 343, 386, 961, - 393, 346, 346, 346, 346, 479, 641, 363, 364, 364, - 480, 364, 364, 364, 364, 364, 364, 364, 364, 364, - 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, - 364, 364, 364, 364, 364, 364, 460, 364, 364, 364, - - 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, - 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, - 364, 364, 364, 364, 364, 364, 364, 365, 365, 439, - 556, 556, 439, 439, 481, 557, 557, 365, 365, 366, - 366, 366, 366, 455, 455, 481, 455, 366, 964, 366, - 366, 460, 633, 633, 366, 366, 366, 366, 366, 366, - 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, - 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, - 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, - 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, - - 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, - 380, 380, 380, 380, 380, 380, 380, 380, 380, 383, - 383, 389, 383, 383, 383, 383, 383, 383, 383, 383, - 391, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 483, 573, 383, 383, 383, 383, 389, - 451, 451, 965, 451, 454, 454, 482, 454, 391, 573, - 966, 391, 483, 464, 464, 451, 451, 451, 451, 454, - 454, 454, 454, 464, 464, 383, 383, 383, 398, 398, - 563, 398, 398, 398, 398, 398, 398, 398, 398, 482, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - - 398, 398, 467, 467, 398, 398, 398, 398, 484, 485, - 487, 563, 467, 467, 486, 477, 543, 568, 543, 549, - 485, 544, 544, 567, 544, 550, 550, 968, 550, 487, - 969, 625, 484, 625, 398, 398, 398, 463, 463, 477, - 486, 477, 567, 568, 463, 463, 463, 463, 463, 463, - 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, - 463, 463, 463, 463, 463, 463, 463, 463, 463, 465, - 465, 465, 465, 501, 549, 565, 564, 465, 555, 555, - 555, 634, 634, 566, 465, 465, 465, 465, 465, 465, - 468, 468, 468, 468, 564, 501, 570, 946, 468, 565, - - 945, 501, 553, 553, 574, 468, 468, 468, 468, 468, - 468, 566, 553, 553, 554, 554, 554, 554, 586, 639, - 570, 574, 554, 571, 572, 632, 632, 632, 586, 554, - 554, 554, 554, 554, 554, 640, 571, 572, 628, 628, - 642, 628, 639, 643, 645, 644, 640, 646, 647, 648, - 650, 649, 695, 791, 695, 659, 697, 714, 697, 757, - 944, 757, 642, 644, 648, 659, 1015, 1015, 755, 650, - 791, 755, 645, 643, 943, 689, 689, 646, 647, 649, - 689, 755, 942, 689, 693, 693, 689, 714, 941, 693, - 747, 689, 693, 940, 747, 693, 811, 747, 811, 813, - - 936, 813, 935, 934, 933, 931, 929, 747, 973, 973, - 973, 973, 973, 973, 973, 973, 973, 973, 973, 973, - 973, 973, 973, 973, 973, 973, 974, 974, 974, 974, - 974, 974, 974, 974, 974, 974, 974, 974, 974, 974, - 974, 974, 974, 974, 975, 975, 975, 975, 975, 975, - 975, 975, 975, 975, 975, 975, 975, 975, 975, 975, - 975, 975, 976, 976, 976, 976, 976, 976, 976, 976, - 976, 976, 976, 976, 976, 976, 976, 976, 976, 976, - 977, 977, 977, 977, 977, 977, 977, 977, 977, 977, - 977, 977, 977, 977, 977, 977, 977, 977, 978, 978, - - 978, 978, 978, 978, 978, 978, 978, 978, 978, 978, - 978, 978, 978, 978, 978, 978, 979, 979, 979, 979, - 979, 979, 979, 979, 979, 979, 979, 979, 979, 979, - 979, 979, 979, 979, 980, 980, 980, 980, 980, 980, - 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, - 980, 980, 981, 981, 981, 981, 981, 981, 981, 981, - 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, - 982, 982, 982, 982, 982, 982, 982, 982, 982, 982, - 982, 982, 982, 982, 982, 982, 982, 982, 983, 983, - 983, 983, 983, 983, 983, 983, 983, 983, 983, 983, - - 983, 983, 983, 983, 983, 983, 984, 984, 984, 984, - 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, - 984, 984, 984, 984, 985, 985, 985, 985, 985, 985, - 985, 985, 985, 985, 985, 985, 985, 985, 985, 985, - 985, 985, 986, 986, 986, 986, 986, 986, 986, 986, - 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, - 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, - 987, 987, 987, 987, 987, 987, 987, 987, 988, 988, - 988, 988, 928, 927, 988, 988, 988, 989, 989, 989, - 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, - - 989, 989, 989, 989, 990, 990, 990, 990, 926, 924, - 990, 990, 990, 991, 923, 991, 991, 991, 991, 991, - 991, 991, 991, 991, 991, 991, 991, 991, 991, 991, - 991, 992, 922, 992, 992, 992, 992, 992, 992, 992, - 992, 992, 992, 992, 992, 992, 992, 992, 992, 993, - 993, 993, 921, 918, 993, 993, 993, 994, 915, 994, - 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, - 994, 994, 994, 994, 994, 995, 914, 995, 995, 995, - 995, 995, 995, 995, 995, 995, 995, 995, 995, 995, - 995, 995, 995, 996, 913, 996, 996, 996, 996, 996, - - 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, - 996, 997, 997, 997, 997, 997, 997, 997, 997, 997, - 997, 997, 997, 997, 997, 997, 997, 997, 997, 998, - 912, 998, 998, 998, 911, 998, 998, 998, 910, 909, - 998, 998, 907, 905, 902, 998, 998, 999, 999, 999, - 999, 901, 900, 999, 999, 999, 1000, 899, 898, 1000, - 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, - 1000, 1000, 1000, 1000, 1001, 1001, 1001, 1001, 897, 896, - 1001, 1001, 1001, 1002, 893, 1002, 1002, 1002, 1002, 1002, - 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, - - 1002, 1003, 892, 1003, 1003, 1003, 1003, 1003, 1003, 1003, - 1003, 1003, 1003, 891, 1003, 1003, 1003, 1003, 1003, 1004, - 887, 1004, 885, 884, 1004, 1004, 1004, 1004, 883, 882, - 1004, 1004, 1005, 881, 1005, 1005, 1005, 1005, 1005, 1005, - 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, - 1006, 1006, 1006, 1006, 880, 879, 1006, 1006, 1006, 1007, - 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, - 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1008, 1008, 1008, - 1008, 1008, 878, 1008, 1008, 1008, 1008, 1008, 1008, 1008, - 1008, 1008, 1008, 1008, 1008, 1009, 877, 1009, 876, 1009, - - 1009, 1009, 1009, 1009, 1009, 1009, 875, 1009, 1009, 1009, - 1009, 1009, 1009, 1010, 874, 1010, 1010, 1010, 1010, 1010, - 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, - 1010, 1011, 873, 1011, 1011, 1011, 871, 1011, 1011, 1011, - 870, 869, 1011, 1011, 868, 867, 866, 1011, 1011, 1012, - 1012, 1012, 1012, 865, 864, 1012, 1012, 1012, 1013, 863, - 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, - 1013, 1013, 1013, 1013, 1013, 1013, 1014, 1014, 860, 1014, - 1014, 859, 858, 857, 1014, 1014, 1016, 856, 1016, 1016, - 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, - - 1016, 1016, 1016, 1016, 1017, 854, 852, 1017, 1017, 1017, - 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, - 1018, 851, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, - 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1019, 850, - 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, - 1019, 1019, 1019, 1019, 1019, 1019, 1020, 1020, 849, 848, - 1020, 1020, 1020, 1021, 1021, 847, 846, 1021, 1021, 1021, - 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, - 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1023, 1023, - 1023, 1023, 845, 843, 1023, 1023, 1023, 1024, 1024, 1024, - - 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, - 1024, 1024, 1024, 1024, 1024, 1025, 842, 1025, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 841, 1025, 1025, - 1025, 1025, 1025, 1026, 840, 1026, 1026, 1026, 1026, 1026, - 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, - 1026, 1027, 1027, 838, 837, 836, 835, 1027, 1028, 1028, - 1028, 1028, 834, 833, 1028, 1028, 1028, 832, 1028, 1029, - 831, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1030, 830, 1030, - 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, - - 1030, 1030, 1030, 1030, 1030, 1031, 829, 1031, 1031, 1031, - 1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031, - 1031, 1031, 1031, 1032, 828, 1032, 1032, 1032, 1032, 1032, - 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, - 1032, 1033, 827, 1033, 1033, 1033, 1033, 1033, 1033, 1033, - 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1034, - 826, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, - 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1035, 1035, 1035, - 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, - 1035, 1035, 1035, 1035, 1035, 1036, 825, 1036, 1036, 1036, - - 810, 1036, 1036, 1036, 809, 808, 1036, 1036, 807, 805, - 804, 1036, 1036, 1037, 1037, 1037, 1037, 803, 801, 1037, - 1037, 1037, 1038, 800, 799, 1038, 1038, 1038, 1038, 1038, - 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - 1039, 1039, 1039, 1039, 798, 797, 1039, 1039, 1039, 1040, - 1040, 796, 794, 793, 1040, 1040, 1041, 792, 1041, 790, - 789, 1041, 1041, 1041, 1041, 788, 787, 1041, 1041, 1042, - 786, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, - 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1043, 1043, 1043, - 1043, 785, 784, 1043, 1043, 1043, 1044, 1044, 1044, 1044, - - 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, - 1044, 1044, 1044, 1044, 1045, 1045, 1045, 1045, 1045, 783, - 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, - 1045, 1045, 1046, 781, 1046, 780, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 779, 1046, 1046, 1046, 1046, 1046, 1046, - 1047, 777, 1047, 1047, 1047, 776, 1047, 1047, 1047, 775, - 774, 1047, 1047, 773, 772, 771, 1047, 1047, 1048, 1048, - 1048, 1048, 770, 769, 1048, 1048, 1048, 1049, 768, 1049, - 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, - 1049, 1049, 1049, 1049, 1049, 1050, 1050, 767, 1050, 1050, - - 766, 765, 764, 1050, 1050, 1051, 763, 1051, 1051, 1051, - 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - 1051, 1051, 1051, 1052, 762, 761, 1052, 1052, 1052, 1052, - 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1053, - 760, 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, - 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1054, 759, 1054, - 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, - 1054, 1054, 1054, 1054, 1054, 1055, 1055, 1055, 1055, 1055, - 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, - 1055, 1055, 1055, 1056, 1056, 1056, 1056, 756, 754, 1056, - - 1056, 1056, 1057, 1057, 1057, 1057, 753, 752, 1057, 1057, - 1057, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, - 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1059, - 1059, 1059, 1059, 1059, 1059, 1059, 1059, 1059, 1059, 1059, - 1059, 1059, 1059, 1059, 1059, 1059, 1059, 1060, 751, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 750, - 1060, 1060, 1060, 1060, 1060, 1061, 1061, 749, 748, 746, - 745, 1061, 1062, 1062, 1062, 1062, 744, 741, 1062, 1062, - 1062, 740, 1062, 1063, 739, 1063, 1063, 1063, 1063, 1063, - 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, - - 1063, 1064, 738, 1064, 1064, 1064, 1064, 1064, 1064, 1064, - 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1065, - 734, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, - 1065, 1065, 1065, 1065, 1065, 1065, 1065, 1066, 1066, 1066, - 1066, 733, 731, 1066, 1066, 1066, 1067, 729, 1067, 1067, - 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, - 1067, 1067, 1067, 1067, 1068, 1068, 1068, 1068, 1068, 1068, - 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, - 1068, 1068, 1069, 1069, 1069, 1069, 1069, 1069, 1069, 1069, - 1069, 1069, 1069, 1069, 1069, 1069, 1069, 1069, 1069, 1069, - - 728, 727, 726, 725, 723, 721, 720, 719, 718, 717, - 716, 715, 713, 712, 711, 710, 709, 708, 707, 706, - 705, 704, 703, 701, 699, 692, 690, 687, 686, 685, - 684, 683, 682, 681, 679, 677, 675, 673, 672, 671, - 670, 669, 668, 667, 666, 665, 664, 663, 662, 661, - 660, 657, 656, 655, 636, 635, 631, 630, 627, 626, - 624, 623, 622, 621, 620, 619, 618, 617, 616, 615, - 614, 613, 612, 611, 610, 608, 607, 606, 605, 603, - 602, 601, 600, 599, 598, 597, 596, 595, 594, 593, - 591, 590, 588, 587, 585, 583, 580, 578, 577, 576, - - 575, 561, 560, 559, 558, 552, 551, 547, 546, 545, - 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, - 531, 530, 527, 526, 525, 524, 523, 522, 521, 520, - 519, 517, 516, 515, 514, 513, 512, 511, 509, 508, - 507, 506, 503, 502, 500, 499, 498, 497, 496, 495, - 494, 491, 490, 489, 488, 476, 474, 473, 472, 471, - 466, 462, 458, 457, 456, 449, 448, 447, 446, 445, - 444, 443, 442, 441, 440, 438, 437, 436, 435, 434, - 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, - 422, 421, 420, 419, 418, 417, 416, 415, 413, 412, - - 411, 409, 408, 407, 406, 405, 404, 403, 402, 401, - 400, 399, 396, 395, 384, 379, 378, 375, 373, 369, - 360, 351, 349, 348, 347, 345, 340, 335, 333, 332, - 330, 327, 325, 324, 322, 320, 319, 318, 316, 315, - 314, 313, 311, 310, 309, 307, 306, 303, 302, 300, - 298, 297, 296, 292, 279, 278, 260, 259, 258, 255, - 252, 251, 246, 243, 238, 234, 233, 232, 231, 228, - 220, 219, 216, 215, 208, 200, 198, 194, 189, 185, - 182, 181, 180, 179, 178, 177, 176, 174, 171, 170, - 169, 166, 165, 160, 159, 158, 157, 155, 153, 152, - - 150, 148, 147, 141, 138, 129, 128, 126, 123, 118, - 116, 111, 107, 101, 96, 94, 93, 90, 88, 86, - 85, 84, 81, 77, 75, 73, 69, 67, 61, 57, - 52, 49, 45, 41, 16, 15, 10, 8, 7, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972, 972, - 972, 972, 972, 972, 972, 972, 972, 972, 972 - - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* 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 -#ifndef YY_REENTRANT -char *yytext; -#endif -#line 1 "scan.l" -#define INITIAL 0 -/* scan.l - scanner for flex input -*-C-*- */ -#line 4 "scan.l" -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -#include "flexdef.h" -#include "parse.h" -extern bool tablesverify, tablesext; -extern int trlcontxt; /* Set in parse.y for each rule. */ - -#define ACTION_ECHO add_action( yytext ) -#define ACTION_IFDEF(def, should_define) \ - { \ - if ( should_define ) \ - action_define( def, 1 ); \ - } - -#define ACTION_M4_IFDEF(def, should_define) \ - do{ \ - if ( should_define ) \ - buf_m4_define( &m4defs_buf, def, NULL);\ - else \ - buf_m4_undefine( &m4defs_buf, def);\ - } while(0) - -#define MARK_END_OF_PROLOG mark_prolog(); - -#define YY_DECL \ - int flexscan() - -#define RETURNCHAR \ - yylval = (unsigned char) yytext[0]; \ - return CHAR; - -#define RETURNNAME \ - if(yyleng < MAXLINE) \ - { \ - strcpy( nmstr, yytext ); \ - } \ - else \ - { \ - synerr(_("Input line too long\n")); \ - FLEX_EXIT(EXIT_FAILURE); \ - } \ - return NAME; - -#define PUT_BACK_STRING(str, start) \ - for ( i = strlen( str ) - 1; i >= start; --i ) \ - unput((str)[i]) - -#define CHECK_REJECT(str) \ - if ( all_upper( str ) ) \ - reject = true; - -#define CHECK_YYMORE(str) \ - if ( all_lower( str ) ) \ - yymore_used = true; - -#define YY_USER_INIT \ - if ( getenv("POSIXLY_CORRECT") ) \ - posix_compat = true; - -#define YY_STACK_USED 1 -#define YY_NO_TOP_STATE 1 -#define SECT2 1 -#define SECT2PROLOG 2 -#define SECT3 3 -#define CODEBLOCK 4 -#define PICKUPDEF 5 -#define SC 6 -#define CARETISBOL 7 -#define NUM 8 -#define QUOTE 9 - -#define FIRSTCCL 10 -#define CCL 11 -#define ACTION 12 -#define RECOVER 13 -#define COMMENT 14 -#define ACTION_STRING 15 -#define PERCENT_BRACE_ACTION 16 - -#define OPTION 17 -#define LINEDIR 18 -#define CODEBLOCK_MATCH_BRACE 19 - -#line 1745 "scan.c" -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ - -/* 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. - */ -#ifndef YY_NO_UNISTD_H - -#include - - - -#endif /* !YY_NO_UNISTD_H */ - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - - -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -#ifndef YY_NO_DESTROY -int yylex_destroy YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#endif - -#ifndef YY_NO_GET_DEBUG -int yyget_debug YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#endif - -#ifndef YY_NO_SET_DEBUG -void yyset_debug YY_PARAMS(( int debug_flag YY_PROTO_LAST_ARG )); -#endif - -#ifndef YY_NO_GET_EXTRA -YY_EXTRA_TYPE yyget_extra YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#endif - -#ifndef YY_NO_SET_EXTRA -void yyset_extra YY_PARAMS(( YY_EXTRA_TYPE user_defined YY_PROTO_LAST_ARG )); -#endif - -#ifndef YY_NO_GET_IN -FILE *yyget_in YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#endif - -#ifndef YY_NO_SET_IN -void yyset_in YY_PARAMS(( FILE * in_str YY_PROTO_LAST_ARG )); -#endif - -#ifndef YY_NO_GET_OUT -FILE *yyget_out YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#endif - -#ifndef YY_NO_SET_OUT -void yyset_out YY_PARAMS(( FILE * out_str YY_PROTO_LAST_ARG )); -#endif - -#ifndef YY_NO_GET_LENG -int yyget_leng YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#endif - -#ifndef YY_NO_GET_TEXT -char *yyget_text YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#endif - -#ifndef YY_NO_GET_LINENO -int yyget_lineno YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#endif - -#ifndef YY_NO_SET_LINENO -void yyset_lineno YY_PARAMS(( int line_number YY_PROTO_LAST_ARG )); -#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 YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#else -extern int yywrap YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#endif -#endif - -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -#ifndef YY_NO_UNPUT -static void yyunput YY_PARAMS(( int c, char *buf_ptr YY_PROTO_LAST_ARG)); -#endif -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ - - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PARAMS(( char *, yyconst char *, int YY_PROTO_LAST_ARG)); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PARAMS(( yyconst char * YY_PROTO_LAST_ARG)); -#endif - -#ifndef YY_NO_INPUT - -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -#ifdef __cplusplus -static int yyinput YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#else -static int input YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#endif -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ - -#endif - - - -#if YY_STACK_USED -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ - -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PARAMS(( int new_state YY_PROTO_LAST_ARG)); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PARAMS(( YY_PROTO_ONLY_ARG )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#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 - -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) - -#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) \ - if ( YY_G(yy_current_buffer)->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t 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); \ - } \ - }\ -\ -\ - -#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 - -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg YY_CALL_LAST_ARG) - -#endif - -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -/* end tables serialization structures and prototypes */ - -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL - - -/* If the bison pure parser is used, then bison will provide - one or two additional arguments. */ - - -# define YY_LEX_PROTO YY_PARAMS((YY_PROTO_ONLY_ARG)) -# define YY_LEX_DECLARATION YYFARGS0(void) - - -extern int yylex YY_LEX_PROTO; - -#define YY_DECL int yylex YY_LEX_DECLARATION - -#endif - - -/* 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 - -#define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - YY_G(yy_current_buffer)->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ - YY_USER_ACTION - -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 120 "scan.l" -#define YY_TABLES_VERIFY 0 - - static int bracelevel, didadef, indented_code; - static int doing_rule_action = false; - static int option_sense; - - int doing_codeblock = false; - int i, brace_depth=0, brace_start_line=0; - Char nmdef[MAXLINE]; - - -#line 2031 "scan.c" - - - if ( YY_G(yy_init) ) - { - YY_G(yy_init) = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - -#ifdef YY_USES_REJECT - if ( ! YY_G(yy_state_buf) ) - YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_BUF_SIZE + 2 YY_CALL_LAST_ARG); -#endif - - if ( ! YY_G(yy_start) ) - YY_G(yy_start) = 1; /* first start state */ - - if ( ! yyin ) - - yyin = stdin; - - - if ( ! yyout ) - - yyout = stdout; - - - if ( ! YY_G(yy_current_buffer) ) - YY_G(yy_current_buffer) = - yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG); - - yy_load_buffer_state( YY_CALL_ONLY_ARG ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = YY_G(yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = YY_G(yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = YY_G(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_G(yy_last_accepting_state) = yy_current_state; - YY_G(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 >= 973 ) - 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_base[yy_current_state] != 3240 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = YY_G(yy_last_accepting_cpos); - yy_current_state = YY_G(yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -#ifdef YY_USE_LINENO - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) - { - int yyl; - for ( yyl = 0; yyl < yyleng; ++yyl ) - if ( yytext[yyl] == '\n' ) - ++yylineno; - } -#endif - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = YY_G(yy_hold_char); - yy_cp = YY_G(yy_last_accepting_cpos); - yy_current_state = YY_G(yy_last_accepting_state); - goto yy_find_action; - - -case 1: -YY_RULE_SETUP -#line 131 "scan.l" -indented_code = true; BEGIN(CODEBLOCK); - YY_BREAK -case 2: -YY_RULE_SETUP -#line 132 "scan.l" -ACTION_ECHO; yy_push_state( COMMENT ); - YY_BREAK -case 3: -YY_RULE_SETUP -#line 133 "scan.l" -yy_push_state( LINEDIR ); - YY_BREAK -case 4: -YY_RULE_SETUP -#line 134 "scan.l" -return SCDECL; - YY_BREAK -case 5: -YY_RULE_SETUP -#line 135 "scan.l" -return XSCDECL; - YY_BREAK -case 6: -/* rule 6 can match eol */ -YY_RULE_SETUP -#line 136 "scan.l" -{ - ++linenum; - line_directive_out( (FILE *) 0, 1 ); - indented_code = false; - BEGIN(CODEBLOCK); - } - YY_BREAK -case 7: -/* rule 7 can match eol */ -YY_RULE_SETUP -#line 142 "scan.l" -{ - brace_start_line = linenum; - ++linenum; - buf_linedir( &top_buf, infilename?infilename:"", linenum); - brace_depth = 1; - yy_push_state(CODEBLOCK_MATCH_BRACE); - } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 150 "scan.l" -synerr( _("malformed '%top' directive") ); - YY_BREAK -case 9: -YY_RULE_SETUP -#line 152 "scan.l" -/* discard */ - YY_BREAK -case 10: -YY_RULE_SETUP -#line 154 "scan.l" -{ - sectnum = 2; - bracelevel = 0; - mark_defs1(); - line_directive_out( (FILE *) 0, 1 ); - BEGIN(SECT2PROLOG); - return SECTEND; - } - YY_BREAK -case 11: -/* rule 11 can match eol */ -YY_RULE_SETUP -#line 163 "scan.l" -yytext_is_array = false; ++linenum; - YY_BREAK -case 12: -/* rule 12 can match eol */ -YY_RULE_SETUP -#line 164 "scan.l" -yytext_is_array = true; ++linenum; - YY_BREAK -case 13: -YY_RULE_SETUP -#line 166 "scan.l" -BEGIN(OPTION); return OPTION_OP; - YY_BREAK -case 14: -/* rule 14 can match eol */ -YY_RULE_SETUP -#line 168 "scan.l" -++linenum; /* ignore */ - YY_BREAK -case 15: -/* rule 15 can match eol */ -YY_RULE_SETUP -#line 169 "scan.l" -++linenum; /* ignore */ - YY_BREAK -/* xgettext: no-c-format */ -case 16: -/* rule 16 can match eol */ -YY_RULE_SETUP -#line 172 "scan.l" -synerr( _( "unrecognized '%' directive" ) ); - YY_BREAK -case 17: -YY_RULE_SETUP -#line 174 "scan.l" -{ - if(yyleng < MAXLINE) - { - strcpy( nmstr, yytext ); - } - else - { - synerr( _("Input line too long\n")); - FLEX_EXIT(EXIT_FAILURE); - } - - didadef = false; - BEGIN(PICKUPDEF); - } - YY_BREAK -case 18: -YY_RULE_SETUP -#line 189 "scan.l" -RETURNNAME; - YY_BREAK -case 19: -/* rule 19 can match eol */ -YY_RULE_SETUP -#line 190 "scan.l" -++linenum; /* allows blank lines in section 1 */ - YY_BREAK -case 20: -/* rule 20 can match eol */ -YY_RULE_SETUP -#line 191 "scan.l" -ACTION_ECHO; ++linenum; /* maybe end of comment line */ - YY_BREAK - - -case 21: -YY_RULE_SETUP -#line 196 "scan.l" -ACTION_ECHO; yy_pop_state(); - YY_BREAK -case 22: -YY_RULE_SETUP -#line 197 "scan.l" -ACTION_ECHO; - YY_BREAK -case 23: -YY_RULE_SETUP -#line 198 "scan.l" -ACTION_ECHO; - YY_BREAK -case 24: -/* rule 24 can match eol */ -YY_RULE_SETUP -#line 199 "scan.l" -++linenum; ACTION_ECHO; - YY_BREAK - - -case 25: -/* rule 25 can match eol */ -YY_RULE_SETUP -#line 203 "scan.l" -yy_pop_state(); - YY_BREAK -case 26: -YY_RULE_SETUP -#line 204 "scan.l" -linenum = myctoi( yytext ); - YY_BREAK -case 27: -YY_RULE_SETUP -#line 206 "scan.l" -{ - flex_free( (void *) infilename ); - infilename = copy_string( yytext + 1 ); - infilename[strlen( infilename ) - 1] = '\0'; - } - YY_BREAK -case 28: -YY_RULE_SETUP -#line 211 "scan.l" -/* ignore spurious characters */ - YY_BREAK - - -case 29: -/* rule 29 can match eol */ -YY_RULE_SETUP -#line 215 "scan.l" -++linenum; BEGIN(INITIAL); - YY_BREAK -case 30: -YY_RULE_SETUP -#line 217 "scan.l" -ACTION_ECHO; - YY_BREAK -case 31: -/* rule 31 can match eol */ -YY_RULE_SETUP -#line 219 "scan.l" -{ - ++linenum; - ACTION_ECHO; - if ( indented_code ) - BEGIN(INITIAL); - } - YY_BREAK - - -case 32: -YY_RULE_SETUP -#line 228 "scan.l" -{ - if( --brace_depth == 0){ - /* TODO: Matched. */ - yy_pop_state(); - }else - buf_strnappend(&top_buf, yytext, yyleng); - } - YY_BREAK -case 33: -YY_RULE_SETUP -#line 236 "scan.l" -{ - brace_depth++; - buf_strnappend(&top_buf, yytext, yyleng); - } - YY_BREAK -case 34: -/* rule 34 can match eol */ -YY_RULE_SETUP -#line 241 "scan.l" -{ - ++linenum; - buf_strnappend(&top_buf, yytext, yyleng); - } - YY_BREAK -case 35: -YY_RULE_SETUP -#line 246 "scan.l" -{ - buf_strnappend(&top_buf, yytext, yyleng); - } - YY_BREAK -case YY_STATE_EOF(CODEBLOCK_MATCH_BRACE): -#line 250 "scan.l" -{ - linenum = brace_start_line; - synerr(_("Unmatched '{'")); - yyterminate(); - } - YY_BREAK - - -case 36: -YY_RULE_SETUP -#line 259 "scan.l" -/* separates name and definition */ - YY_BREAK -case 37: -YY_RULE_SETUP -#line 261 "scan.l" -{ - if(yyleng < MAXLINE) - { - strcpy( (char *) nmdef, yytext ); - } - else - { - synerr( _("Input line too long\n")); - FLEX_EXIT(EXIT_FAILURE); - } - /* Skip trailing whitespace. */ - for ( i = strlen( (char *) nmdef ) - 1; - i >= 0 && (nmdef[i] == ' ' || nmdef[i] == '\t'); - --i ) - ; - - nmdef[i + 1] = '\0'; - - ndinstal( nmstr, nmdef ); - didadef = true; - } - YY_BREAK -case 38: -/* rule 38 can match eol */ -YY_RULE_SETUP -#line 283 "scan.l" -{ - if ( ! didadef ) - synerr( _( "incomplete name definition" ) ); - BEGIN(INITIAL); - ++linenum; - } - YY_BREAK - - -case 39: -/* rule 39 can match eol */ -YY_RULE_SETUP -#line 293 "scan.l" -++linenum; BEGIN(INITIAL); - YY_BREAK -case 40: -YY_RULE_SETUP -#line 294 "scan.l" -option_sense = true; - YY_BREAK -case 41: -YY_RULE_SETUP -#line 296 "scan.l" -return '='; - YY_BREAK -case 42: -YY_RULE_SETUP -#line 298 "scan.l" -option_sense = ! option_sense; - YY_BREAK -case 43: -YY_RULE_SETUP -#line 300 "scan.l" -csize = option_sense ? 128 : 256; - YY_BREAK -case 44: -YY_RULE_SETUP -#line 301 "scan.l" -csize = option_sense ? 256 : 128; - YY_BREAK -case 45: -YY_RULE_SETUP -#line 303 "scan.l" -long_align = option_sense; - YY_BREAK -case 46: -YY_RULE_SETUP -#line 304 "scan.l" -{ - ACTION_M4_IFDEF( "M4""_YY_ALWAYS_INTERACTIVE", option_sense ); - interactive = option_sense; - } - YY_BREAK -case 47: -YY_RULE_SETUP -#line 308 "scan.l" -yytext_is_array = option_sense; - YY_BREAK -case 48: -YY_RULE_SETUP -#line 309 "scan.l" -ansi_func_defs = option_sense; - YY_BREAK -case 49: -YY_RULE_SETUP -#line 310 "scan.l" -ansi_func_protos = option_sense; - YY_BREAK -case 50: -YY_RULE_SETUP -#line 311 "scan.l" -backing_up_report = option_sense; - YY_BREAK -case 51: -YY_RULE_SETUP -#line 312 "scan.l" -interactive = ! option_sense; - YY_BREAK -case 52: -YY_RULE_SETUP -#line 313 "scan.l" -bison_bridge_lval = option_sense; - YY_BREAK -case 53: -YY_RULE_SETUP -#line 314 "scan.l" -{ if((bison_bridge_lloc = option_sense)) - bison_bridge_lval = true; - } - YY_BREAK -case 54: -YY_RULE_SETUP -#line 317 "scan.l" -C_plus_plus = option_sense; - YY_BREAK -case 55: -YY_RULE_SETUP -#line 318 "scan.l" -caseins = ! option_sense; - YY_BREAK -case 56: -YY_RULE_SETUP -#line 319 "scan.l" -caseins = option_sense; - YY_BREAK -case 57: -YY_RULE_SETUP -#line 320 "scan.l" -ddebug = option_sense; - YY_BREAK -case 58: -YY_RULE_SETUP -#line 321 "scan.l" -spprdflt = ! option_sense; - YY_BREAK -case 59: -YY_RULE_SETUP -#line 322 "scan.l" -useecs = option_sense; - YY_BREAK -case 60: -YY_RULE_SETUP -#line 323 "scan.l" -{ - useecs = usemecs = false; - use_read = fullspd = true; - } - YY_BREAK -case 61: -YY_RULE_SETUP -#line 327 "scan.l" -{ - useecs = usemecs = false; - use_read = fulltbl = true; - } - YY_BREAK -case 62: -YY_RULE_SETUP -#line 331 "scan.l" -ACTION_IFDEF("YY_NO_INPUT", ! option_sense); - YY_BREAK -case 63: -YY_RULE_SETUP -#line 332 "scan.l" -interactive = option_sense; - YY_BREAK -case 64: -YY_RULE_SETUP -#line 333 "scan.l" -lex_compat = option_sense; - YY_BREAK -case 65: -YY_RULE_SETUP -#line 334 "scan.l" -posix_compat = option_sense; - YY_BREAK -case 66: -YY_RULE_SETUP -#line 335 "scan.l" -{ - ACTION_M4_IFDEF( "M4""_YY_MAIN", option_sense); - /* Override yywrap */ - if( option_sense == true ) - do_yywrap = false; - } - YY_BREAK -case 67: -YY_RULE_SETUP -#line 341 "scan.l" -usemecs = option_sense; - YY_BREAK -case 68: -YY_RULE_SETUP -#line 342 "scan.l" -{ - ACTION_M4_IFDEF( "M4""_YY_NEVER_INTERACTIVE", option_sense ); - interactive = !option_sense; - } - YY_BREAK -case 69: -YY_RULE_SETUP -#line 346 "scan.l" -performance_report += option_sense ? 1 : -1; - YY_BREAK -case 70: -YY_RULE_SETUP -#line 347 "scan.l" -yytext_is_array = ! option_sense; - YY_BREAK -case 71: -YY_RULE_SETUP -#line 348 "scan.l" -use_read = option_sense; - YY_BREAK -case 72: -YY_RULE_SETUP -#line 349 "scan.l" -reentrant = option_sense; - YY_BREAK -case 73: -YY_RULE_SETUP -#line 350 "scan.l" -reject_really_used = option_sense; - YY_BREAK -case 74: -YY_RULE_SETUP -#line 351 "scan.l" -ACTION_M4_IFDEF( "M4""_YY_STACK_USED", option_sense ); - YY_BREAK -case 75: -YY_RULE_SETUP -#line 352 "scan.l" -do_stdinit = option_sense; - YY_BREAK -case 76: -YY_RULE_SETUP -#line 353 "scan.l" -use_stdout = option_sense; - YY_BREAK -case 77: -YY_RULE_SETUP -#line 354 "scan.l" -ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense); - YY_BREAK -case 78: -YY_RULE_SETUP -#line 355 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_UNPUT", ! option_sense); - YY_BREAK -case 79: -YY_RULE_SETUP -#line 356 "scan.l" -printstats = option_sense; - YY_BREAK -case 80: -YY_RULE_SETUP -#line 357 "scan.l" -nowarn = ! option_sense; - YY_BREAK -case 81: -YY_RULE_SETUP -#line 358 "scan.l" -do_yylineno = option_sense; ACTION_M4_IFDEF("M4""_YY_USE_LINENO", option_sense); - YY_BREAK -case 82: -YY_RULE_SETUP -#line 359 "scan.l" -yymore_really_used = option_sense; - YY_BREAK -case 83: -YY_RULE_SETUP -#line 360 "scan.l" -do_yywrap = option_sense; - YY_BREAK -case 84: -YY_RULE_SETUP -#line 362 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_PUSH_STATE", ! option_sense); - YY_BREAK -case 85: -YY_RULE_SETUP -#line 363 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_POP_STATE", ! option_sense); - YY_BREAK -case 86: -YY_RULE_SETUP -#line 364 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_TOP_STATE", ! option_sense); - YY_BREAK -case 87: -YY_RULE_SETUP -#line 366 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BUFFER", ! option_sense); - YY_BREAK -case 88: -YY_RULE_SETUP -#line 367 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BYTES", ! option_sense); - YY_BREAK -case 89: -YY_RULE_SETUP -#line 368 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_SCAN_STRING", ! option_sense); - YY_BREAK -case 90: -YY_RULE_SETUP -#line 370 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_FLEX_ALLOC", ! option_sense); - YY_BREAK -case 91: -YY_RULE_SETUP -#line 371 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_FLEX_REALLOC", ! option_sense); - YY_BREAK -case 92: -YY_RULE_SETUP -#line 372 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_FLEX_FREE", ! option_sense); - YY_BREAK -case 93: -YY_RULE_SETUP -#line 374 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_GET_DEBUG", ! option_sense); - YY_BREAK -case 94: -YY_RULE_SETUP -#line 375 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_SET_DEBUG", ! option_sense); - YY_BREAK -case 95: -YY_RULE_SETUP -#line 376 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_GET_EXTRA", ! option_sense); - YY_BREAK -case 96: -YY_RULE_SETUP -#line 377 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_SET_EXTRA", ! option_sense); - YY_BREAK -case 97: -YY_RULE_SETUP -#line 378 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_GET_LENG", ! option_sense); - YY_BREAK -case 98: -YY_RULE_SETUP -#line 379 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_GET_TEXT", ! option_sense); - YY_BREAK -case 99: -YY_RULE_SETUP -#line 380 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_GET_LINENO", ! option_sense); - YY_BREAK -case 100: -YY_RULE_SETUP -#line 381 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_SET_LINENO", ! option_sense); - YY_BREAK -case 101: -YY_RULE_SETUP -#line 382 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_GET_IN", ! option_sense); - YY_BREAK -case 102: -YY_RULE_SETUP -#line 383 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_SET_IN", ! option_sense); - YY_BREAK -case 103: -YY_RULE_SETUP -#line 384 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_GET_OUT", ! option_sense); - YY_BREAK -case 104: -YY_RULE_SETUP -#line 385 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_SET_OUT", ! option_sense); - YY_BREAK -case 105: -YY_RULE_SETUP -#line 386 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_GET_LVAL", ! option_sense); - YY_BREAK -case 106: -YY_RULE_SETUP -#line 387 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_SET_LVAL", ! option_sense); - YY_BREAK -case 107: -YY_RULE_SETUP -#line 388 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_GET_LLOC", ! option_sense); - YY_BREAK -case 108: -YY_RULE_SETUP -#line 389 "scan.l" -ACTION_M4_IFDEF("M4""_YY_NO_SET_LLOC", ! option_sense); - YY_BREAK -case 109: -YY_RULE_SETUP -#line 391 "scan.l" -return OPT_OUTFILE; - YY_BREAK -case 110: -YY_RULE_SETUP -#line 392 "scan.l" -return OPT_PREFIX; - YY_BREAK -case 111: -YY_RULE_SETUP -#line 393 "scan.l" -return OPT_YYCLASS; - YY_BREAK -case 112: -YY_RULE_SETUP -#line 394 "scan.l" -return OPT_HEADER; - YY_BREAK -case 113: -YY_RULE_SETUP -#line 395 "scan.l" -return OPT_TABLES; - YY_BREAK -case 114: -YY_RULE_SETUP -#line 396 "scan.l" -{ - tablesverify = option_sense; - if(!tablesext && option_sense) - tablesext = true; - } - YY_BREAK -case 115: -YY_RULE_SETUP -#line 403 "scan.l" -{ - if(yyleng-1 < MAXLINE) - { - strcpy( nmstr, yytext + 1 ); - } - else - { - synerr( _("Input line too long\n")); - FLEX_EXIT(EXIT_FAILURE); - } - nmstr[strlen( nmstr ) - 1] = '\0'; - return NAME; - } - YY_BREAK -case 116: -YY_RULE_SETUP -#line 417 "scan.l" -{ - format_synerr( _( "unrecognized %%option: %s" ), - yytext ); - BEGIN(RECOVER); - } - YY_BREAK - -case 117: -/* rule 117 can match eol */ -YY_RULE_SETUP -#line 424 "scan.l" -++linenum; BEGIN(INITIAL); - YY_BREAK - -case 118: -YY_RULE_SETUP -#line 428 "scan.l" -++bracelevel; yyless( 2 ); /* eat only %{ */ - YY_BREAK -case 119: -YY_RULE_SETUP -#line 429 "scan.l" ---bracelevel; yyless( 2 ); /* eat only %} */ - YY_BREAK -case 120: -YY_RULE_SETUP -#line 431 "scan.l" -ACTION_ECHO; /* indented code in prolog */ - YY_BREAK -case 121: -YY_RULE_SETUP -#line 433 "scan.l" -{ /* non-indented code */ - if ( bracelevel <= 0 ) - { /* not in %{ ... %} */ - yyless( 0 ); /* put it all back */ - yy_set_bol( 1 ); - mark_prolog(); - BEGIN(SECT2); - } - else - ACTION_ECHO; - } - YY_BREAK -case 122: -YY_RULE_SETUP -#line 445 "scan.l" -ACTION_ECHO; - YY_BREAK -case 123: -/* rule 123 can match eol */ -YY_RULE_SETUP -#line 446 "scan.l" -++linenum; ACTION_ECHO; - YY_BREAK -case YY_STATE_EOF(SECT2PROLOG): -#line 448 "scan.l" -{ - mark_prolog(); - sectnum = 0; - yyterminate(); /* to stop the parser */ - } - YY_BREAK - - -case 124: -/* rule 124 can match eol */ -YY_RULE_SETUP -#line 456 "scan.l" -++linenum; /* allow blank lines in section 2 */ - YY_BREAK -case 125: -YY_RULE_SETUP -#line 458 "scan.l" -{ - indented_code = false; - doing_codeblock = true; - bracelevel = 1; - BEGIN(PERCENT_BRACE_ACTION); - } - YY_BREAK -case 126: -YY_RULE_SETUP -#line 465 "scan.l" -BEGIN(SC); return '<'; - YY_BREAK -case 127: -YY_RULE_SETUP -#line 466 "scan.l" -return '^'; - YY_BREAK -case 128: -YY_RULE_SETUP -#line 467 "scan.l" -BEGIN(QUOTE); return '"'; - YY_BREAK -case 129: -*yy_cp = YY_G(yy_hold_char); /* undo effects of setting up yytext */ -YY_G(yy_c_buf_p) = yy_cp = yy_bp + 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 468 "scan.l" -{ - BEGIN(NUM); - if ( lex_compat || posix_compat ) - return BEGIN_REPEAT_POSIX; - else - return BEGIN_REPEAT_FLEX; - } - YY_BREAK -case 130: -/* rule 130 can match eol */ -*yy_cp = YY_G(yy_hold_char); /* undo effects of setting up yytext */ -YY_G(yy_c_buf_p) = yy_cp = yy_bp + 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 475 "scan.l" -return '$'; - YY_BREAK -case 131: -YY_RULE_SETUP -#line 477 "scan.l" -{ - bracelevel = 1; - BEGIN(PERCENT_BRACE_ACTION); - - if ( in_rule ) - { - doing_rule_action = true; - in_rule = false; - return '\n'; - } - } - YY_BREAK -case 132: -/* rule 132 can match eol */ -YY_RULE_SETUP -#line 488 "scan.l" -continued_action = true; ++linenum; return '\n'; - YY_BREAK -case 133: -YY_RULE_SETUP -#line 490 "scan.l" -{ - yyless( yyleng - 2 ); /* put back '/', '*' */ - bracelevel = 0; - continued_action = false; - BEGIN(ACTION); - } - YY_BREAK -case 134: -YY_RULE_SETUP -#line 497 "scan.l" -/* allow indented rules */ - YY_BREAK -case 135: -YY_RULE_SETUP -#line 499 "scan.l" -{ - /* This rule is separate from the one below because - * otherwise we get variable trailing context, so - * we can't build the scanner using -{f,F}. - */ - bracelevel = 0; - continued_action = false; - BEGIN(ACTION); - - if ( in_rule ) - { - doing_rule_action = true; - in_rule = false; - return '\n'; - } - } - YY_BREAK -case 136: -/* rule 136 can match eol */ -YY_RULE_SETUP -#line 516 "scan.l" -{ - bracelevel = 0; - continued_action = false; - BEGIN(ACTION); - unput( '\n' ); /* so sees it */ - - if ( in_rule ) - { - doing_rule_action = true; - in_rule = false; - return '\n'; - } - } - YY_BREAK -case 137: -#line 531 "scan.l" -case 138: -YY_RULE_SETUP -#line 531 "scan.l" -return EOF_OP; - YY_BREAK -case 139: -YY_RULE_SETUP -#line 533 "scan.l" -{ - sectnum = 3; - BEGIN(SECT3); - outn("/* Begin user sect3 */"); - yyterminate(); /* to stop the parser */ - } - YY_BREAK -case 140: -YY_RULE_SETUP -#line 540 "scan.l" -{ - int cclval; - - if(yyleng < MAXLINE) - { - strcpy( nmstr, yytext ); - } - else - { - synerr( _("Input line too long\n")); - FLEX_EXIT(EXIT_FAILURE); - } - - /* Check to see if we've already encountered this - * ccl. - */ - if ( (cclval = ccllookup( (Char *) nmstr )) != 0 ) - { - if ( input() != ']' ) - synerr( _( "bad character class" ) ); - - yylval = cclval; - ++cclreuse; - return PREVCCL; - } - else - { - /* We fudge a bit. We know that this ccl will - * soon be numbered as lastccl + 1 by cclinit. - */ - cclinstal( (Char *) nmstr, lastccl + 1 ); - - /* Push back everything but the leading bracket - * so the ccl can be rescanned. - */ - yyless( 1 ); - - BEGIN(FIRSTCCL); - return '['; - } - } - YY_BREAK -/* Check for :space: at the end of the rule so we don't - * wrap the expanded regex in '(' ')' -- breaking trailing - * context. - */ -case 141: -/* rule 141 can match eol */ -YY_RULE_SETUP -#line 586 "scan.l" -{ - register Char *nmdefptr; - int end_is_ws, end_ch; - - end_ch = yytext[yyleng-1]; - end_is_ws = end_ch != '}' ? 1 : 0; - - if(yyleng-1 < MAXLINE) - { - strcpy( nmstr, yytext + 1 ); - } - else - { - synerr( _("Input line too long\n")); - FLEX_EXIT(EXIT_FAILURE); - } -nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */ - - if ( (nmdefptr = ndlookup( nmstr )) == 0 ) - format_synerr( - _( "undefined definition {%s}" ), - nmstr ); - - else - { /* push back name surrounded by ()'s */ - int len = strlen( (char *) nmdefptr ); - if (end_is_ws) - unput(end_ch); - - if ( lex_compat || nmdefptr[0] == '^' || - (len > 0 && nmdefptr[len - 1] == '$') - || (end_is_ws && trlcontxt)) - { /* don't use ()'s after all */ - PUT_BACK_STRING((char *) nmdefptr, 0); - - if ( nmdefptr[0] == '^' ) - BEGIN(CARETISBOL); - } - - else - { - unput(')'); - PUT_BACK_STRING((char *) nmdefptr, 0); - unput('('); - } - } - } - YY_BREAK -case 142: -YY_RULE_SETUP -#line 634 "scan.l" -return (unsigned char) yytext[0]; - YY_BREAK -case 143: -YY_RULE_SETUP -#line 635 "scan.l" -RETURNCHAR; - YY_BREAK - - -case 144: -/* rule 144 can match eol */ -YY_RULE_SETUP -#line 640 "scan.l" -++linenum; /* Allow blank lines & continuations */ - YY_BREAK -case 145: -YY_RULE_SETUP -#line 641 "scan.l" -return (unsigned char) yytext[0]; - YY_BREAK -case 146: -YY_RULE_SETUP -#line 642 "scan.l" -BEGIN(SECT2); return '>'; - YY_BREAK -case 147: -*yy_cp = YY_G(yy_hold_char); /* undo effects of setting up yytext */ -YY_G(yy_c_buf_p) = yy_cp = yy_bp + 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 643 "scan.l" -BEGIN(CARETISBOL); return '>'; - YY_BREAK -case 148: -YY_RULE_SETUP -#line 644 "scan.l" -RETURNNAME; - YY_BREAK -case 149: -YY_RULE_SETUP -#line 645 "scan.l" -{ - format_synerr( _( "bad : %s" ), - yytext ); - } - YY_BREAK - -case 150: -YY_RULE_SETUP -#line 651 "scan.l" -BEGIN(SECT2); return '^'; - YY_BREAK - -case 151: -YY_RULE_SETUP -#line 655 "scan.l" -RETURNCHAR; - YY_BREAK -case 152: -YY_RULE_SETUP -#line 656 "scan.l" -BEGIN(SECT2); return '"'; - YY_BREAK -case 153: -/* rule 153 can match eol */ -YY_RULE_SETUP -#line 658 "scan.l" -{ - synerr( _( "missing quote" ) ); - BEGIN(SECT2); - ++linenum; - return '"'; - } - YY_BREAK - - -case 154: -*yy_cp = YY_G(yy_hold_char); /* undo effects of setting up yytext */ -YY_G(yy_c_buf_p) = yy_cp = yy_bp + 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 668 "scan.l" -BEGIN(CCL); return '^'; - YY_BREAK -case 155: -*yy_cp = YY_G(yy_hold_char); /* undo effects of setting up yytext */ -YY_G(yy_c_buf_p) = yy_cp = yy_bp + 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 669 "scan.l" -return '^'; - YY_BREAK -case 156: -YY_RULE_SETUP -#line 670 "scan.l" -BEGIN(CCL); RETURNCHAR; - YY_BREAK - - -case 157: -*yy_cp = YY_G(yy_hold_char); /* undo effects of setting up yytext */ -YY_G(yy_c_buf_p) = yy_cp = yy_bp + 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 674 "scan.l" -return '-'; - YY_BREAK -case 158: -YY_RULE_SETUP -#line 675 "scan.l" -RETURNCHAR; - YY_BREAK -case 159: -YY_RULE_SETUP -#line 676 "scan.l" -BEGIN(SECT2); return ']'; - YY_BREAK -case 160: -/* rule 160 can match eol */ -YY_RULE_SETUP -#line 677 "scan.l" -{ - synerr( _( "bad character class" ) ); - BEGIN(SECT2); - return ']'; - } - YY_BREAK - - -case 161: -YY_RULE_SETUP -#line 685 "scan.l" -BEGIN(CCL); return CCE_ALNUM; - YY_BREAK -case 162: -YY_RULE_SETUP -#line 686 "scan.l" -BEGIN(CCL); return CCE_ALPHA; - YY_BREAK -case 163: -YY_RULE_SETUP -#line 687 "scan.l" -BEGIN(CCL); return CCE_BLANK; - YY_BREAK -case 164: -YY_RULE_SETUP -#line 688 "scan.l" -BEGIN(CCL); return CCE_CNTRL; - YY_BREAK -case 165: -YY_RULE_SETUP -#line 689 "scan.l" -BEGIN(CCL); return CCE_DIGIT; - YY_BREAK -case 166: -YY_RULE_SETUP -#line 690 "scan.l" -BEGIN(CCL); return CCE_GRAPH; - YY_BREAK -case 167: -YY_RULE_SETUP -#line 691 "scan.l" -BEGIN(CCL); return CCE_LOWER; - YY_BREAK -case 168: -YY_RULE_SETUP -#line 692 "scan.l" -BEGIN(CCL); return CCE_PRINT; - YY_BREAK -case 169: -YY_RULE_SETUP -#line 693 "scan.l" -BEGIN(CCL); return CCE_PUNCT; - YY_BREAK -case 170: -YY_RULE_SETUP -#line 694 "scan.l" -BEGIN(CCL); return CCE_SPACE; - YY_BREAK -case 171: -YY_RULE_SETUP -#line 695 "scan.l" -BEGIN(CCL); return CCE_UPPER; - YY_BREAK -case 172: -YY_RULE_SETUP -#line 696 "scan.l" -BEGIN(CCL); return CCE_XDIGIT; - YY_BREAK -case 173: -YY_RULE_SETUP -#line 697 "scan.l" -{ - format_synerr( - _( "bad character class expression: %s" ), - yytext ); - BEGIN(CCL); return CCE_ALNUM; - } - YY_BREAK - - -case 174: -YY_RULE_SETUP -#line 706 "scan.l" -{ - yylval = myctoi( yytext ); - return NUMBER; - } - YY_BREAK -case 175: -YY_RULE_SETUP -#line 711 "scan.l" -return ','; - YY_BREAK -case 176: -YY_RULE_SETUP -#line 712 "scan.l" -{ - BEGIN(SECT2); - if ( lex_compat || posix_compat ) - return END_REPEAT_POSIX; - else - return END_REPEAT_FLEX; - } - YY_BREAK -case 177: -YY_RULE_SETUP -#line 720 "scan.l" -{ - synerr( _( "bad character inside {}'s" ) ); - BEGIN(SECT2); - return '}'; - } - YY_BREAK -case 178: -/* rule 178 can match eol */ -YY_RULE_SETUP -#line 726 "scan.l" -{ - synerr( _( "missing }" ) ); - BEGIN(SECT2); - ++linenum; - return '}'; - } - YY_BREAK - - -case 179: -YY_RULE_SETUP -#line 736 "scan.l" -bracelevel = 0; - YY_BREAK -case 180: -YY_RULE_SETUP -#line 738 "scan.l" -ACTION_ECHO; yy_push_state( COMMENT ); - YY_BREAK - -case 181: -YY_RULE_SETUP -#line 741 "scan.l" -{ - ACTION_ECHO; - CHECK_REJECT(yytext); - } - YY_BREAK -case 182: -YY_RULE_SETUP -#line 745 "scan.l" -{ - ACTION_ECHO; - CHECK_YYMORE(yytext); - } - YY_BREAK - -case 183: -YY_RULE_SETUP -#line 751 "scan.l" -ACTION_ECHO; - YY_BREAK -case 184: -/* rule 184 can match eol */ -YY_RULE_SETUP -#line 752 "scan.l" -{ - ++linenum; - ACTION_ECHO; - if ( bracelevel == 0 || - (doing_codeblock && indented_code) ) - { - if ( doing_rule_action ) - add_action( "\tYY_BREAK\n" ); - - doing_rule_action = doing_codeblock = false; - BEGIN(SECT2); - } - } - YY_BREAK - -/* Reject and YYmore() are checked for above, in PERCENT_BRACE_ACTION */ - -case 185: -YY_RULE_SETUP -#line 770 "scan.l" -ACTION_ECHO; ++bracelevel; - YY_BREAK -case 186: -YY_RULE_SETUP -#line 771 "scan.l" -ACTION_ECHO; --bracelevel; - YY_BREAK -case 187: -YY_RULE_SETUP -#line 772 "scan.l" -ACTION_ECHO; - YY_BREAK -case 188: -YY_RULE_SETUP -#line 773 "scan.l" -ACTION_ECHO; - YY_BREAK -case 189: -YY_RULE_SETUP -#line 774 "scan.l" -ACTION_ECHO; /* character constant */ - YY_BREAK -case 190: -YY_RULE_SETUP -#line 775 "scan.l" -ACTION_ECHO; BEGIN(ACTION_STRING); - YY_BREAK -case 191: -/* rule 191 can match eol */ -YY_RULE_SETUP -#line 776 "scan.l" -{ - ++linenum; - ACTION_ECHO; - if ( bracelevel == 0 ) - { - if ( doing_rule_action ) - add_action( "\tYY_BREAK\n" ); - - doing_rule_action = false; - BEGIN(SECT2); - } - } - YY_BREAK -case 192: -YY_RULE_SETUP -#line 788 "scan.l" -ACTION_ECHO; - YY_BREAK - - -case 193: -YY_RULE_SETUP -#line 792 "scan.l" -ACTION_ECHO; - YY_BREAK -case 194: -YY_RULE_SETUP -#line 793 "scan.l" -ACTION_ECHO; - YY_BREAK -case 195: -/* rule 195 can match eol */ -YY_RULE_SETUP -#line 794 "scan.l" -++linenum; ACTION_ECHO; BEGIN(ACTION); - YY_BREAK -case 196: -YY_RULE_SETUP -#line 795 "scan.l" -ACTION_ECHO; BEGIN(ACTION); - YY_BREAK -case 197: -YY_RULE_SETUP -#line 796 "scan.l" -ACTION_ECHO; - YY_BREAK - -case YY_STATE_EOF(COMMENT): -case YY_STATE_EOF(ACTION): -case YY_STATE_EOF(ACTION_STRING): -#line 799 "scan.l" -{ - synerr( _( "EOF encountered inside an action" ) ); - yyterminate(); - } - YY_BREAK -case 198: -YY_RULE_SETUP -#line 805 "scan.l" -{ - yylval = myesc( (Char *) yytext ); - - if ( YY_START == FIRSTCCL ) - BEGIN(CCL); - - return CHAR; - } - YY_BREAK - -case 199: -/* rule 199 can match eol */ -YY_RULE_SETUP -#line 816 "scan.l" -ECHO; - YY_BREAK -case YY_STATE_EOF(SECT3): -#line 817 "scan.l" -sectnum = 0; yyterminate(); - YY_BREAK - -case 200: -/* rule 200 can match eol */ -YY_RULE_SETUP -#line 820 "scan.l" -format_synerr( _( "bad character: %s" ), yytext ); - YY_BREAK -case 201: -YY_RULE_SETUP -#line 822 "scan.l" -YY_FATAL_ERROR( "flex scanner jammed" ); - YY_BREAK -#line 3604 "scan.c" -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(SECT2): -case YY_STATE_EOF(CODEBLOCK): -case YY_STATE_EOF(PICKUPDEF): -case YY_STATE_EOF(SC): -case YY_STATE_EOF(CARETISBOL): -case YY_STATE_EOF(NUM): -case YY_STATE_EOF(QUOTE): -case YY_STATE_EOF(FIRSTCCL): -case YY_STATE_EOF(CCL): -case YY_STATE_EOF(RECOVER): -case YY_STATE_EOF(PERCENT_BRACE_ACTION): -case YY_STATE_EOF(OPTION): -case YY_STATE_EOF(LINEDIR): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = YY_G(yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_G(yy_current_buffer)->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_G(yy_n_chars) = YY_G(yy_current_buffer)->yy_n_chars; - YY_G(yy_current_buffer)->yy_input_file = yyin; - YY_G(yy_current_buffer)->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_G(yy_c_buf_p) <= &YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( YY_CALL_ONLY_ARG ); - - /* 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_CALL_LAST_ARG); - - yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++YY_G(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = YY_G(yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( YY_CALL_ONLY_ARG ) ) - { - case EOB_ACT_END_OF_FILE: - { - YY_G(yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( YY_CALL_ONLY_ARG ) ) - { - /* 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_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! YY_G(yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - YY_G(yy_c_buf_p) = - YY_G(yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( YY_CALL_ONLY_ARG ); - - yy_cp = YY_G(yy_c_buf_p); - yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - YY_G(yy_c_buf_p) = - &YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( YY_CALL_ONLY_ARG ); - - yy_cp = YY_G(yy_c_buf_p); - yy_bp = YY_G(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 */ -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ - - -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ - - -/* 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 - */ - - -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ -static int yy_get_next_buffer YYFARGS0(void) - - { - register char *dest = YY_G(yy_current_buffer)->yy_ch_buf; - register char *source = YY_G(yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( YY_G(yy_c_buf_p) > &YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_G(yy_current_buffer)->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( YY_G(yy_c_buf_p) - YY_G(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_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_G(yy_current_buffer)->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_G(yy_current_buffer)->yy_n_chars = YY_G(yy_n_chars) = 0; - - else - { - size_t num_to_read = - YY_G(yy_current_buffer)->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_G(yy_current_buffer); - - int yy_c_buf_p_offset = - (int) (YY_G(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 YY_CALL_LAST_ARG ); - } - 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_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_G(yy_current_buffer)->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_G(yy_current_buffer)->yy_ch_buf[number_to_move]), - YY_G(yy_n_chars), num_to_read ); - - YY_G(yy_current_buffer)->yy_n_chars = YY_G(yy_n_chars); - } - - if ( YY_G(yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin YY_CALL_LAST_ARG); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_G(yy_current_buffer)->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - YY_G(yy_n_chars) += number_to_move; - YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - YY_G(yytext_ptr) = &YY_G(yy_current_buffer)->yy_ch_buf[0]; - - return ret_val; - } -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ - static yy_state_type yy_get_previous_state YYFARGS0(void) - - { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = YY_G(yy_start); - yy_current_state += YY_AT_BOL(); - - for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - YY_G(yy_last_accepting_state) = yy_current_state; - YY_G(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 >= 973 ) - 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 ); - */ - - static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state) - - { - register int yy_is_jam; - register char *yy_cp = YY_G(yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - YY_G(yy_last_accepting_state) = yy_current_state; - YY_G(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 >= 973 ) - 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 == 972); - - return yy_is_jam ? 0 : yy_current_state; - } - - - -#ifndef YY_NO_UNPUT - static void yyunput YYFARGS2( int,c, register char *,yy_bp) - - { - register char *yy_cp = YY_G(yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = YY_G(yy_hold_char); - - if ( yy_cp < YY_G(yy_current_buffer)->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = YY_G(yy_n_chars) + 2; - register char *dest = &YY_G(yy_current_buffer)->yy_ch_buf[ - YY_G(yy_current_buffer)->yy_buf_size + 2]; - register char *source = - &YY_G(yy_current_buffer)->yy_ch_buf[number_to_move]; - - while ( source > YY_G(yy_current_buffer)->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_G(yy_current_buffer)->yy_n_chars = - YY_G(yy_n_chars) = YY_G(yy_current_buffer)->yy_buf_size; - - if ( yy_cp < YY_G(yy_current_buffer)->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - -#ifdef YY_USE_LINENO - if ( c == '\n' ) - --yylineno; -#endif - YY_G(yytext_ptr) = yy_bp; - YY_G(yy_hold_char) = *yy_cp; - YY_G(yy_c_buf_p) = yy_cp; - } - -#endif /* ifndef YY_NO_UNPUT */ - - - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput YYFARGS0(void) -#else - static int input YYFARGS0(void) -#endif - - - - { - int c; - - *YY_G(yy_c_buf_p) = YY_G(yy_hold_char); - - if ( *YY_G(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_G(yy_c_buf_p) < &YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars)] ) - /* This was really a NUL. */ - *YY_G(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr); - ++YY_G(yy_c_buf_p); - - switch ( yy_get_next_buffer( YY_CALL_ONLY_ARG ) ) - { - 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 YY_CALL_LAST_ARG); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( YY_CALL_ONLY_ARG ) ) - return EOF; - - if ( ! YY_G(yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(YY_CALL_ONLY_ARG); -#else - return input(YY_CALL_ONLY_ARG); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */ - *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */ - YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p); - - YY_G(yy_current_buffer)->yy_at_bol = (c == '\n'); - - return c; - } - -#endif /* ifndef YY_NO_INPUT */ - - - - void yyrestart YYFARGS1( FILE *,input_file) - - { - if ( ! YY_G(yy_current_buffer) ) - YY_G(yy_current_buffer) = - yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG); - - yy_init_buffer( YY_G(yy_current_buffer), input_file YY_CALL_LAST_ARG); - yy_load_buffer_state( YY_CALL_ONLY_ARG ); - } - - - void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer) - - { - if ( YY_G(yy_current_buffer) == new_buffer ) - return; - - if ( YY_G(yy_current_buffer) ) - { - /* Flush out information for old buffer. */ - *YY_G(yy_c_buf_p) = YY_G(yy_hold_char); - YY_G(yy_current_buffer)->yy_buf_pos = YY_G(yy_c_buf_p); - YY_G(yy_current_buffer)->yy_n_chars = YY_G(yy_n_chars); - } - - YY_G(yy_current_buffer) = new_buffer; - yy_load_buffer_state( YY_CALL_ONLY_ARG ); - - /* 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_G(yy_did_buffer_switch_on_eof) = 1; - } - - - - void yy_load_buffer_state YYFARGS0(void) - - { - YY_G(yy_n_chars) = YY_G(yy_current_buffer)->yy_n_chars; - YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_G(yy_current_buffer)->yy_buf_pos; - yyin = YY_G(yy_current_buffer)->yy_input_file; - YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); - } - - - YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size) - - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) YY_CALL_LAST_ARG ); - 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 YY_CALL_LAST_ARG ); - 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 YY_CALL_LAST_ARG); - - return b; - } - - - void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b) - - { - if ( ! b ) - return; - - if ( b == YY_G(yy_current_buffer) ) - YY_G(yy_current_buffer) = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree( (void *) b->yy_ch_buf YY_CALL_LAST_ARG ); - - yyfree( (void *) b YY_CALL_LAST_ARG ); - } - - - -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -#ifndef __cplusplus -extern int isatty YY_PARAMS(( int )); -#endif /* __cplusplus */ -#endif /* !YY_NEVER_INTERACTIVE */ -#endif /* !YY_ALWAYS_INTERACTIVE */ - - - - void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file) - - - { - int oerrno = errno; - - yy_flush_buffer( b YY_CALL_LAST_ARG); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - - errno = oerrno; - } - - - void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b) - - { - 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_G(yy_current_buffer) ) - yy_load_buffer_state( YY_CALL_ONLY_ARG ); - } - - -#ifndef YY_NO_SCAN_BUFFER - -YY_BUFFER_STATE yy_scan_buffer YYFARGS2( 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 ) YY_CALL_LAST_ARG ); - 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 YY_CALL_LAST_ARG ); - - return b; - } - -#endif - - -#ifndef YY_NO_SCAN_STRING - -YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,yy_str) - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len YY_CALL_LAST_ARG); - } - -#endif - - -#ifndef YY_NO_SCAN_BYTES - -YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,bytes, int ,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 = len + 2; - buf = (char *) yyalloc( n YY_CALL_LAST_ARG ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n YY_CALL_LAST_ARG); - 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_NO_PUSH_STATE - - static void yy_push_state YYFARGS1( int ,new_state) - - { - if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) ) - { - yy_size_t new_size; - - YY_G(yy_start_stack_depth) += YY_START_STACK_INCR; - new_size = YY_G(yy_start_stack_depth) * sizeof( int ); - - if ( ! YY_G(yy_start_stack) ) - YY_G(yy_start_stack) = (int *) yyalloc( new_size YY_CALL_LAST_ARG ); - - else - YY_G(yy_start_stack) = (int *) yyrealloc( - (void *) YY_G(yy_start_stack), new_size YY_CALL_LAST_ARG ); - - if ( ! YY_G(yy_start_stack) ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE - - static void yy_pop_state YYFARGS0(void) - - { - if ( --YY_G(yy_start_stack_ptr) < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]); - } -#endif - - -#ifndef YY_NO_TOP_STATE - - static int yy_top_state YYFARGS0(void) - - { - return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - - -static void yy_fatal_error YYFARGS1(yyconst char*, msg) - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - -/* 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_G(yy_hold_char); \ - YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \ - YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \ - *YY_G(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - - - -/* Accessor methods (get/set functions) to struct members. */ - - - -#ifndef YY_NO_GET_LINENO -int yyget_lineno YYFARGS0(void) -{ - return yylineno; -} -#endif /* !YY_NO_GET_LINENO */ - -#ifndef YY_NO_GET_IN -FILE *yyget_in YYFARGS0(void) -{ - return yyin; -} -#endif /* !YY_NO_GET_IN */ - -#ifndef YY_NO_GET_OUT -FILE *yyget_out YYFARGS0(void) -{ - return yyout; -} -#endif /* !YY_NO_GET_OUT */ - -#ifndef YY_NO_GET_LENG -int yyget_leng YYFARGS0(void) -{ - return yyleng; -} -#endif /* !YY_NO_GET_LENG */ - -#ifndef YY_NO_GET_TEXT -char *yyget_text YYFARGS0(void) -{ - return yytext; -} -#endif /* !YY_NO_GET_TEXT */ - - -#ifndef YY_NO_SET_LINENO -void yyset_lineno YYFARGS1( int ,line_number) -{ - yylineno = line_number; -} -#endif /* !YY_NO_SET_LINENO */ - - -#ifndef YY_NO_SET_IN -void yyset_in YYFARGS1( FILE * ,in_str) -{ - yyin = in_str ; -} -#endif /* !YY_NO_SET_IN */ - -#ifndef YY_NO_SET_OUT -void yyset_out YYFARGS1( FILE * ,out_str) -{ - yyout = out_str ; -} -#endif /* !YY_NO_SET_OUT */ - - -#ifndef YY_NO_GET_DEBUG -int yyget_debug YYFARGS0(void) -{ - return yy_flex_debug; -} -#endif /* !YY_NO_GET_DEBUG */ - -#ifndef YY_NO_SET_DEBUG -void yyset_debug YYFARGS1( int ,bdebug) -{ - yy_flex_debug = bdebug ; -} -#endif /* !YY_NO_SET_DEBUG */ - - - - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy YYFARGS0(void) -{ - /* Destroy the current (main) buffer. */ - yy_delete_buffer( YY_G(yy_current_buffer) YY_CALL_LAST_ARG ); - YY_G(yy_current_buffer) = NULL; - -#if defined(YY_STACK_USED) || defined(YY_REENTRANT) - /* Destroy the start condition stack. */ - if (YY_G(yy_start_stack) ){ - yyfree( YY_G(yy_start_stack) YY_CALL_LAST_ARG ); - YY_G(yy_start_stack) = NULL; - } -#endif - -#ifdef YY_USES_REJECT - yyfree ( YY_G(yy_state_buf) YY_CALL_LAST_ARG); -#endif - - return 0; -} - - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -static void yy_flex_strncpy YYFARGS3( 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 YYFARGS1( yyconst char *,s) - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - -/* You may override yyalloc by defining YY_NO_FLEX_ALLOC and linking to - * your own version */ -#ifndef YY_NO_FLEX_ALLOC -void *yyalloc YYFARGS1( yy_size_t ,size) - { - return (void *) malloc( size ); - } -#endif - -/* You may override yyrealloc by defining YY_NO_FLEX_REALLOC and linking - * to your own version. */ -#ifndef YY_NO_FLEX_REALLOC -void *yyrealloc YYFARGS2( 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 ); - } -#endif - -/* You may override yyfree by defining YY_NO_FLEX_FREE and linking to - * your own version.*/ -#ifndef YY_NO_FLEX_FREE -void yyfree YYFARGS1( void *,ptr) - { - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ - } -#endif - -#define YYTABLES_NAME "yytables" - -#if YY_MAIN -int main YY_PARAMS((void)); - -int main () - { - - yylex(); - - return 0; - } -#endif -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ -#line 822 "scan.l" -#ifndef yyIN_HEADER /* YY-DISCARD-FROM-HEADER */ - - - -int yywrap() - { - if ( --num_input_files > 0 ) - { - set_input_file( *++input_files ); - return 0; - } - - else - return 1; - } - - -/* set_input_file - open the given file (if NULL, stdin) for scanning */ - -void set_input_file( file ) -char *file; - { - if ( file && strcmp( file, "-" ) ) - { - infilename = copy_string( file ); - yyin = fopen( infilename, "r" ); - - if ( yyin == NULL ) - lerrsf( _( "can't open %s" ), file ); - } - - else - { - yyin = stdin; - infilename = copy_string( "" ); - } - - linenum = 1; - } - - -/* Wrapper routines for accessing the scanner's malloc routines. */ - -void *flex_alloc( size ) -size_t size; - { - return (void *) malloc( size ); - } - -void *flex_realloc( ptr, size ) -void *ptr; -size_t size; - { - return (void *) realloc( ptr, size ); - } - -void flex_free( ptr ) -void *ptr; - { - if ( ptr ) - free( ptr ); - } -#endif /* !yyIN_HEADER YY-END-DISCARD-FROM-HEADER */ diff --git a/src/bin/flex/scan.l b/src/bin/flex/scan.l deleted file mode 100644 index fe9a0fc501..0000000000 --- a/src/bin/flex/scan.l +++ /dev/null @@ -1,882 +0,0 @@ -/* scan.l - scanner for flex input -*-C-*- */ - -%{ -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -#include "flexdef.h" -#include "parse.h" -extern bool tablesverify, tablesext; -extern int trlcontxt; /* Set in parse.y for each rule. */ - -#define ACTION_ECHO add_action( yytext ) -#define ACTION_IFDEF(def, should_define) \ - { \ - if ( should_define ) \ - action_define( def, 1 ); \ - } - -#define ACTION_M4_IFDEF(def, should_define) \ - do{ \ - if ( should_define ) \ - buf_m4_define( &m4defs_buf, def, NULL);\ - else \ - buf_m4_undefine( &m4defs_buf, def);\ - } while(0) - -#define MARK_END_OF_PROLOG mark_prolog(); - -#define YY_DECL \ - int flexscan() - -#define RETURNCHAR \ - yylval = (unsigned char) yytext[0]; \ - return CHAR; - -#define RETURNNAME \ - if(yyleng < MAXLINE) \ - { \ - strcpy( nmstr, yytext ); \ - } \ - else \ - { \ - synerr(_("Input line too long\n")); \ - FLEX_EXIT(EXIT_FAILURE); \ - } \ - return NAME; - -#define PUT_BACK_STRING(str, start) \ - for ( i = strlen( str ) - 1; i >= start; --i ) \ - unput((str)[i]) - -#define CHECK_REJECT(str) \ - if ( all_upper( str ) ) \ - reject = true; - -#define CHECK_YYMORE(str) \ - if ( all_lower( str ) ) \ - yymore_used = true; - -#define YY_USER_INIT \ - if ( getenv("POSIXLY_CORRECT") ) \ - posix_compat = true; - -%} - -%option caseless nodefault stack noyy_top_state -%option nostdinit - -%x SECT2 SECT2PROLOG SECT3 CODEBLOCK PICKUPDEF SC CARETISBOL NUM QUOTE -%x FIRSTCCL CCL ACTION RECOVER COMMENT ACTION_STRING PERCENT_BRACE_ACTION -%x OPTION LINEDIR CODEBLOCK_MATCH_BRACE - -WS [[:blank:]]+ -OPTWS [[:blank:]]* -NOT_WS [^[:blank:]\r\n] - -NL \r?\n - -NAME ([[:alpha:]_][[:alnum:]_-]*) -NOT_NAME [^[:alpha:]_*\n]+ - -SCNAME {NAME} - -ESCSEQ (\\([^\n]|[0-7]{1,3}|x[[:xdigit:]]{1,2})) - -FIRST_CCL_CHAR ([^\\\n]|{ESCSEQ}) -CCL_CHAR ([^\\\n\]]|{ESCSEQ}) -CCL_EXPR ("[:"[[:alpha:]]+":]") - -LEXOPT [aceknopr] - -%% - static int bracelevel, didadef, indented_code; - static int doing_rule_action = false; - static int option_sense; - - int doing_codeblock = false; - int i, brace_depth=0, brace_start_line=0; - Char nmdef[MAXLINE]; - - -{ - ^{WS} indented_code = true; BEGIN(CODEBLOCK); - ^"/*" ACTION_ECHO; yy_push_state( COMMENT ); - ^#{OPTWS}line{WS} yy_push_state( LINEDIR ); - ^"%s"{NAME}? return SCDECL; - ^"%x"{NAME}? return XSCDECL; - ^"%{".*{NL} { - ++linenum; - line_directive_out( (FILE *) 0, 1 ); - indented_code = false; - BEGIN(CODEBLOCK); - } - ^"%top"[[:blank:]]*"{"[[:blank:]]*{NL} { - brace_start_line = linenum; - ++linenum; - buf_linedir( &top_buf, infilename?infilename:"", linenum); - brace_depth = 1; - yy_push_state(CODEBLOCK_MATCH_BRACE); - } - - ^"%top".* synerr( _("malformed '%top' directive") ); - - {WS} /* discard */ - - ^"%%".* { - sectnum = 2; - bracelevel = 0; - mark_defs1(); - line_directive_out( (FILE *) 0, 1 ); - BEGIN(SECT2PROLOG); - return SECTEND; - } - - ^"%pointer".*{NL} yytext_is_array = false; ++linenum; - ^"%array".*{NL} yytext_is_array = true; ++linenum; - - ^"%option" BEGIN(OPTION); return OPTION_OP; - - ^"%"{LEXOPT}{OPTWS}[[:digit:]]*{OPTWS}{NL} ++linenum; /* ignore */ - ^"%"{LEXOPT}{WS}.*{NL} ++linenum; /* ignore */ - - /* xgettext: no-c-format */ - ^"%"[^sxaceknopr{}].* synerr( _( "unrecognized '%' directive" ) ); - - ^{NAME} { - if(yyleng < MAXLINE) - { - strcpy( nmstr, yytext ); - } - else - { - synerr( _("Input line too long\n")); - FLEX_EXIT(EXIT_FAILURE); - } - - didadef = false; - BEGIN(PICKUPDEF); - } - - {SCNAME} RETURNNAME; - ^{OPTWS}{NL} ++linenum; /* allows blank lines in section 1 */ - {OPTWS}{NL} ACTION_ECHO; ++linenum; /* maybe end of comment line */ -} - - -{ - "*/" ACTION_ECHO; yy_pop_state(); - "*" ACTION_ECHO; - [^*\n]+ ACTION_ECHO; - [^*\n]*{NL} ++linenum; ACTION_ECHO; -} - -{ - \n yy_pop_state(); - [[:digit:]]+ linenum = myctoi( yytext ); - - \"[^"\n]*\" { - flex_free( (void *) infilename ); - infilename = copy_string( yytext + 1 ); - infilename[strlen( infilename ) - 1] = '\0'; - } - . /* ignore spurious characters */ -} - -{ - ^"%}".*{NL} ++linenum; BEGIN(INITIAL); - - {NAME}|{NOT_NAME}|. ACTION_ECHO; - - {NL} { - ++linenum; - ACTION_ECHO; - if ( indented_code ) - BEGIN(INITIAL); - } -} - -{ - "}" { - if( --brace_depth == 0){ - /* TODO: Matched. */ - yy_pop_state(); - }else - buf_strnappend(&top_buf, yytext, yyleng); - } - - "{" { - brace_depth++; - buf_strnappend(&top_buf, yytext, yyleng); - } - - {NL} { - ++linenum; - buf_strnappend(&top_buf, yytext, yyleng); - } - - [^{}\r\n]+ { - buf_strnappend(&top_buf, yytext, yyleng); - } - - <> { - linenum = brace_start_line; - synerr(_("Unmatched '{'")); - yyterminate(); - } -} - - -{ - {WS} /* separates name and definition */ - - {NOT_WS}[^\r\n]* { - if(yyleng < MAXLINE) - { - strcpy( (char *) nmdef, yytext ); - } - else - { - synerr( _("Input line too long\n")); - FLEX_EXIT(EXIT_FAILURE); - } - /* Skip trailing whitespace. */ - for ( i = strlen( (char *) nmdef ) - 1; - i >= 0 && (nmdef[i] == ' ' || nmdef[i] == '\t'); - --i ) - ; - - nmdef[i + 1] = '\0'; - - ndinstal( nmstr, nmdef ); - didadef = true; - } - - {NL} { - if ( ! didadef ) - synerr( _( "incomplete name definition" ) ); - BEGIN(INITIAL); - ++linenum; - } -} - - -