diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..da8168b --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# CVS default ignores begin +tags +TAGS +.make.state +.nse_depinfo +*~ +\#* +.#* +,* +_$* +*$ +*.old +*.bak +*.BAK +*.orig +*.rej +.del-* +*.a +*.olb +*.o +*.obj +*.so +*.exe +*.Z +*.elc +*.ln +core +# CVS default ignores end diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..ece25cb --- /dev/null +++ b/AUTHORS @@ -0,0 +1,3 @@ +Elliot Mednick +Mark Hummel + diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 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/ChangeLog b/ChangeLog new file mode 100644 index 0000000..bccd50b --- /dev/null +++ b/ChangeLog @@ -0,0 +1,38 @@ +2005-09-01 Mark Hummel + + * initial conversion to automake/autoconf. + +2005-09-07 Mark Hummel + + * beefed up configure scripts + * added lxt support + * added --enable-m32 configuration switch + * added --disable-lxt configuration switch + * fixed amd64 failures + +2005-09-08 Mark Hummel + + * --disable-lxt switch disables check for libz + * removed version.h file + * changed revision number to 2.8.0 + * added --bindir switch + * added --libdir switch + * added --cflags switch + * added --libs switch + * added --includedir switch + * added --help switch + * added --version switch + * using libtool to create static and dynamic libraries + +2005-09-11 Mark Hummel + + * using libtool to build both static and shared libraries + * added --ldflags switch + * fixed lexer bug with `xyz directives + +2005-09-15 Mark Hummel + + * removed shell_* memory management routines + * fixed segfaults when opening non-existant files + * allow $random arg to be hiearchical reference + * allow bit references to scalar variables diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..56b077d --- /dev/null +++ b/INSTALL @@ -0,0 +1,236 @@ +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' 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=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PREFIX', the package will +use PREFIX 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=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 `--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 + +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/Makefile.am b/Makefile.am new file mode 100644 index 0000000..b7f2b32 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,9 @@ +if USE_LXT + LXT=lxt +endif +SUBDIRS = replace $(LXT) src . + +EXTRA_DIST = bootstrap + +AM_CFLAGS = @PATHS@ + diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..ce97771 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,618 @@ +# Makefile.in generated by automake 1.9.5 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 = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ + TODO config/compile config/config.guess config/config.sub \ + config/depcomp config/install-sh config/ltmain.sh \ + config/missing config/ylwrap +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +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 = $(install_sh) -d +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 +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = replace lxt src . +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 +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@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +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@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_LXT_FALSE = @USE_LXT_FALSE@ +USE_LXT_TRUE = @USE_LXT_TRUE@ +VERSION = @VERSION@ +XGPERF = @XGPERF@ +YACC = @YACC@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +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@ +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@ +@USE_LXT_TRUE@LXT = lxt +SUBDIRS = replace $(LXT) src . +EXTRA_DIST = bootstrap +AM_CFLAGS = @PATHS@ +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.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# 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.h.in $(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.h.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; }'`; \ + 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.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.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 + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkdir_p) $(distdir)/config + @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 + $(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 config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +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 mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: 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-libtool 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-libtool \ + distclean-recursive distclean-tags distcleancheck distdir \ + distuninstallcheck 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-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am 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/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..b0c9efd --- /dev/null +++ b/README @@ -0,0 +1,31 @@ +Veriwell +=================================== + +Veriwell is a verilog simulator. It is compliant to verilog 95, but +does not fully support it. The most notable missing feature is the +support for strengths. + +This package also integrates support for dumping lxt waveform files. +These files can be used with the gtkwaves waveform viewer. + +Quick Start +----------- +tar -zxvf veriwell.tar.gz +cd veriwell +./configure +make +make install + +AMD64 Support +------------- +For AMD64 targets the --enable-m32 switch may be used +when running configure to force a 32 bit version. Note +specifing this switch is equivilent to running +./configure CFLAGS=-m32 LDFLAGS=-m32. + +Lxt support for Gtkwaves (1.*) requires libz to +be installed. Lxt support may be disabled by using +the configuration switch --disable-lxt. + +Enjoy! + diff --git a/TODO b/TODO new file mode 100644 index 0000000..f36506f --- /dev/null +++ b/TODO @@ -0,0 +1,5 @@ +* create man pages +* add email addresses +* add lxt2 support +* add dynamic loading of pli code +* add documentation diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..c66b846 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,48 @@ +# +# readline lib detection +# +AC_DEFUN([VL_LIB_READLINE], [ + AC_CACHE_CHECK([for a readline compatible library], + vl_cv_lib_readline, [ + ORIG_LIBS="$LIBS" + for readline_lib in readline edit editline; do + for termcap_lib in "" termcap curses ncurses; do + if test -z "$termcap_lib"; then + TRY_LIB="-l$readline_lib" + else + TRY_LIB="-l$readline_lib -l$termcap_lib" + fi + LIBS="$ORIG_LIBS $TRY_LIB" + AC_TRY_LINK_FUNC(readline, vl_cv_lib_readline="$TRY_LIB") + if test -n "$vl_cv_lib_readline"; then + break + fi + done + if test -n "$vl_cv_lib_readline"; then + break + fi + done + if test -z "$vl_cv_lib_readline"; then + vl_cv_lib_readline="no" + LIBS="$ORIG_LIBS" + fi + ]) + + if test "$vl_cv_lib_readline" != "no"; then + AC_DEFINE(HAVE_LIBREADLINE, 1, + [Define if you have a readline compatible library]) + AC_CHECK_HEADERS(readline/readline.h) + AC_CHECK_HEADERS(readline.h) + AC_CACHE_CHECK([whether readline supports history], + vl_cv_lib_readline_history, [ + vl_cv_lib_readline_history="no" + AC_TRY_LINK_FUNC(add_history, vl_cv_lib_readline_history="yes") + ]) + if test "$vl_cv_lib_readline_history" = "yes"; then + AC_DEFINE(HAVE_READLINE_HISTORY, 1, + [Define if your readline library has \`add_history']) + AC_CHECK_HEADERS(history.h readline/history.h) + fi + fi +])dnl + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..07efcc6 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,7016 @@ +# generated automatically by aclocal 1.9.5 -*- 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. + +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- + +# serial 47 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_LINKER_BOILERPLATE + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 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 +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[_LT_AC_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null 2>&1 && unset CDPATH + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +#- set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [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]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +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 $CC]) + 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. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname 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(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_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 `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/${ac_tool_prefix}nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_builddir and top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, lt_dlinit, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + +# _LT_AC_PROG_CXXCPP +# --------------- +AC_DEFUN([_LT_AC_PROG_CXXCPP], +[ +AC_REQUIRE([AC_PROG_CXX]) +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +fi +])# _LT_AC_PROG_CXXCPP + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + 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 + exp_sym_flag='-Bexport' + no_entry_flag="" + 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 + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[[12]]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC*) + # Portland Group C++ compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; + osf3*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e 1s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDGIRSTW]]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDRT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC*) + # Portland Group C++ compiler. + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $cc_basename in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + unicos*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) + 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 + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=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't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=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 + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + 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 + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi[[45]]*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + 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. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu | dragonfly*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_MSG_RESULT([$SED]) +]) + +# 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.5])]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# 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([acinclude.m4]) diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..f65c67b --- /dev/null +++ b/bootstrap @@ -0,0 +1,9 @@ +#!/bin/sh + +set -x +aclocal +autoheader +automake --add-missing --copy +autoconf +set +x + diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..c57401e --- /dev/null +++ b/config.h.in @@ -0,0 +1,150 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +#undef HAVE_DOPRNT + +/* Define to 1 if you have the header file. */ +#undef HAVE_HISTORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define if you have a readline compatible library */ +#undef HAVE_LIBREADLINE + +/* Define to 1 if you have the `z' library (-lz). */ +#undef HAVE_LIBZ + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Set to one if lxt library should be used */ +#undef HAVE_LXT + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the `pow' function. */ +#undef HAVE_POW + +/* Define to 1 if you have the header file. */ +#undef HAVE_READLINE_H + +/* Define if your readline library has \`add_history' */ +#undef HAVE_READLINE_HISTORY + +/* Define to 1 if you have the header file. */ +#undef HAVE_READLINE_HISTORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_READLINE_READLINE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDARG_H + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_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 `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* 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 `strrchr' function. */ +#undef HAVE_STRRCHR + +/* 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_UNISTD_H + +/* Define to 1 if you have the `vfscanf' function. */ +#undef HAVE_VFSCANF + +/* Define to 1 if you have the `vprintf' function. */ +#undef HAVE_VPRINTF + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* 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 as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* 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 rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to `unsigned' if does not define. */ +#undef size_t diff --git a/config/compile b/config/compile new file mode 100755 index 0000000..ad57e2f --- /dev/null +++ b/config/compile @@ -0,0 +1,142 @@ +#! /bin/sh +# Wrapper for compilers which do not understand `-c -o'. + +scriptversion=2005-02-03.08 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 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. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand `-c -o'. +Remove `-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file `INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; +esac + +ofile= +cfile= +eat= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we strip `-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no `-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # `.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` + +# Create the lock directory. +# Note: use `[/.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/config/config.guess b/config/config.guess new file mode 100755 index 0000000..2fc3acc --- /dev/null +++ b/config/config.guess @@ -0,0 +1,1411 @@ +#! /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-06-17' + +# 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) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ;' + +# 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 + +## for Red Hat Linux +if test -f /etc/redhat-release ; then + VENDOR=redhat ; +else + VENDOR= ; +fi + +# 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*:OpenVMS:*:*) + echo alpha-hp-vms + 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:4.0:6*) + echo sparc-icl-nx6 + 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*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + 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 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR:-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-${VENDOR:-unknown}-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-${VENDOR:-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}-${VENDOR:-ibm}-linux-gnu + exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + 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-${VENDOR:-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}-${VENDOR:-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 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + 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/config/config.sub b/config/config.sub new file mode 100755 index 0000000..6b2ff9f --- /dev/null +++ b/config/config.sub @@ -0,0 +1,1500 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-06-18' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# 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. + +# Please send patches to . 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 \ + | c4x | 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 \ + | s390 | s390x \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | 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-* \ + | s390-* | s390x-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv8-* | 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 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + 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 | sparcv8 | 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* | -nx6 | -nx7 | -sei*) + # 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 + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + 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/config/depcomp b/config/depcomp new file mode 100755 index 0000000..ffcd540 --- /dev/null +++ b/config/depcomp @@ -0,0 +1,529 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2005-02-09.22 + +# Copyright (C) 1999, 2000, 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., 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 . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -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. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # 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) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mecanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/config/install-sh b/config/install-sh new file mode 100755 index 0000000..1a83534 --- /dev/null +++ b/config/install-sh @@ -0,0 +1,323 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2005-02-02.21 + +# 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}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -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 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit 1; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit 0 +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/config/ltmain.sh b/config/ltmain.sh new file mode 100755 index 0000000..bc48901 --- /dev/null +++ b/config/ltmain.sh @@ -0,0 +1,6500 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION=1.5.18 +TIMESTAMP=" (1.1220.2.246 2005/05/16 10:00:18)" + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +quote_scanset='[[~#^*{};<>?'"'"' ]' + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` + if test "X$win32_nmres" = "Ximport" ; then + win32_libid_type="x86 archive import" + else + win32_libid_type="x86 archive static" + fi + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$my_xdir"; then + exit $status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} +# End of Shell function definitions +##################################### + +# Darwin sucks +eval std_shrext=\"$shrext_cmds\" + +# Parse our command line options once, thoroughly. +while test "$#" -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2005 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $? + ;; + + --config) + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" + done + exit $? + ;; + + --debug) + $echo "$progname: enabling shell trace mode" + set -x + preserve_args="$preserve_args $arg" + ;; + + --dry-run | -n) + run=: + ;; + + --features) + $echo "host: $host" + if test "$build_libtool_libs" = yes; then + $echo "enable shared libraries" + else + $echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + $echo "enable static libraries" + else + $echo "disable static libraries" + fi + exit $? + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) prevopt="--tag" prev=tag ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE +fi + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 + case $nonopt in + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + + for arg + do + case "$arg_mode" in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit $EXIT_FAILURE + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + lastarg="\"$lastarg\"" + ;; + esac + + base_compile="$base_compile $lastarg" + done # for arg + + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $EXIT_FAILURE + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit $EXIT_FAILURE + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qlibobj="\"$qlibobj\"" ;; + esac + if test "X$libobj" != "X$qlibobj"; then + $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + exit $EXIT_FAILURE + fi + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$progpath" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + $echo "$srcfile" > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qsrcfile="\"$qsrcfile\"" ;; + esac + + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit $EXIT_FAILURE + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit $EXIT_FAILURE + fi + arg=$save_arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + darwin_framework) + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit $EXIT_FAILURE + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=darwin_framework + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit $EXIT_FAILURE + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-mingw* | *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" + continue + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*) + + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + if test "$with_gcc" = "yes" ; then + compiler_flags="$compiler_flags $arg" + fi + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + arg="\"$arg\"" + ;; + esac + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test "$status" -ne 0 && test ! -d "$output_objdir"; then + exit $status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." + else + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit $EXIT_FAILURE + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$extract_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$old_archive_from_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5* ) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit $EXIT_FAILURE + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="$absdir/$objdir" + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="$absdir" + fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, + # but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit $EXIT_FAILURE + else + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + major=`expr $current - $age + 1` + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` + deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for file magic test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo + if test "X$deplibs_check_method" = "Xnone"; then + $echo "*** Warning: inter-library dependencies are not supported in this platform." + else + $echo "*** Warning: inter-library dependencies are not known to be supported." + fi + $echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$output_la-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadable object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit $EXIT_FAILURE + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $run $rm $export_symbols + $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + $echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ +const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + cwrappersource=`$echo ${objdir}/lt-${outputname}.c` + cwrapper=`$echo ${output}.exe` + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +#define DIR_SEPARATOR '/' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +#define HAVE_DOS_BASED_FILE_SYSTEM +#ifndef DIR_SEPARATOR_2 +#define DIR_SEPARATOR_2 '\\' +#endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +char * basename (const char *name); +char * fnqualify(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup ((char *) basename (argv[0])); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = fnqualify(argv[0]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +char * +basename (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha (name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return (char *) base; +} + +char * +fnqualify(const char *path) +{ + size_t size; + char *p; + char tmp[LT_PATHMAX + 1]; + + assert(path != NULL); + + /* Is it qualified already? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha (path[0]) && path[1] == ':') + return xstrdup (path); +#endif + if (IS_DIR_SEPARATOR (path[0])) + return xstrdup (path); + + /* prepend the current directory */ + /* doesn't handle '~' */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ + p = XMALLOC(char, size); + sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); + return p; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + $echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit $EXIT_FAILURE + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + $echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit $EXIT_FAILURE + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit $EXIT_FAILURE + fi +fi\ +" + chmod +x $output + fi + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + + eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + eval cmd=\"$cmd\" + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit $EXIT_SUCCESS + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit $EXIT_FAILURE + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + cmds=$postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac + # If there is no directory component, then add one. + case $file in + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit $EXIT_FAILURE + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac + # If there is no directory component, then add one. + case $file in + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + save_umask=`umask` + umask 0077 + if $mkdir "$tmpdir"; then + umask $save_umask + else + umask $save_umask + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyways + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$old_striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + cmds=$old_postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + cmds=$finish_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit $EXIT_SUCCESS + + $echo "----------------------------------------------------------------------" + $echo "Libraries have been installed in:" + for libdir in $libdirs; do + $echo " $libdir" + done + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" + fi + if test -n "$runpath_var"; then + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "----------------------------------------------------------------------" + exit $EXIT_SUCCESS + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit $EXIT_FAILURE + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit $EXIT_FAILURE + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit $EXIT_SUCCESS + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + + if test "$mode" = uninstall; then + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + cmds=$postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + cmds=$old_postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + fi + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit $EXIT_FAILURE +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE. + +Report bugs to ." + exit $EXIT_SUCCESS + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; +esac + +$echo +$echo "Try \`$modename --help' for more information about other modes." + +exit $? + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/config/missing b/config/missing new file mode 100755 index 0000000..09edd88 --- /dev/null +++ b/config/missing @@ -0,0 +1,357 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2005-02-08.22 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# 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 + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + 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] + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n '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' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -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 $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -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) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n '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) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/config/ylwrap b/config/ylwrap new file mode 100755 index 0000000..10e4368 --- /dev/null +++ b/config/ylwrap @@ -0,0 +1,222 @@ +#! /bin/sh +# ylwrap - wrapper for lex/yacc invocations. + +scriptversion=2005-02-02.22 + +# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 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. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case "$1" in + '') + echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 + exit 1 + ;; + --basedir) + basedir=$2 + shift 2 + ;; + -h|--h*) + cat <<\EOF +Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... + +Wrapper for lex/yacc invocations, renaming files as desired. + + INPUT is the input file + OUTPUT is one file PROG generates + DESIRED is the file we actually want instead of OUTPUT + PROGRAM is program to run + ARGS are passed to PROG + +Any number of OUTPUT,DESIRED pairs may be used. + +Report bugs to . +EOF + exit $? + ;; + -v|--v*) + echo "ylwrap $scriptversion" + exit $? + ;; +esac + + +# The input. +input="$1" +shift +case "$input" in + [\\/]* | ?:[\\/]*) + # Absolute path; do nothing. + ;; + *) + # Relative path. Make it absolute. + input="`pwd`/$input" + ;; +esac + +pairlist= +while test "$#" -ne 0; do + if test "$1" = "--"; then + shift + break + fi + pairlist="$pairlist $1" + shift +done + +# The program to run. +prog="$1" +shift +# Make any relative path in $prog absolute. +case "$prog" in + [\\/]* | ?:[\\/]*) ;; + *[\\/]*) prog="`pwd`/$prog" ;; +esac + +# FIXME: add hostname here for parallel makes that run commands on +# other machines. But that might take us over the 14-char limit. +dirname=ylwrap$$ +trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 +mkdir $dirname || exit 1 + +cd $dirname + +case $# in + 0) $prog "$input" ;; + *) $prog "$@" "$input" ;; +esac +ret=$? + +if test $ret -eq 0; then + set X $pairlist + shift + first=yes + # Since DOS filename conventions don't allow two dots, + # the DOS version of Bison writes out y_tab.c instead of y.tab.c + # and y_tab.h instead of y.tab.h. Test to see if this is the case. + y_tab_nodot="no" + if test -f y_tab.c || test -f y_tab.h; then + y_tab_nodot="yes" + fi + + # The directory holding the input. + input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` + # Quote $INPUT_DIR so we can use it in a regexp. + # FIXME: really we should care about more than `.' and `\'. + input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` + + while test "$#" -ne 0; do + from="$1" + # Handle y_tab.c and y_tab.h output by DOS + if test $y_tab_nodot = "yes"; then + if test $from = "y.tab.c"; then + from="y_tab.c" + else + if test $from = "y.tab.h"; then + from="y_tab.h" + fi + fi + fi + if test -f "$from"; then + # If $2 is an absolute path name, then just use that, + # otherwise prepend `../'. + case "$2" in + [\\/]* | ?:[\\/]*) target="$2";; + *) target="../$2";; + esac + + # We do not want to overwrite a header file if it hasn't + # changed. This avoid useless recompilations. However the + # parser itself (the first file) should always be updated, + # because it is the destination of the .y.c rule in the + # Makefile. Divert the output of all other files to a temporary + # file so we can compare them to existing versions. + if test $first = no; then + realtarget="$target" + target="tmp-`echo $target | sed s/.*[\\/]//g`" + fi + # Edit out `#line' or `#' directives. + # + # We don't want the resulting debug information to point at + # an absolute srcdir; it is better for it to just mention the + # .y file with no path. + # + # We want to use the real output file name, not yy.lex.c for + # instance. + # + # We want the include guards to be adjusted too. + FROM=`echo "$from" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + TARGET=`echo "$2" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + + sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \ + -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$? + + # Check whether header files must be updated. + if test $first = no; then + if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then + echo "$2" is unchanged + rm -f "$target" + else + echo updating "$2" + mv -f "$target" "$realtarget" + fi + fi + else + # A missing file is only an error for the first file. This + # is a blatant hack to let us support using "yacc -d". If -d + # is not specified, we don't want an error when the header + # file is "missing". + if test $first = yes; then + ret=1 + fi + fi + shift + shift + first=no + done +else + ret=$? +fi + +# Remove the directory. +cd .. +rm -rf $dirname + +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000..01a3a68 --- /dev/null +++ b/configure @@ -0,0 +1,23856 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59 for veriwell 2.8.2. +# +# 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 + + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null 2>&1 && unset CDPATH + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + +tagnames=${tagnames+${tagnames},}CXX + +tagnames=${tagnames+${tagnames},}F77 + +# 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='veriwell' +PACKAGE_TARNAME='veriwell' +PACKAGE_VERSION='2.8.2' +PACKAGE_STRING='veriwell 2.8.2' +PACKAGE_BUGREPORT='' + +# 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 install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL XGPERF YACC LIBOBJS USE_LXT_TRUE USE_LXT_FALSE 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_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_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_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_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP +ac_env_CXXCPP_set=${CXXCPP+set} +ac_env_CXXCPP_value=$CXXCPP +ac_cv_env_CXXCPP_set=${CXXCPP+set} +ac_cv_env_CXXCPP_value=$CXXCPP +ac_env_F77_set=${F77+set} +ac_env_F77_value=$F77 +ac_cv_env_F77_set=${F77+set} +ac_cv_env_F77_value=$F77 +ac_env_FFLAGS_set=${FFLAGS+set} +ac_env_FFLAGS_value=$FFLAGS +ac_cv_env_FFLAGS_set=${FFLAGS+set} +ac_cv_env_FFLAGS_value=$FFLAGS + +# +# 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 veriwell 2.8.2 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 veriwell 2.8.2:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-m32 compile in 32 bit modes (default is no) + --disable-lxt compile lxt pli routines (default is yes) + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-shared[=PKGS] + build shared libraries [default=yes] + --enable-static[=PKGS] + build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + +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-pic try to use only PIC/non-PIC objects [default=use + both] + --with-tags[=TAGS] + include additional configurations [automatic] + +Some influential environment variables: + CXX C++ compiler command + CXXFLAGS 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 + CC C compiler command + CFLAGS C compiler flags + CPP C preprocessor + CXXCPP C++ preprocessor + F77 Fortran 77 compiler command + FFLAGS Fortran 77 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. + +_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 +veriwell configure 2.8.2 +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 veriwell $as_me 2.8.2, 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + +ac_aux_dir= +for ac_dir in config $srcdir/config; 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 config $srcdir/config" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&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. + + ac_config_headers="$ac_config_headers config.h" + + +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='veriwell' + VERSION='2.8.2' + + +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 -' + + + + + + +# Check for user supplied arguments +echo "$as_me:$LINENO: checking use 32 bit compile" >&5 +echo $ECHO_N "checking use 32 bit compile... $ECHO_C" >&6 +# Check whether --enable-m32 or --disable-m32 was given. +if test "${enable_m32+set}" = set; then + enableval="$enable_m32" + ac_cv_enable_m32=yes +else + ac_cv_enable_m32=no +fi; +echo "$as_me:$LINENO: result: $ac_cv_enable_m32" >&5 +echo "${ECHO_T}$ac_cv_enable_m32" >&6 + +echo "$as_me:$LINENO: checking enable lxt support" >&5 +echo $ECHO_N "checking enable lxt support... $ECHO_C" >&6 +# Check whether --enable-lxt or --disable-lxt was given. +if test "${enable_lxt+set}" = set; then + enableval="$enable_lxt" + ac_cv_enable_lxt=no +else + ac_cv_enable_lxt=yes +fi; +echo "$as_me:$LINENO: result: $ac_cv_enable_lxt" >&5 +echo "${ECHO_T}$ac_cv_enable_lxt" >&6 + +# Checks for programs. +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); } + +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_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 +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 + + + + +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 + + +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 + + +# 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' + +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 + +if test X"$ac_cv_enable_m32" = Xyes +then + CFLAGS="$CFLAGS -m32" + CPPFLAGS="$CPPFLAGS -m32" + LDFLAGS="$LDFLAGS -m32" +fi +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi; + +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi; + +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +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/'` + + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done + +fi + +SED=$lt_cv_path_SED +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 + +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 + + + +# 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; +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 $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $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. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname 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 "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_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 `"$lt_cv_path_LD" -v 2>&1 &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 "${lt_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}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + +echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + +echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/${ac_tool_prefix}nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi +echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6 +NM="$lt_cv_path_NM" + +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 + +echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 +echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump'. + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | kfreebsd*-gnu | dragonfly*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + 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 + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 4316 "configure"' > conftest.$ac_ext + 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 + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + 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 + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat >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 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 + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext 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: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +esac + +need_locks="$enable_libtool_lock" + + +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 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 + + + +for ac_header in dlfcn.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 the veriwell lists. ## +## ----------------------------------- ## +_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 + + + +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + 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 +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 +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_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_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6 +ac_preproc_ok=false +for ac_cxx_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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_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 \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +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 + +fi + + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran + 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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # 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_F77="$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 +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran +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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 +echo "${ECHO_T}$ac_ct_F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_F77" && break +done + + F77=$ac_ct_F77 +fi + + +# Provide some information about the compiler. +echo "$as_me:5431:" \ + "checking for Fortran 77 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); } +rm -f a.out + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. (Note that this only needs to work for GNU compilers.) +ac_save_ext=$ac_ext +ac_ext=F +echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 +if test "${ac_cv_f77_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_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_f77_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_f77_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 +ac_ext=$ac_save_ext +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 +echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_f77_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + FFLAGS=-g +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_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_f77_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_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_f77_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 +echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-O2" + else + FFLAGS= + fi +fi + +G77=`test $ac_compiler_gnu = yes && echo yes` +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 + + + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# find the maximum length of command line arguments +echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 +else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +fi + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 +echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDGIRSTW]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris* | sysv5*) + symcode='[BDRT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + 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); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +if test "${lt_cv_objdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6 +objdir=$lt_cv_objdir + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" + 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_AR" && ac_cv_prog_ac_ct_AR="false" +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + AR=$ac_ct_AR +else + AR="$ac_cv_prog_AR" +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 + +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 + + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi; +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +lt_save_CC="$CC" +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 + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# +# Check for any special shared library compilation flags. +# +lt_prog_cc_shlib= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + lt_prog_cc_shlib='-belf' + ;; + esac +fi +if test -n "$lt_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 +if test "${lt_prog_compiler_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_prog_compiler_static" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works=yes + fi + else + lt_prog_compiler_static_works=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 + +if test x"$lt_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6529: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6533: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic='-qnocommon' + lt_prog_compiler_wl='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux*) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-static' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic='-Kpic' + lt_prog_compiler_static='-dn' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6791: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6795: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 + +if test x"$lt_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6853: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:6857: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag= + enable_shared_with_static_runtimes=no + archive_cmds= + archive_expsym_cmds= + old_archive_From_new_cmds= + old_archive_from_expsyms_cmds= + export_dynamic_flag_spec= + whole_archive_flag_spec= + thread_safe_flag_spec= + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + link_all_deplibs=unknown + hardcode_automatic=no + module_cmds= + module_expsym_cmds= + always_export_symbols=no + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + 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 + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + 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 + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + 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't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; 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 + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + 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 + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + 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 + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an empty executable. + 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 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + 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 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec=' ' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + 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=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + link_all_deplibs=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu | dragonfly*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + 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 + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + ia64*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + hardcode_shlibpath_var=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 + export_dynamic_flag_spec='${wl}-E' + + # 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*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld='-rpath $libdir' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6 +test "$ld_shlibs" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +echo "${ECHO_T}$archive_cmds_need_lc" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '#line 8239 "configure"' > conftest.$ac_ext + 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 + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var" || \ + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + 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 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+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 shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + 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_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $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 shl_load (); +int +main () +{ +shl_load (); + ; + 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=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_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+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 dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + 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_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=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_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $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 dld_link (); +int +main () +{ +dld_link (); + ; + 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=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_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# Report which librarie types wil actually be built +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler \ + CC \ + LD \ + lt_prog_compiler_wl \ + lt_prog_compiler_pic \ + lt_prog_compiler_static \ + lt_prog_compiler_no_builtin_flag \ + export_dynamic_flag_spec \ + thread_safe_flag_spec \ + whole_archive_flag_spec \ + enable_shared_with_static_runtimes \ + old_archive_cmds \ + old_archive_from_new_cmds \ + predep_objects \ + postdep_objects \ + predeps \ + postdeps \ + compiler_lib_search_path \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + exclude_expsyms \ + include_expsyms; do + + case $var in + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { echo "$as_me:$LINENO: creating $ofile" >&5 +echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" +#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e 1s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + +# Check whether --with-tags or --without-tags was given. +if test "${with_tags+set}" = set; then + withval="$with_tags" + tagnames="$withval" +fi; + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} + else + { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 +echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in + "") ;; + *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 +echo "$as_me: error: invalid tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 +echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} + { (exit 1); exit 1; }; } + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + 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 + + + + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_flag_spec_ld_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_automatic_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +compiler_CXX=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +else + lt_prog_compiler_no_builtin_flag_CXX= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + +# 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; +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 $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $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. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname 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 "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_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 `"$lt_cv_path_LD" -v 2>&1 &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 "${lt_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}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 +ld_shlibs_CXX=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + 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 + exp_sym_flag='-Bexport' + no_entry_flag="" + 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 + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + 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_CXX=yes + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty executable. + 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 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_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_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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + 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 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_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_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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_CXX=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX=' ' + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs_CXX=no + fi + ;; + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_CXX=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + ld_shlibs_CXX=no + ;; + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + gnu*) + ;; + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_CXX='+b $libdir' + hardcode_libdir_separator_CXX=: + ;; + ia64*) + hardcode_libdir_flag_spec_CXX='-L$libdir' + ;; + *) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + ;; + linux*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC*) + # Portland Group C++ compiler + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + openbsd*) + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; + osf3*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + sco*) + archive_cmds_need_lc_CXX=no + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + archive_cmds_need_lc_CXX=no + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; +esac +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +GCC_CXX="$GXX" +LD_CXX="$LD" + + +cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$rm -f confest.$objext + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + +lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_CXX='-qnocommon' + lt_prog_compiler_wl_CXX='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC*) + # Portland Group C++ compiler. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-static' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC*) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11460: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:11464: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 + +if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11522: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:11526: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_CXX=no + else + archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '#line 12037 "configure"' > conftest.$ac_ext + 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 + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || \ + test -n "$runpath_var_CXX" || \ + test "X$hardcode_automatic_CXX" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 +echo "${ECHO_T}$hardcode_action_CXX" >&6 + +if test "$hardcode_action_CXX" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + 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 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_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_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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+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 shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + 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_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_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_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $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 shl_load (); +int +main () +{ +shl_load (); + ; + 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_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_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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=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_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+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 dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + 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_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_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_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_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_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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_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_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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=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_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $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 dld_link (); +int +main () +{ +dld_link (); + ; + 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_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_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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=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_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_CXX \ + CC_CXX \ + LD_CXX \ + lt_prog_compiler_wl_CXX \ + lt_prog_compiler_pic_CXX \ + lt_prog_compiler_static_CXX \ + lt_prog_compiler_no_builtin_flag_CXX \ + export_dynamic_flag_spec_CXX \ + thread_safe_flag_spec_CXX \ + whole_archive_flag_spec_CXX \ + enable_shared_with_static_runtimes_CXX \ + old_archive_cmds_CXX \ + old_archive_from_new_cmds_CXX \ + predep_objects_CXX \ + postdep_objects_CXX \ + predeps_CXX \ + postdeps_CXX \ + compiler_lib_search_path_CXX \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_CXX + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_CXX +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_CXX + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_CXX" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld + + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + +archive_cmds_need_lc_F77=no +allow_undefined_flag_F77= +always_export_symbols_F77=no +archive_expsym_cmds_F77= +export_dynamic_flag_spec_F77= +hardcode_direct_F77=no +hardcode_libdir_flag_spec_F77= +hardcode_libdir_flag_spec_ld_F77= +hardcode_libdir_separator_F77= +hardcode_minus_L_F77=no +hardcode_automatic_F77=no +module_cmds_F77= +module_expsym_cmds_F77= +link_all_deplibs_F77=unknown +old_archive_cmds_F77=$old_archive_cmds +no_undefined_flag_F77= +whole_archive_flag_spec_F77= +enable_shared_with_static_runtimes_F77=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +objext_F77=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code=" subroutine t\n return\n end\n" + +# Code to be used in simple link tests +lt_simple_link_test_code=" program t\n end\n" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +compiler_F77=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +test "$ld_shlibs_F77" = no && can_build_shared=no + +GCC_F77="$G77" +LD_F77="$LD" + +lt_prog_compiler_wl_F77= +lt_prog_compiler_pic_F77= +lt_prog_compiler_static_F77= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_static_F77='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_F77=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_F77=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_F77='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + else + lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_F77='-qnocommon' + lt_prog_compiler_wl_F77='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux*) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-static' + ;; + pgcc* | pgf77* | pgf90*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-fpic' + lt_prog_compiler_static_F77='-static' + ;; + ccc*) + lt_prog_compiler_wl_F77='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_F77='-Kpic' + lt_prog_compiler_static_F77='-dn' + ;; + + solaris*) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_F77='-Qoption ld ';; + *) + lt_prog_compiler_wl_F77='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl_F77='-Qoption ld ' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_F77='-Kconform_pic' + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + unicos*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_can_build_shared_F77=no + ;; + + uts4*) + lt_prog_compiler_pic_F77='-pic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_F77"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13895: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:13899: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 + +if test x"$lt_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_F77=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13957: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:13961: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_F77=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_F77= + enable_shared_with_static_runtimes_F77=no + archive_cmds_F77= + archive_expsym_cmds_F77= + old_archive_From_new_cmds_F77= + old_archive_from_expsyms_cmds_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + thread_safe_flag_spec_F77= + hardcode_libdir_flag_spec_F77= + hardcode_libdir_flag_spec_ld_F77= + hardcode_libdir_separator_F77= + hardcode_direct_F77=no + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=unsupported + link_all_deplibs_F77=unknown + hardcode_automatic_F77=no + module_cmds_F77= + module_expsym_cmds_F77= + always_export_symbols_F77=no + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_F77= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + 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_F77=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=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't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs_F77=no + fi + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_F77=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + sunos4*) + archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + + if test "$ld_shlibs_F77" = no; then + runpath_var= + hardcode_libdir_flag_spec_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=yes + archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_F77=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_F77=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 + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + 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 + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + 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_F77=yes + else + # We have old collect2 + hardcode_direct_F77=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_F77=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_F77='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_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_f77_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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_F77="-z nodefs" + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_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_f77_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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_F77=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_F77=' ' + archive_cmds_need_lc_F77=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_F77=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_F77=-rdynamic + ;; + + 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_F77=' ' + allow_undefined_flag_F77=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_F77='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path_F77='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_F77=yes + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_F77=no + hardcode_direct_F77=no + hardcode_automatic_F77=yes + hardcode_shlibpath_var_F77=unsupported + whole_archive_flag_spec_F77='' + link_all_deplibs_F77=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_F77=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + freebsd1*) + ld_shlibs_F77=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu | dragonfly*) + archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_F77='+b $libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + ;; + ia64*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + *) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + link_all_deplibs_F77=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + allow_undefined_flag_F77=unsupported + archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_F77='-rpath $libdir' + fi + hardcode_libdir_separator_F77=: + ;; + + sco3.2v5*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_F77=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_shlibpath_var_F77=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + esac + link_all_deplibs_F77=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_F77='$CC -r -o $output$reload_objs' + hardcode_direct_F77=no + ;; + motorola) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv4.3*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_F77=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_F77='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv5*) + no_undefined_flag_F77=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_F77= + hardcode_shlibpath_var_F77=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + *) + ld_shlibs_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 +echo "${ECHO_T}$ld_shlibs_F77" >&6 +test "$ld_shlibs_F77" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_F77" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_F77=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_F77 in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_F77 + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_F77 + allow_undefined_flag_F77= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_F77=no + else + archive_cmds_need_lc_F77=yes + fi + allow_undefined_flag_F77=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '#line 15323 "configure"' > conftest.$ac_ext + 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 + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_F77= +if test -n "$hardcode_libdir_flag_spec_F77" || \ + test -n "$runpath_var_F77" || \ + test "X$hardcode_automatic_F77" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_F77" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && + test "$hardcode_minus_L_F77" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_F77=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_F77=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_F77=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 +echo "${ECHO_T}$hardcode_action_F77" >&6 + +if test "$hardcode_action_F77" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + 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 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_F77 \ + CC_F77 \ + LD_F77 \ + lt_prog_compiler_wl_F77 \ + lt_prog_compiler_pic_F77 \ + lt_prog_compiler_static_F77 \ + lt_prog_compiler_no_builtin_flag_F77 \ + export_dynamic_flag_spec_F77 \ + thread_safe_flag_spec_F77 \ + whole_archive_flag_spec_F77 \ + enable_shared_with_static_runtimes_F77 \ + old_archive_cmds_F77 \ + old_archive_from_new_cmds_F77 \ + predep_objects_F77 \ + postdep_objects_F77 \ + predeps_F77 \ + postdeps_F77 \ + compiler_lib_search_path_F77 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_F77 + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_F77 + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_F77 +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_F77 + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_F77 +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_F77 +archive_expsym_cmds=$lt_archive_expsym_cmds_F77 +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_F77 +module_expsym_cmds=$lt_module_expsym_cmds_F77 + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_F77 + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_F77 + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_F77 + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_F77 + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_F77 + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_F77 + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_F77 + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_F77 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_F77 + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_F77" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + + + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +objext_GCJ=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +compiler_GCJ=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +archive_cmds_need_lc_GCJ=no + +old_archive_cmds_GCJ=$old_archive_cmds + + +lt_prog_compiler_no_builtin_flag_GCJ= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16100: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:16104: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl_GCJ= +lt_prog_compiler_pic_GCJ= +lt_prog_compiler_static_GCJ= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_static_GCJ='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_GCJ=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_GCJ=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_GCJ='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + else + lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_GCJ='-qnocommon' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux*) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-static' + ;; + pgcc* | pgf77* | pgf90*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-fpic' + lt_prog_compiler_static_GCJ='-static' + ;; + ccc*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_GCJ='-Kpic' + lt_prog_compiler_static_GCJ='-dn' + ;; + + solaris*) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_GCJ='-Qoption ld ';; + *) + lt_prog_compiler_wl_GCJ='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl_GCJ='-Qoption ld ' + lt_prog_compiler_pic_GCJ='-PIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_GCJ='-Kconform_pic' + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + unicos*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_can_build_shared_GCJ=no + ;; + + uts4*) + lt_prog_compiler_pic_GCJ='-pic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_GCJ"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16362: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:16366: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 + +if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_GCJ=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16424: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:16428: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_GCJ=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_GCJ= + enable_shared_with_static_runtimes_GCJ=no + archive_cmds_GCJ= + archive_expsym_cmds_GCJ= + old_archive_From_new_cmds_GCJ= + old_archive_from_expsyms_cmds_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + thread_safe_flag_spec_GCJ= + hardcode_libdir_flag_spec_GCJ= + hardcode_libdir_flag_spec_ld_GCJ= + hardcode_libdir_separator_GCJ= + hardcode_direct_GCJ=no + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=unsupported + link_all_deplibs_GCJ=unknown + hardcode_automatic_GCJ=no + module_cmds_GCJ= + module_expsym_cmds_GCJ= + always_export_symbols_GCJ=no + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_GCJ= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + 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_GCJ=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=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't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs_GCJ=no + fi + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_GCJ=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + sunos4*) + archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + + if test "$ld_shlibs_GCJ" = no; then + runpath_var= + hardcode_libdir_flag_spec_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=yes + archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_GCJ=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_GCJ=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 + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + 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 + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + 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_GCJ=yes + else + # We have old collect2 + hardcode_direct_GCJ=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_GCJ=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_GCJ='-berok' + # Determine the default libpath from the value encoded in an empty executable. + 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 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_GCJ="-z nodefs" + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + 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 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_GCJ=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_GCJ=' ' + archive_cmds_need_lc_GCJ=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_GCJ=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_GCJ=-rdynamic + ;; + + 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_GCJ=' ' + allow_undefined_flag_GCJ=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_GCJ='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_GCJ=yes + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_GCJ=no + hardcode_direct_GCJ=no + hardcode_automatic_GCJ=yes + hardcode_shlibpath_var_GCJ=unsupported + whole_archive_flag_spec_GCJ='' + link_all_deplibs_GCJ=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_GCJ=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + freebsd1*) + ld_shlibs_GCJ=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu | dragonfly*) + archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + ;; + ia64*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + *) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + link_all_deplibs_GCJ=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + allow_undefined_flag_GCJ=unsupported + archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_GCJ='-rpath $libdir' + fi + hardcode_libdir_separator_GCJ=: + ;; + + sco3.2v5*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_GCJ=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_shlibpath_var_GCJ=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + esac + link_all_deplibs_GCJ=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_GCJ='$CC -r -o $output$reload_objs' + hardcode_direct_GCJ=no + ;; + motorola) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4.3*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_GCJ=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_GCJ='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv5*) + no_undefined_flag_GCJ=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_GCJ= + hardcode_shlibpath_var_GCJ=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + *) + ld_shlibs_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 +echo "${ECHO_T}$ld_shlibs_GCJ" >&6 +test "$ld_shlibs_GCJ" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_GCJ" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_GCJ=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_GCJ in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_GCJ + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ + allow_undefined_flag_GCJ= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_GCJ=no + else + archive_cmds_need_lc_GCJ=yes + fi + allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '#line 17810 "configure"' > conftest.$ac_ext + 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 + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_GCJ= +if test -n "$hardcode_libdir_flag_spec_GCJ" || \ + test -n "$runpath_var_GCJ" || \ + test "X$hardcode_automatic_GCJ" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_GCJ" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && + test "$hardcode_minus_L_GCJ" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_GCJ=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_GCJ=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_GCJ=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 +echo "${ECHO_T}$hardcode_action_GCJ" >&6 + +if test "$hardcode_action_GCJ" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + 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 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+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 shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + 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_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $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 shl_load (); +int +main () +{ +shl_load (); + ; + 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=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_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+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 dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + 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_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=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_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $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 dld_link (); +int +main () +{ +dld_link (); + ; + 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=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_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_GCJ \ + CC_GCJ \ + LD_GCJ \ + lt_prog_compiler_wl_GCJ \ + lt_prog_compiler_pic_GCJ \ + lt_prog_compiler_static_GCJ \ + lt_prog_compiler_no_builtin_flag_GCJ \ + export_dynamic_flag_spec_GCJ \ + thread_safe_flag_spec_GCJ \ + whole_archive_flag_spec_GCJ \ + enable_shared_with_static_runtimes_GCJ \ + old_archive_cmds_GCJ \ + old_archive_from_new_cmds_GCJ \ + predep_objects_GCJ \ + postdep_objects_GCJ \ + predeps_GCJ \ + postdeps_GCJ \ + compiler_lib_search_path_GCJ \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_GCJ + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_GCJ + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_GCJ + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_GCJ + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_GCJ +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_GCJ + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_GCJ +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_GCJ +archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_GCJ +module_expsym_cmds=$lt_module_expsym_cmds_GCJ + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_GCJ + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_GCJ + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_GCJ + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_GCJ + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_GCJ + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_GCJ + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_GCJ + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_GCJ + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_GCJ" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + RC) + + + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +objext_RC=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +compiler_RC=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + +lt_cv_prog_compiler_c_o_RC=yes + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_RC \ + CC_RC \ + LD_RC \ + lt_prog_compiler_wl_RC \ + lt_prog_compiler_pic_RC \ + lt_prog_compiler_static_RC \ + lt_prog_compiler_no_builtin_flag_RC \ + export_dynamic_flag_spec_RC \ + thread_safe_flag_spec_RC \ + whole_archive_flag_spec_RC \ + enable_shared_with_static_runtimes_RC \ + old_archive_cmds_RC \ + old_archive_from_new_cmds_RC \ + predep_objects_RC \ + postdep_objects_RC \ + predeps_RC \ + postdeps_RC \ + compiler_lib_search_path_RC \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_RC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_RC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_RC + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_RC + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_RC +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_RC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_RC +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_RC +archive_expsym_cmds=$lt_archive_expsym_cmds_RC +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_RC +module_expsym_cmds=$lt_module_expsym_cmds_RC + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_RC + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_RC + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_RC + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_RC + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_RC + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_RC + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_RC + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_RC + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_RC + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_RC + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_RC" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + ;; + + *) + { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 +echo "$as_me: error: Unsupported tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 +echo "$as_me: error: unable to update list of available tagged configurations." >&2;} + { (exit 1); exit 1; }; } + fi +fi + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + + + + + + + + + + + + + + + + + + + + + +for ac_prog in gperf +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_XGPERF+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$XGPERF"; then + ac_cv_prog_XGPERF="$XGPERF" # 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_XGPERF="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +XGPERF=$ac_cv_prog_XGPERF +if test -n "$XGPERF"; then + echo "$as_me:$LINENO: result: $XGPERF" >&5 +echo "${ECHO_T}$XGPERF" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$XGPERF" && break +done +test -n "$XGPERF" || XGPERF="none" + +if test "$XGPERF" = "none" +then + echo "" + echo "*** Warning: No suitable gperf found. ***" + echo " The gperf package is essential for building veriwell from" + echo " CVS sources, or modifying the parse engine of veriwell itself." + echo " You can get away without it when simply building from" + echo " snapshots or major releases." + echo "" +fi + +#AC_PROG_YACC +for ac_prog in bison +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="none" + +if test "$YACC" = "none" +then + echo "" + echo "*** Warning: No suitable bison found. ***" + echo " The bison package is essential for building veriwell from" + echo " CVS sources, or modifying the parse engine of veriwell itself." + echo " You can get away without it when simply building from" + echo " snapshots or major releases." + echo "" +fi + + + +# Checks for libraries. +echo "$as_me:$LINENO: checking for gzwrite in -lz" >&5 +echo $ECHO_N "checking for gzwrite in -lz... $ECHO_C" >&6 +if test "${ac_cv_lib_z_gzwrite+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $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 gzwrite (); +int +main () +{ +gzwrite (); + ; + 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_z_gzwrite=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_z_gzwrite=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_z_gzwrite" >&5 +echo "${ECHO_T}$ac_cv_lib_z_gzwrite" >&6 +if test $ac_cv_lib_z_gzwrite = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBZ +_ACEOF + +fi + +if test X"$ac_cv_enable_lxt" = Xyes; then + if test X"$ac_cv_lib_z_gzwrite" = Xno; then + echo "" + echo "*** Error: libz not found. lxt waveform dumping" + echo " cannot be built. Rerun configure with --disable-lxt." + echo "" + exit 1; + fi +fi + + + echo "$as_me:$LINENO: checking for a readline compatible library" >&5 +echo $ECHO_N "checking for a readline compatible library... $ECHO_C" >&6 +if test "${vl_cv_lib_readline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + ORIG_LIBS="$LIBS" + for readline_lib in readline edit editline; do + for termcap_lib in "" termcap curses ncurses; do + if test -z "$termcap_lib"; then + TRY_LIB="-l$readline_lib" + else + TRY_LIB="-l$readline_lib -l$termcap_lib" + fi + LIBS="$ORIG_LIBS $TRY_LIB" + 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 readline (); +int +main () +{ +readline (); + ; + 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 + vl_cv_lib_readline="$TRY_LIB" +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 -n "$vl_cv_lib_readline"; then + break + fi + done + if test -n "$vl_cv_lib_readline"; then + break + fi + done + if test -z "$vl_cv_lib_readline"; then + vl_cv_lib_readline="no" + LIBS="$ORIG_LIBS" + fi + +fi +echo "$as_me:$LINENO: result: $vl_cv_lib_readline" >&5 +echo "${ECHO_T}$vl_cv_lib_readline" >&6 + + if test "$vl_cv_lib_readline" != "no"; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBREADLINE 1 +_ACEOF + + +for ac_header in readline/readline.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 the veriwell lists. ## +## ----------------------------------- ## +_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 readline.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 the veriwell lists. ## +## ----------------------------------- ## +_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 whether readline supports history" >&5 +echo $ECHO_N "checking whether readline supports history... $ECHO_C" >&6 +if test "${vl_cv_lib_readline_history+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + vl_cv_lib_readline_history="no" + 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 add_history (); +int +main () +{ +add_history (); + ; + 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 + vl_cv_lib_readline_history="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 +echo "$as_me:$LINENO: result: $vl_cv_lib_readline_history" >&5 +echo "${ECHO_T}$vl_cv_lib_readline_history" >&6 + if test "$vl_cv_lib_readline_history" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_READLINE_HISTORY 1 +_ACEOF + + + +for ac_header in history.h readline/history.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 the veriwell lists. ## +## ----------------------------------- ## +_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 + + fi + fi + +if test ! "$HAVE_LIBREADLINE" = 1; then + case $LIBOBJS in + "readline.$ac_objext" | \ + *" readline.$ac_objext" | \ + "readline.$ac_objext "* | \ + *" readline.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS readline.$ac_objext" ;; +esac + +fi + +# Checks for header files. +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 + + + + + + + + +for ac_header in limits.h memory.h stddef.h stdlib.h stdarg.h string.h 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 the veriwell lists. ## +## ----------------------------------- ## +_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 + + +# Checks for typedefs, structures, and compiler characteristics. +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]; + +int +main () +{ + return !a + !b + !c + !d + !e + !f + !g + !h + !i; + ; + 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 + +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+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 () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#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_c_const=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + +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 + +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 +/* 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>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_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.err 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 time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+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 + +int +main () +{ +if ((struct tm *) 0) +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_header_time=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_time=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 +if test $ac_cv_header_time = yes; then + +cat >>confdefs.h <<\_ACEOF +#define TIME_WITH_SYS_TIME 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +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 () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#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 + # It does; now see whether it defined to BIG_ENDIAN or not. +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 () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#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_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + 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 + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +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 +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 () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_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_c_bigendian=no +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_c_bigendian=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + +# Checks for library functions. + +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 the veriwell lists. ## +## ----------------------------------- ## +_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 + + + +echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 +if test "${ac_cv_type_signal+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 +#ifdef signal +# undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int +main () +{ +int i; + ; + 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_signal=void +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_signal=int +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + + +for ac_func in vprintf +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 + +echo "$as_me:$LINENO: checking for _doprnt" >&5 +echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 +if test "${ac_cv_func__doprnt+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 _doprnt to an innocuous variant, in case declares _doprnt. + For example, HP-UX 11i declares gettimeofday. */ +#define _doprnt innocuous__doprnt + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char _doprnt (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef _doprnt + +/* 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 _doprnt (); +/* 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__doprnt) || defined (__stub____doprnt) +choke me +#else +char (*f) () = _doprnt; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != _doprnt; + ; + 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__doprnt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func__doprnt=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 +echo "${ECHO_T}$ac_cv_func__doprnt" >&6 +if test $ac_cv_func__doprnt = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DOPRNT 1 +_ACEOF + +fi + +fi +done + + + + + + + + +for ac_func in memmove memset pow strchr strdup strrchr +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_func in vfscanf +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 + + + + +# optional pli code + + +if test "$ac_cv_enable_lxt" = yes; then + USE_LXT_TRUE= + USE_LXT_FALSE='#' +else + USE_LXT_TRUE='#' + USE_LXT_FALSE= +fi + +if test "$ac_cv_enable_lxt" = yes +then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LXT 1 +_ACEOF + +fi + + ac_config_files="$ac_config_files Makefile replace/Makefile src/Makefile lxt/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__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 "${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 "${USE_LXT_TRUE}" && test -z "${USE_LXT_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"USE_LXT\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"USE_LXT\" 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 veriwell $as_me 2.8.2, 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="\\ +veriwell config.status 2.8.2 +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" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "replace/Makefile" ) CONFIG_FILES="$CONFIG_FILES replace/Makefile" ;; + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "lxt/Makefile" ) CONFIG_FILES="$CONFIG_FILES lxt/Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { 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,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;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,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t +s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;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,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;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,@EGREP@,$EGREP,;t t +s,@LN_S@,$LN_S,;t t +s,@ECHO@,$ECHO,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t +s,@CPP@,$CPP,;t t +s,@CXXCPP@,$CXXCPP,;t t +s,@F77@,$F77,;t t +s,@FFLAGS@,$FFLAGS,;t t +s,@ac_ct_F77@,$ac_ct_F77,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@XGPERF@,$XGPERF,;t t +s,@YACC@,$YACC,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@USE_LXT_TRUE@,$USE_LXT_TRUE,;t t +s,@USE_LXT_FALSE@,$USE_LXT_FALSE,;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 + + 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; }; } + # 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 + ;; + 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/configure.in b/configure.in new file mode 100644 index 0000000..9c6bef7 --- /dev/null +++ b/configure.in @@ -0,0 +1,107 @@ +AC_PREREQ(2.59) +AC_INIT(veriwell,2.8.2) +AC_CONFIG_AUX_DIR(config) +AC_CONFIG_HEADER([config.h]) + +AM_INIT_AUTOMAKE + +# Check for user supplied arguments +AC_MSG_CHECKING([use 32 bit compile]) +AC_ARG_ENABLE([m32],AC_HELP_STRING([--enable-m32], + [compile in 32 bit modes (default is no)]), + [ac_cv_enable_m32=yes], [ac_cv_enable_m32=no]) +AC_MSG_RESULT([$ac_cv_enable_m32]) + +AC_MSG_CHECKING([enable lxt support]) +AC_ARG_ENABLE([lxt],AC_HELP_STRING([--disable-lxt], + [compile lxt pli routines (default is yes)]), + [ac_cv_enable_lxt=no],ac_cv_enable_lxt=yes) +AC_MSG_RESULT([$ac_cv_enable_lxt]) + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_RANLIB +if test X"$ac_cv_enable_m32" = Xyes +then + CFLAGS="$CFLAGS -m32" + CPPFLAGS="$CPPFLAGS -m32" + LDFLAGS="$LDFLAGS -m32" +fi +AC_PROG_LIBTOOL + +AC_CHECK_PROGS([XGPERF],[gperf],[none]) +if test "$XGPERF" = "none" +then + echo "" + echo "*** Warning: No suitable gperf found. ***" + echo " The gperf package is essential for building veriwell from" + echo " CVS sources, or modifying the parse engine of veriwell itself." + echo " You can get away without it when simply building from" + echo " snapshots or major releases." + echo "" +fi + +#AC_PROG_YACC +AC_CHECK_PROGS([YACC],[bison],[none]) +if test "$YACC" = "none" +then + echo "" + echo "*** Warning: No suitable bison found. ***" + echo " The bison package is essential for building veriwell from" + echo " CVS sources, or modifying the parse engine of veriwell itself." + echo " You can get away without it when simply building from" + echo " snapshots or major releases." + echo "" +fi + + + +# Checks for libraries. +AC_CHECK_LIB([z], [gzwrite], [AC_DEFINE(HAVE_LIBZ,[], + [Define to 1 if you have the `z' library (-lz).])]) +if test X"$ac_cv_enable_lxt" = Xyes; then + if test X"$ac_cv_lib_z_gzwrite" = Xno; then + echo "" + echo "*** Error: libz not found. lxt waveform dumping" + echo " cannot be built. Rerun configure with --disable-lxt." + echo "" + exit 1; + fi +fi + +VL_LIB_READLINE +if test ! "$HAVE_LIBREADLINE" = 1; then + AC_LIBOBJ([readline]) +fi + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([limits.h memory.h stddef.h stdlib.h stdarg.h string.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIZE_T +AC_HEADER_TIME +AC_C_BIGENDIAN + +# Checks for library functions. +AC_FUNC_MALLOC +AC_TYPE_SIGNAL +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([memmove memset pow strchr strdup strrchr]) +AC_REPLACE_FUNCS([vfscanf]) + + +# optional pli code +AM_CONDITIONAL( [USE_LXT], [test "$ac_cv_enable_lxt" = yes]) +if test "$ac_cv_enable_lxt" = yes +then + AC_DEFINE([HAVE_LXT],1,[Set to one if lxt library should be used]) +fi + +AC_CONFIG_FILES([Makefile] [replace/Makefile] [src/Makefile] [lxt/Makefile]) +AC_OUTPUT diff --git a/lxt/LXT_Explained.html b/lxt/LXT_Explained.html new file mode 100644 index 0000000..9f23e41 --- /dev/null +++ b/lxt/LXT_Explained.html @@ -0,0 +1,790 @@ + + + + + + LXT Explained + + + LXT File Format:
+
+ This document will use lxt_write.h (as found in src/helpers) as its source for various constant + definitions.  The three most important values in an LXT(interLaced +eXtensible Trace) file are the following:
+
+ #define LT_HDRID (0x0138)
+ #define LT_VERSION (0x0001)
+ #define LT_TRLID (0xB4)

+
+ An LXT file starts with a two byte LT_HDRID with the two byte version + number LT_VERSION concatenated onto it.  The last byte in the file + is the LT_TRLID.  These five bytes are the only "absolutes" in an +LXT file.
+
+ 01 38 00 01 ...file body... B4
+
+ As one may guess from the example above, all integer values +represented in LXT files are stored in big endian order.
+
+ +

+ LXT  Section  Pointers:
+ Preceeding the trailing ID byte B4 is a series of tag bytes which +themselves are preceeded by 32-bit offsets into the file which indicate +where the sections pointed to by the tags are located.  The exception +is tag 00 (LT_SECTION_END) which indicates that no more tags/sections are +specified:
+
+ 00 ... offset_for_tag_2, tag_2, offset_for_tag_1, tag_1, + B4
+
+ Currently defined tags are:
+
+ #define LT_SECTION_END                  + (0)
+ #define LT_SECTION_CHG                  + (1)
+ #define LT_SECTION_SYNC_TABLE           + (2)
+ #define LT_SECTION_FACNAME              + (3)
+ #define LT_SECTION_FACNAME_GEOMETRY     (4)
+ #define LT_SECTION_TIMESCALE            + (5)
+ #define LT_SECTION_TIME_TABLE           + (6)
+ #define LT_SECTION_INITIAL_VALUE        + (7)
+ #define LT_SECTION_DOUBLE_TEST          + (8)
+ #define LT_SECTION_TIME_TABLE64         + (9)

+
+ Let's put this all together with an example:
+
+ The first tag encountered is 08 (LT_SECTION_DOUBLE_TEST) +at 339.  Its offset value indicates the position of the double sized +floating point comparison testword.  Thus, the section location for +the testword is at 0309 from the beginning of the file.
+
+ 00000300: XX XX XX XX XX XX XX XX XX 6e 86 1b f0 f9 21 09  + .........n....!.
+
00000310: 40 00 00 00 00 04 01 00 00 02 4b 02 00 00 00 be  + @.........K.....
+ 00000320: 03 00 00 01 4b 04 00 00 03 08 05 00 00 02 8b 06  ....K...........
+ 00000330: 00 00 03 07 07 00 00 03 09 08 b4 -- -- -- +-- --  ...........

+
+ The next tag encountered is 07 (LT_SECTION_INITIAL_VALUE) +at 334.  Its offset value indicates the position of the simulation initial + value. Even though this value is a single byte, its own section is defined. +  The reasoning behind this is that older versions of LXT readers would + be able to skip unknown sections without needing to know the size of the +section, how it functions, etc.
+
+ 00000300: XX XX XX XX XX XX XX XX XX 6e 86 1b f0 f9 21 09  + .........n....!.
+
00000310: 40 00 00 00 00 04 01 00 00 02 4b 02 00 00 00 be  + @.........K.....
+ 00000320: 03 00 00 01 4b 04 00 00 03 08 05 00 00 02 8b 06  ....K...........
+ 00000330: 00 00 03 07 07 00 00 03 09 08 b4 -- -- -- +-- --  ...........

+
+ The next tag encountered is 06 (LT_SECTION_TIME_TABLE) at +32F.  Its offset value (the underlined four byte number) indicates the +position of the time table which stores the time value vs positional offset +for the value change data.
+
+ 00000300: XX XX XX XX XX XX XX XX XX 6e 86 1b f0 f9 21 09  + .........n....!.
+
00000310: 40 00 00 00 00 04 01 00 00 02 4b 02 00 00 00 be  + @.........K.....
+ 00000320: 03 00 00 01 4b 04 00 00 03 08 05 00 00 02 8b +06   ....K...........
+ 00000330: 00 00 03 07 07 00 00 03 09 08 b4 -- -- -- -- --  ...........

+
+ The next tag encountered is 05 (LT_SECTION_TIMESCALE) at +32A.  Its offset value indicates the position of the timescale byte. + 
+
+ 00000300: XX XX XX XX XX XX XX XX XX 6e 86 1b f0 f9 21 09  + .........n....!.
+
00000310: 40 00 00 00 00 04 01 00 00 02 4b 02 00 00 00 be  + @.........K.....
+ 00000320: 03 00 00 01 4b 04 00 00 03 08 05 00 00 02 +8b 06  ....K...........
+ 00000330: 00 00 03 07 07 00 00 03 09 08 b4 -- -- -- -- --  ...........

+
+ The next tag encountered is 04 (LT_SECTION_FACNAME_GEOMETRY + ) at 325.  Its offset value indicates the geometry (array/msb/lsb/type/etc) + of the dumped facilities (signals) in the file.
+
+ 00000300: XX XX XX XX XX XX XX XX XX 6e 86 1b f0 f9 21 09  + .........n....!.
+
00000310: 40 00 00 00 00 04 01 00 00 02 4b 02 00 00 00 be  + @.........K.....
+ 00000320: 03 00 00 01 4b 04 00 00 03 08 05 00 00 02 +8b 06  ....K...........
+ 00000330: 00 00 03 07 07 00 00 03 09 08 b4 -- -- -- -- --  ...........

+
+ The next tag encountered is 03 (LT_SECTION_FACNAME) at 320. +  Its offset value indicates where the compressed facility names are +stored.
+
+ 00000300: XX XX XX XX XX XX XX XX XX 6e 86 1b f0 f9 21 09  + .........n....!.
+
00000310: 40 00 00 00 00 04 01 00 00 02 4b 02 00 00 +00 be   @.........K.....
+ 00000320: 03 00 00 01 4b 04 00 00 03 08 05 00 00 02 8b 06  + ....K...........
+ 00000330: 00 00 03 07 07 00 00 03 09 08 b4 -- -- -- -- --  ...........

+
+ The next tag encountered is 02 (LT_SECTION_SYNC_TABLE) at +31B.  Its offset value points to a table where the final value changes +for each facility may be found.
+
+ 00000300: XX XX XX XX XX XX XX XX XX 6e 86 1b f0 f9 21 09  + .........n....!.
+
00000310: 40 00 00 00 00 04 01 00 00 02 4b 02 + 00 00 00 be  @.........K.....
+ 00000320: 03 00 00 01 4b 04 00 00 03 08 05 00 00 02 8b 06  ....K...........
+ 00000330: 00 00 03 07 07 00 00 03 09 08 b4 -- -- -- -- --  ...........

+
+ The next tag encountered is 01 (LT_SECTION_CHG) at 316.  Its + offset value points to the actual value changes in the file.
+
+ 00000300: XX XX XX XX XX XX XX XX XX 6e 86 1b f0 f9 21 09  + .........n....!.
+
00000310: 40 00 00 00 00 04 01 00 00 02 4b +02 00 00 00 be  @.........K.....
+ 00000320: 03 00 00 01 4b 04 00 00 03 08 05 00 00 02 8b 06  ....K...........
+ 00000330: 00 00 03 07 07 00 00 03 09 08 b4 -- -- -- -- --  ...........

+
+ The final tag encountered is 00 at 311.  It signifies that there + are no more tags.
+
+ 00000300: XX XX XX XX XX XX XX XX XX 6e 86 1b f0 f9 21 09  + .........n....!.
+
00000310: 40 00 00 00 00 04 01 00 00 02 4b 02 00 00 + 00 be  @.........K.....
+ 00000320: 03 00 00 01 4b 04 00 00 03 08 05 00 00 02 8b 06  ....K...........
+ 00000330: 00 00 03 07 07 00 00 03 09 08 b4 -- -- -- -- --  ...........

+
+ Note that with the exception of the termination tag 00, tags may be + encountered in any order.  The fact that they are encountered in monotonically + decreasing order in the example above is an implementation detail of the + lxt_write dumper.  Code which processes LXT files should be able to + handle tags which appear in any order.  For tags which are defined +multiple times, it is to be assumed that the tag instance closest to the +termination tag is the one to be used unless each unique instantiation possesses +a special meaning.  Currently, repeated tags have no special semantics.
+
+ +

+ LXT Section  Definitions:
+
+ The body of each section (as currently defined) will now be explained +in detail.
+
+ +

+ 08: LT_SECTION_DOUBLE_TEST
+
+ This section is only present if double precision floating point data +is to be found in the file.  In order to resolve byte ordering issues +across various platforms, a rounded version of pi (3.14159) is stored +in eight consecutive bytes.  This value was picked because each of +its eight bytes are unique.  It is the responsibility of an LXT reader +to compare the byte ordering found in the LT_SECTION_DOUBLE_TEST section +to that of the same rounded version of pi as represented by reader's +processor.  By comparing the position on the host and in the file, +it may be determined how the values stored in the LXT file need to be rearranged. +The following bit of code shows one possible implementation for this:
+
+ static char double_mask[8]={0,0,0,0,0,0,0,0};
+ static char double_is_native=0;
+
+ static void create_double_endian_mask(double *pnt)
+ {
+ static double p = 3.14159;
+ double d;
+ int i, j;
+  
+ d= *pnt;
+ if(p==d)
+         {
+         double_is_native=1;
+         }
+         else
+         {
+         char *remote, *here;
+  
+         remote = (char *)&d;
+         here = (char *)&p;
+         for(i=0;i<8;i++)
+                 + {
+                 + for(j=0;j<8;j++)
+                         + {
+                         + if(here[i]==remote[j])
+                                 + {
+                                 + double_mask[i]=j;
+                                 + break;
+                                 + }
+                         + }
+                 + }
+         }
+ }

+
+ If double_is_native is zero, the following function will then + be needed to be called to rearrange the file byte ordering to match the +host every time a double is encountered in the value change data:
+
+ static char *swab_double_via_mask(double *d)
+ {
+ char swapbuf[8];
+ char *pnt = malloc(8*sizeof(char));
+ int i; 
+         
+ memcpy(swapbuf, (char *)d, 8);
+ for(i=0;i<8;i++)
+         {  
+         pnt[i]=swapbuf[double_mask[i]];
+         }
+
+ return(pnt);
+ }
+

+ +

+ 07: LT_SECTION_INITIAL_VALUE
+ This section is used as a "shortcut" representation to flash all facilities + in a dumpfile to a specific value at the initial time.  Permissible + values are '0', '1', 'Z', 'X', 'H', 'U', 'W', 'L', and '-' stored as the byte values 00 through + 08 in the LXT file.
+
+ +

+ 06: LT_SECTION_TIME_TABLE / 08: LT_SECTION_TIME_TABLE64
+
+ This section marks the time vs positional data for the LXT file.  It + is represented in the following format:
+
+ 4 bytes: number of entries (n)
+ 4 bytes: min time in dump (8 bytes for LT_SECTION_TIME_TABLE64)
+ 4 bytes: max time in dump (8 bytes for LT_SECTION_TIME_TABLE64)
+
+ n 4-byte positional delta entries follow
+ n 4-byte time delta entries follow (8 byte entries for LT_SECTION_TIME_TABLE64)
+
+ It is assumed that the delta values are represented as current_value + - previous_value, which means that deltas should always be positive. + In addition, the previous_value for delta number zero for both +position and time is zero.  This will allow for sanity checking between +the time table and the min/max time fields if it is so desired or if the min/max +fields are needed before the delta entries are traversed.
+
+ Example:
+
+ 00000005    5 entries are in the table
+ 00000000    Min time of simulation is 0
+ 00000004    Max time of simulation is 4.
+
+ 00000000    time[0]=0
+ 00000001    time[1]=1
+ 00000001    time[2]=2
+ 00000001    time[3]=3
+ 00000001    time[4]=4
+
+ 00000004    pos[0]=0x4
+ 00000010    pos[1]=0x14
+ 00000020    pos[2]=0x34
+ 00000002    pos[3]=0x36
+ 00000300    pos[4]=0x336
+
+ +

+  05: LT_SECTION_TIMESCALE
+ This section consists of a single signed byte.  Its value (x + ) is the exponent of a base-10 timescale.  Thus, each increment of + '1' in the time value table represented in the previous section represents + 10 x seconds.  Use -9 for nanoseconds, -12 for picoseconds, + etc.  Any eight-bit signed value (-128 to +127) is permissible, but +in actual practice only a handful are useful.
+
+ +

+ 03: LT_SECTION_FACNAME
+
+ No, section 04: LT_SECTION_FACNAME_GEOMETRY hasn't been forgotten.  It's + more logical to cover the facilities themselves before their geometries.
+
+ 4 bytes: number of facilities (n)
+ 4 bytes: amount of memory required in bytes for the decompressed facilities
+
+ n  compressed facilities follow, where a compressed facility + consists of two values:
+
+ 2 bytes: number of prefix bytes (min=0, max=65535)
+ zero terminated string: suffix bytes
+
+ An example should clarify things (prefix lengths are in bold):
+
+ 00000020: 00 00 00 04 00 00 00 1d 00 00 + 61 6c 70 68 61 00  ..........alpha.
+ 00000030: 00 01 70 70 6c 65 00 00 04 69 63 61 74 69 6f 6e  + ..pple...ication
+ 00000040: 00 00 00 7a 65 72 6f 00 00 00 00 01 00 00 00 00  +...zero.........

+
+ Four facilities (underlined) are defined and they occupy 0x0000001d bytes +(second underlined value).
+
+ This first prefix length is 0000 (offset 28).
+ The first suffix is "alpha", therefore the first facility is "alpha". + This requires six bytes.
+
+ The second prefix length is 0001 (offset 30).
+ The second suffix is "pple", therefore the second facility is "apple". + This requires six bytes.
+
+ The third prefix length is 0004 (offset 37).
+ The third suffix is "ication", therefore the third facility is "application". + This requires twelve bytes.
+
+ The fourth prefix length is 0000 (offset 41).
+ The fourth suffix is "zero", therefore the fourth facility is "zero". + This requires five bytes.
+
+6 + 6 + 12 + 5 = 29 which indeed is 0x1d.
+
+It is suggested that the facilities are dumped out in alphabetically sorted +order in order to increase the compression ratio of this section.
+
+ +

+ 04: LT_SECTION_FACNAME_GEOMETRY
+
+This section consists of a repeating series of sixteen byte entries.  Each +entry corresponds in order with a facility as defined in 03: LT_SECTION_FACNAME. + As such there is a 1:1 in-order correspondence between the two sections.
+
+ 4 bytes:    rows    (typically zero, +only used when defining arrays: this indicates the max row value+1)
+4 bytes:    msb
+4 bytes:    lsb
+4 bytes:    flags
+
+flags are defined as follows:
+
+ #define LT_SYM_F_BITS           + (0)
+ #define LT_SYM_F_INTEGER        +(1<<0)
+ #define LT_SYM_F_DOUBLE         + (1<<1)
+ #define LT_SYM_F_STRING         + (1<<2)
+ #define LT_SYM_F_ALIAS          + (1<<3)

+
+ When an LT_SYM_F_ALIAS is encountered, it indicates that the rows field +instead means "alias this to facility number rows", there the facility +number corresponds to the definition order in 03: LT_SECTION_FACNAME and +starts from zero.  
+
+ +

+
+02: LT_SECTION_SYNC_TABLE
+
+This section indicates where the final value change (as a four-byte offset +from the beginning of the file) for every facility is to be found.  Facilities +which do not change value contain a value of zero for their final value change.  +This section is necessary as value changes are stored as a linked list of +backward directed pointers.  There is a 1:1 in-order correspondence +between this section and the definitions found in LT_SECTION_FACNAME.
+
+4 bytes: final offset for facility (repeated for each facility in +order as they were defined)
+
+ +

+ 01: LT_SECTION_CHG
+
+This section is usually the largest section in a file as is composed of value +changes, however its structure is set up such that individual facilities +can be quickly accessed without the necessity of reading in the entire file. + In spite of this format, this does not prevent one from stepping through +the entire section backwards in order to process it in one pass.  The +method to achieve this will be described later.
+
+The final offset for a value change for a specific facility is found in 02: +LT_SECTION_SYNC_TABLE.  Since value changes for a facility are linked +together, one may follow pointers backward from the sync value offset for +a facility in order to read in an entire trace.  This is used to accelerate +sparse reads of an LXT file's change data such as those that a visualization +tool such as a wave viewer would perform. 
+
+The format for a value change is as follows:
+
+command_byte, delta_offset_of_previous_change[, [row_changed,] change_data +]
+
Command Bytes:
+
+The command_byte is broken into two (as currently defined) bitfields: +bits [5:4] contain a byte count (minus one) required for the delta_offset_of_previous_change + (thus a value from one to four bytes), and bits [3:0] contain the command +used to determine the format of the change data (if any change data is necessary +as dictated by the command byte).
+
+Bits [3:0] of the command_byte are defined as follows.  Note +that this portion of the command_byte is ignored for strings and doubles +and typically x0 is placed in the dumpfile in those cases:
+
+0    MVL_2 [or default (for datatype) value change +follows]
+1    MVL_4
+2    MVL_9
+3    flash whole value to 0s
+4    flash whole value to 1s
+5    flash whole value to Zs
+6    flash whole value to Xs
+7    flash whole value to Hs
+8    flash whole value to Us
+9    flash whole value to Ws
+A    flash whole value to Ls
+B    flash whole value to -s
+C    clock compress use 1 byte repeat count
+D    clock compress use 2 byte repeat count
+E    clock compress use 3 byte repeat count
+F    clock compress use 4 byte repeat count
+
+Commands x3-xB only make sense for MVL_2/4/9 (and integer in the case for x3 +and x4 when an integer is 0 or ~0) facilities.  They are provided as +a space saving device which obviates the need for dumping value change data +when all the bits in a facility are set to the same exact value.  For +single bit facilities, these commands suffice in all cases.
+
+Command x0 is used when change_data can be stored as MVL_2.  Bits +defined in MVL_2 are '0' and '1' and as such, one bit of storage in an LXT +file corresponds to one bit in the facility value.
+
+Command x1 is used when change_data can't be stored as MVL_2 but can +stored as MVL_4.  Bits defined in MVL_4 are '0', '1', 'Z', and +'X' are stored in an LXT file as the two-bit values 00, 01, 10, and 11.
+
+Command x2 is used when change_data can't be stored as either MVL_2 or MVL_4 +but can be stored as MVL_9.  Bits defined in MVL_9 are '0', '1', 'Z', +'X', 'H', 'U', 'W', 'L', and '-' corresponding to the four-bit values 0000 +through 1000.
+
+Commands xC-xF are used to repeat a clock.  It is assumed that at least two +clock phase changes are present before the current command.  Their time values +are subtracted in order to obtain a delta.  The delta is used as the change time +between future phase changes with respect to the time value of the previous command which is +used as a "base time" and "base value" for repeat_count+1 phase changes.
+

+Note that these repeat command nybbles also are applicable to multi-bit facilities which +are 32-bits or less and MVL_2 in nature. In this case, the preceeding two deltas are +subtracted such that a recurrence equation can reconstruct any specific item of the compressed data: +
+
+        unsigned int j   = item_in_series_to_create + 1;
+        unsigned int res = base + (j/2)*rle_delta[1] + ((j/2)+(j&1))*rle_delta[0];
+
+For a sequence of: 7B 7C 7D 7E 7F 80 81 82 ... +
+        base = 82
+        rle_delta[1] = 82 - 81 == 01
+        rle_delta[0] = 81 - 80 == 01
+
+Two deltas are used in order to handle the case where a vector which changes value by a constant XOR. In that case, +the rle_delta values will be different. In this way, one command encoding can handle both XOR and incrementer/decrementer +type compression ops. +
+
Delta Offsets:
+
+Delta offsets indicate where the preceeding change may be found with respect +to the beginning of the LXT file.  In order to calculate where the preceeding +change for a facility is, take the offset of the command_byte, subtract +the delta_offset_of_previous_change from it, then subtract 2 bytes +more.  As an example:
+
+00001000: 13 02 10 ...
+
+The command byte is 13.  Since bits [5:4] are "01", this means that +the delta_offset_of_previous_change is two bytes since 1 + 1 = 2.
+
+The next two bytes are 0210, so 1000 - 0210 - 2 = 0DEE.  Hence, the +preceeding value change can be found at 0DEE.  This process is to be +continued until a value change offset of 0 is obtained.  This is impossible +because of the existance of the LXT header bytes.
+
Row Changed:
+
+This field is only present in value changes for arrays.  The +value is 2, 3, or 4 bytes depending on the magnitude of the array size: greater +than 16777215 rows requires 4 bytes, greater than 65535 requires 3 bytes, +and so on down to one byte.  Note that any value type can be part of +an array.
+
Change Data:
+
+This is only present for command_bytes x0-x2 for MVL_2, MVL_4, and +MVL_9 data, and any command_byte for strings and doubles.  Strings +are stored in zero terminated format and doubles are stored as eight bytes +in machine-native format with 08: LT_SECTION_DOUBLE_TEST being used to resolve +possible differences in endianness on the machine reading the LXT file.
+
+Values are stored left justified in big endian order and unused bits are +zeroed out.  Examples with "_" used to represent the boundary between +consecutive bytes:
+
+MVL_2:    "0101010110101010" (16 bits) is stored as 01010101_10101010
+MVL_2:    "011" (3 bits) is stored as 01100000
+MVL_2:    "11111110011" (11 bits) is stored as 11111110_01100000
+
+MVL_4:    "01ZX01ZX" (8 bits) is stored as 00011011_00011011
+MVL_4:    "ZX1" (3 bits) is stored as 10110100
+MVL_4:    "XXXXZ" (5 bits) is stored as 11111111_10000000
+
+MVL_9:    "01XZHUWL-" (9 bits) is stored as 00000001_00100011_01000101_01100111_10000000 +
+
Correlating Time Values to Offsets:
+
+This is what the purpose of 06: LT_SECTION_TIME_TABLE is.  Given the +offset of a command_byte, bsearch(3) an array of ascending +position values (not deltas) and pick out the maximum position value which +is less than or equal to the offset of the command_byte.  The +following code sequence illustrates this given two arrays positional_information[] + and time_information[].  Note that total_cycles corresponds +to number_of_entries as defined in 06: LT_SECTION_TIME_TABLE.
+
+static int max_compare_time_tc, max_compare_pos_tc;
+static int compar_mvl_timechain(const void *s1, const void *s2)
+{ 
+int key, obj, delta;
+int rv;
+
+key=*((int *)s1);
+obj=*((int *)s2); 
+
+if((obj<=key)&&(obj>max_compare_time_tc))
+        {
+        max_compare_time_tc=obj;
+        max_compare_pos_tc=(int *)s2 - +positional_information;
+        }
+
+delta=key-obj;
+if(delta<0) rv=-1;
+else if(delta>0) rv=1;
+else rv=0;
+
+return(rv);
+}
+
+static int bsearch_position_versus_time(int key)
+{
+max_compare_time_tc=-1; max_compare_pos_tc=-1;
+
+bsearch((void *)&key, (void *)positional_information, total_cycles, sizeof(int), +compar_mvl_timechain);
+if((max_compare_pos_tc<=0)||(max_compare_time_tc<0))
+        {
+        max_compare_pos_tc=0; /* aix bsearch +fix */
+        }
+
+return(time_information[max_compare_pos_tc]);
+}

+
Reading All Value Changes in One Pass:
+
+This requires a little bit more work but it can be done.  Basically +what you have to do is the following: +
    +
  1. Read in all the sync offsets from 02: LT_SECTION_SYNC_TABLE and put +each in a structure which contains the sync offset and the facility index. + All of these structures will compose an array that is as large as the +number of facilities which exist.
  2. +
  3. Heapify the array such that the topmost element of the heap has the +largest positional offset.
  4. +
  5. Change the topmost element's offset to its preceeding offset (as determined +by examining the command_byte, bits [5:4] and calculating the preceeding +offset by subtracting the delta_offset_of_previous_change then subtracting +2 bytes.
  6. +
  7. Continue with step 2 until the topmost element's offset is zero after +performing a heapify().
    +
  8. +
+

+00: LT_SECTION_END
+
+As a section pointer doesn't exist for this, there's no section body either.
+

+The lxt_write API:
+
+In order to facilitate the writing of LXT files, an API has been provided +which does most of the hard work.  
+
+
struct lt_trace *lt_init(const char +*name)
+
+
+
This opens an LXT file.  The pointer returned by this function +is NULL if unsuccessful.  If successful, the pointer is to be used as +a "context" for all the remaining functions in the API.  In this way, +multiple LXT files may be generated at once.
+
+
+
void lt_close(struct lt_trace *lt)
+
+
+
This fixates and closes an LXT file.  This is extremely important +because if the file is not fixated, it will be impossible to use the value +change data in it!  For this reason, it is recommended that the function +be placed in an atexit(3) handler in environments where trace generation +can be interrupted through program crashes or external signals such as control-C.
+
+

+
+
struct lt_symbol *lt_symbol_add(struct lt_trace + *lt, const char *name,
+unsigned int rows, int msb, int lsb, int flags)

+
+
+This creates a facility.  Since the facility and related tables are +written out during fixation, one may arbitrarily add facilities up until +the very moment that lt_close() is called.  For facilities which are +not arrays, a value of 0 or 1 for rows.  As such, only values 2 and +greater are used to signify arrays.  Flags are defined above as in 04: +LT_SECTION_FACNAME_GEOMETRY.
+

+
+
struct lt_symbol *lt_symbol_find(struct lt_trace + *lt, const char *name)
+
+
+
This finds if a symbol has been previously defined.  If returns +non-NULL on success.  It actually returns a symbol pointer, but you +shouldn't be deferencing the fields inside it unless you know what you are +doing. +

+
+
struct lt_symbol *lt_symbol_alias(struct lt_trace +*lt, const char *existing_name,
+const char *alias, int msb, int lsb)

+
+
+
This assigns an alias to an existing facility.  This is to create +signals which traverse multiple levels of hierarchy, but are the same net, +possibly with different MSB and LSB values (though the distance between them +will be the same).
+
+

+
+
void lt_symbol_bracket_stripping(struct lt_trace +*lt, int doit)
+
+
+
This is to be used when facilities are defined in Verilog format such +that exploded bitvectors are dumped as x[0], x[1], x[2], etc.  If doit +is set to a nonzero value, the bracketed values will be stripped off.  In +order to keep visualization and other tools from becoming confused, the MSB/LSB +values must be unique for every bit.  The tool vcd2lxt shows +how this works and should be used.  If vectors are dumped atomically, +this function need not be called.
+
+

+
+
void lt_set_timescale(struct lt_trace *lt, int +timescale)
+
+
+
This sets the simulation timescale to 10timescale seconds +where timescale is an 8-bit signed value.  As such, negative values +are the only useful ones.
+

+
+
void lt_set_initial_value(struct lt_trace *lt, +char value)
+
+
+
This sets the initial value of every MVL (bitwise) facility to whatever +the value is.  Permissible values are '0', '1', 'Z', 'X', 'H', 'U', +'W', 'L', and '-'.
+
+
+int lt_set_time(struct lt_trace *lt, unsigned int timeval)
+int lt_inc_time_by_delta(struct lt_trace *lt, unsigned int timeval)
+int lt_set_time64(struct lt_trace *lt, lxttime_t timeval)
+int lt_inc_time_by_delta64(struct lt_trace *lt, lxttime_t timeval)
+
+
+
This is how time is dynamically updated in the LXT file.  Note +that for the non-delta functions, timeval changes are expected to be monotonically increasing.  In +addition, time values dumped to the LXT file are coalesced if there are no +value changes for a specific time value. (Note: lxttime_t is defined as an unsigned long long.) +
+
void lt_set_clock_compress(struct lt_trace *lt)
+
+
+
Enables clock compression heuristics for the current trace.  This cannot be turned off once it is on. +

+
+
int lt_emit_value_int(struct lt_trace *lt, struct +lt_symbol *s,
+unsigned int row, int value)

+
+
+
This dumps an MVL_2 value for a specific facility which is 32-bits or less.  Note that this +does not work for strings or doubles.
+
+

+
+
int lt_emit_value_double(struct lt_trace +*lt, struct lt_symbol *s,
+unsigned int row, double value)

+
+
+This dumps a double value for a specific facility.  Note that this only +works for doubles.
+

+
+
int lt_emit_value_string(struct lt_trace *lt, +struct lt_symbol *s,
+unsigned int row, char *value)

+
+
+This dumps a string value for a specific facility.  Note that this only +works for strings.
+

+
int lt_emit_value_bit_string(struct lt_trace *lt, +struct lt_symbol *s,
+unsigned int row, char *value)

+
+
This dumps an MVL_2, MVL_4, or MVL_9 value out to the LXT +file for a specific facility.  Note that the value is parsed in order +to determine how to optimally represent it in the file.  In addition, +note that if the value's string length is shorter than the facility length, +it will be left justified with the rightmost character will be propagated +to the right in order to pad the value string out to the correct length. + Therefore, "10x" for 8-bits becomes "10xxxxxx" and "z" for 8-bits becomes +"zzzzzzzz".
+
+
+ + + + diff --git a/lxt/Makefile.am b/lxt/Makefile.am new file mode 100644 index 0000000..2fb907f --- /dev/null +++ b/lxt/Makefile.am @@ -0,0 +1,9 @@ +lib_LTLIBRARIES = liblxt.la +liblxt_la_SOURCES = lxt.c lxt_write.c lxt_write.h +liblxt_la_LDFLAGS = -version-info 0:0:0 + +AM_CFLAGS = -I $(top_srcdir)/src + + +EXTRA_DIST = LXT_Explained.html test.v lxt.tab + diff --git a/lxt/Makefile.in b/lxt/Makefile.in new file mode 100644 index 0000000..495ebce --- /dev/null +++ b/lxt/Makefile.in @@ -0,0 +1,459 @@ +# Makefile.in generated by automake 1.9.5 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@ + +SOURCES = $(liblxt_la_SOURCES) + +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 = lxt +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +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)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +liblxt_la_LIBADD = +am_liblxt_la_OBJECTS = lxt.lo lxt_write.lo +liblxt_la_OBJECTS = $(am_liblxt_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(liblxt_la_SOURCES) +DIST_SOURCES = $(liblxt_la_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@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +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@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_LXT_FALSE = @USE_LXT_FALSE@ +USE_LXT_TRUE = @USE_LXT_TRUE@ +VERSION = @VERSION@ +XGPERF = @XGPERF@ +YACC = @YACC@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +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@ +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@ +lib_LTLIBRARIES = liblxt.la +liblxt_la_SOURCES = lxt.c lxt_write.c lxt_write.h +liblxt_la_LDFLAGS = -version-info 0:0:0 +AM_CFLAGS = -I $(top_srcdir)/src +EXTRA_DIST = LXT_Explained.html test.v lxt.tab +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lxt/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu lxt/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-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +liblxt.la: $(liblxt_la_OBJECTS) $(liblxt_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(liblxt_la_LDFLAGS) $(liblxt_la_OBJECTS) $(liblxt_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxt_write.Plo@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) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +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: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; 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 clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +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 \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + 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-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES + +# 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/lxt/lxt.c b/lxt/lxt.c new file mode 100644 index 0000000..ca424c2 --- /dev/null +++ b/lxt/lxt.c @@ -0,0 +1,758 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#define DEBUG 0 + +/***************************************************** + * + * lxt.c + * - pli interface routines to dump lxt files + * + ***************************************************** + */ +/* + * add this to veriuser.c + * { usertask, 0, lxt_recordvars, 0, lxt_recordvars, lxt_recordvars, "$lxt_recordvars" }, + * { usertask, 0, lxt_recordon, 0, lxt_recordon, lxt_recordon, "$lxt_recordon" }, + * { usertask, 0, lxt_recordoff, 0, lxt_recordoff, lxt_recordoff, "$lxt_recordoff" }, + * { usertask, 0, lxt_recordclose, 0, lxt_recordclose, lxt_recordclose, "$lxt_recordclose" }, + * { usertask, 0, lxt_recordfile, 0, lxt_recordfile, lxt_recordfile, "$lxt_recordfile" }, + * { usertask, 0, lxt_recordsetup, 0, lxt_recordsetup, lxt_recordsetup, "$lxt_recordsetup" }, + */ + +/* + * supported options: + * incsize=# + * sequence + * nosequence + * design=name + * depth=# + */ + + +struct info_s { + handle object; + char* name; + int sequence:1; + int event:1; + int real:1; + int pad:29; + struct info_s* next; + struct info_s* updateNext; + struct lt_symbol* symbol; +}; +typedef struct info_s info_t, *info_p; + + +/* + * global control structure + */ +struct lxt_s { + char* filename; + int enabled; + int sequence; + char* design; + unsigned incSize; + struct lt_trace* t; + int inited; + int depth; + info_p objectList; + info_p updateList; + info_p eventList; + int hunk; +}; +typedef struct lxt_s lxt_t, *lxt_p; +lxt_t lxt = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +static void lxt_close(); +static void lxt_enable( int on ); +static void lxt_option( char* str ); +static void lxt_add( handle object, int depth ); +static void lxt_init(); +static void lxt_dump( info_p info, int init ); +static int lxt_changed( p_vc_record vc_record ); +static void lxt_timemarker(); +static void lxt_timemarkerp1(); +static void lxt_nexttimemarker(); +static void lxt_incinit(); +static char* ginstance; + +/* ??? mdh - speed up variable dumping */ + +/************************************************* + lxt_recordvars + - add objects to be recorded + ************************************************/ +int lxt_recordvars( int data, int reason ) +{ + int update = 0; + int objects = 0; + int i; + acc_initialize(); + + switch( reason ) { + case reason_calltf: + break; + case reason_checktf: + goto DONE; + case reason_finish: + if( lxt.inited ) { + lxt_close(); + } + goto DONE; + case reason_rosynch: + update = (lxt.updateList != NULL); + while( lxt.updateList ) { + info_p info; + info = lxt.updateList; + lxt_dump( info, 0 ); + lxt.updateList = info->updateNext; + info->updateNext = 0; + } + if( update ) { + lxt_timemarkerp1(); + } + while( lxt.eventList ) { + info_p info; + info = lxt.eventList; + lxt_dump( info, 1 ); + lxt.eventList = info->updateNext; + info->updateNext = 0; + } + if( lxt.t->position > lxt.incSize ) { + lxt_incinit(); + } + lxt_nexttimemarker(); + goto DONE; + default: + goto DONE; + } + + ginstance = tf_getinstance(); + /* + * on first call, initialize structure + */ + if( !lxt.inited ) { + lxt_init(); + } + for( i = 1; i <= tf_nump(); ++i ) { + handle object; + if( tf_typep(i) == tf_nullparam ) { + continue; + } + if( tf_typep(i) == tf_string ) { + char* str = acc_fetch_tfarg_str(i); + lxt_option( str ); + continue; + } + object = acc_handle_tfarg(i); + if( !object ) { + tf_error( "cannot find object" ); + tf_dofinish(); + goto DONE; + } + lxt_add( object, lxt.depth ); + objects++; + } + if( objects == 0 ) { +#if DEBUG + io_printf( "lxt_recordvars: defaultpath=%s\n", + acc_fetch_fullname(acc_handle_parent(acc_handle_tfinst())), lxt.depth ); +#endif + lxt_add( acc_handle_parent(acc_handle_tfinst()), lxt.depth ); + } +DONE: + acc_close(); + return 0; +} + +/************************************************* + lxt_recordon + - enable recording + ************************************************/ +int lxt_recordon( int data, int reason ) +{ + acc_initialize(); + + switch( reason ) { + case reason_checktf: + if( tf_nump() != 0 ) { + tf_error( "too many arguments to recordon" ); + tf_dofinish(); + } + goto DONE; + case reason_calltf: + if( !lxt.inited ) { + tf_error( "recording has not started" ); + tf_dofinish(); + goto DONE; + } + break; + default: + goto DONE; + } + lxt_enable( 1 ); +DONE: + acc_close(); + return 0; +} + +/************************************************* + lxt_recordoff + - disable recording + ************************************************/ +int lxt_recordoff( int data, int reason ) +{ + acc_initialize(); + + switch( reason ) { + case reason_checktf: + if( tf_nump() != 0 ) { + tf_error( "too many arguments to recordoff" ); + tf_dofinish(); + } + goto DONE; + case reason_calltf: + if( !lxt.inited ) { + tf_error( "recording has not started" ); + tf_dofinish(); + goto DONE; + } + break; + default: + goto DONE; + } + lxt_enable( 0 ); +DONE: + acc_close(); + return 0; +} + +/************************************************* + lxt_recordclose + - close lxt file and stop recording + ************************************************/ +int lxt_recordclose( int data, int reason ) +{ + acc_initialize(); + + switch( reason ) { + case reason_checktf: + if( tf_nump() != 0 ) { + tf_error( "too many arguments to recordclose" ); + tf_dofinish(); + } + goto DONE; + case reason_calltf: + if( !lxt.inited ) { + tf_error( "recording has not started" ); + tf_dofinish(); + goto DONE; + } + break; + default: + goto DONE; + } + lxt_close(); +DONE: + acc_close(); + return 0; +} + +/************************************************* + lxt_recordfile + - specify lxt file and options + ************************************************/ +int lxt_recordfile( int data, int reason ) +{ + int i; + acc_initialize(); + + + switch( reason ) { + case reason_checktf: + if( tf_nump() == 0 ) { + tf_error( "not enough arguments to recordfile" ); + tf_dofinish(); + } + goto DONE; + case reason_calltf: + if( lxt.inited ) { + tf_error( "recording has already started" ); + tf_dofinish(); + goto DONE; + } + break; + default: + goto DONE; + } + lxt.filename = strdup( acc_fetch_tfarg_str(1) ); + for( i = 2; i <= tf_nump(); ++i ) { + lxt_option( acc_fetch_tfarg_str(i) ); + } +DONE: + acc_close(); + return 0; +} + +/************************************************* + lxt_recordsetup + - specify options + ************************************************/ +int lxt_recordsetup( int data, int reason ) +{ + int i; + acc_initialize(); + + switch( reason ) { + case reason_checktf: + if( tf_nump() == 0 ) { + tf_error( "not enough arguments to recordsetup" ); + tf_dofinish(); + } + goto DONE; + case reason_calltf: + if( lxt.inited ) { + tf_error( "recording has already started" ); + tf_dofinish(); + } + break; + default: + goto DONE; + } + for( i = 1; i <= tf_nump(); ++i ) { + lxt_option( acc_fetch_tfarg_str(i) ); + } +DONE: + acc_close(); + return 0; +} +/************************************************* + lxt_close + - close lxt file + ************************************************/ +static void lxt_close() +{ + lxt_timemarker(); +#if DEBUG + io_printf( "lxt_close: %p\n", lxt.t ); +#endif + lt_close( lxt.t ); + lxt.inited = 0; + if( lxt.filename ) { + free( lxt.filename ); + lxt.filename = 0; + } + if( lxt.design ) { + free( lxt.design ); + lxt.design = 0; + } + while( lxt.objectList ) { + info_p next; + next = lxt.objectList->next; + free( lxt.objectList->name ); + free( lxt.objectList ); + lxt.objectList = next; + } +} +/************************************************* + lxt_enable + - turn on/off variable change collection + ************************************************/ +static void lxt_enable( int on ) +{ + if( on == lxt.enabled ) { + return; + } + lxt.enabled = on; + if( on ) { + info_p info; + lxt_timemarker(); + for( info = lxt.objectList; info; info = info->next ) { + lxt_dump( info, 1 ); + } + } else { + info_p info; + lxt_timemarker(); + for( info = lxt.objectList; info; info = info->next ) { + if( !info->real ) { + lt_emit_value_bit_string( lxt.t, info->symbol, 0, "-" ); + } + } + } +} +/************************************************* + lxt_option + - set a option + ************************************************/ +static void lxt_option( char* str ) +{ + char* eq = index( str, '=' ); + int len = strlen( str ); + if( eq ) { + len -= strlen( eq ); + } else if( !strncmp( str, "incsize", len ) ) { + lxt.incSize = atoi( eq+1 ); + } else if( !strncmp( str, "sequence", len ) ) { + lxt.sequence = 1; + } else if( !strncmp( str, "nosequence", len ) ) { + lxt.sequence = 0; + } else if( !strncmp( str, "design", len ) ) { + lxt.design = strdup( eq+1 ); + } else if( !strncmp( str, "depth", len ) ) { + lxt.depth = atoi( eq+1 ); + } else { + tf_error( "option %s not supported", str ); + tf_dofinish(); + } +} +/************************************************* + lxt_add + - add object to file + ************************************************/ +static void lxt_add( handle object, int depth ) +{ + int real = 0; + int event = 0; + int flags; + int msb; + int lsb; + info_p info; + handle block; + handle term; + static int filter[] = { + accIntegerVar, + accNamedEvent, + accNet, + accRealVar, + accRegister, + accTimeVar, + 0 + }; + + switch( acc_fetch_type(object) ) { + case accNamedEvent: + flags = LT_SYM_F_BITS; + event = 1; + break; + case accRealVar: + flags = LT_SYM_F_DOUBLE; + real = 1; + break; + case accIntegerVar: + case accNet: + case accPort: + case accReg: + case accTimeVar: + case accParameter: + flags = LT_SYM_F_BITS; + break; + case accStatement: + case accTask: + case accModule: + term = null; + while(1) { + term = acc_next( filter, object, term ); + if( term == null ) { + break; + } + lxt_add( term, depth ); + } + if( depth == 1 ) { + return; + } + block = null; + while(1) { + block = acc_next_child( object, block ); + if( block == null ) { + break; + } + lxt_add( block, (depth==0) ? 0 : depth-1 ); + } + return; + default: + return; + } + info = (info_p)malloc( sizeof(info_t) ); + if( !info ) { + tf_error( "cannot allocate memory" ); + tf_dofinish(); + return; + } + info->object = object; + info->name = strdup( acc_fetch_fullname(object) ); + info->next = lxt.objectList; + lxt.objectList = info; + info->sequence = lxt.sequence; + info->event = event; + info->real = real; + info->updateNext = 0; + + if( real ) { + info->symbol = lt_symbol_add( lxt.t, info->name, 0, 0, 0, flags ); + } else if( event ) { + info->symbol = lt_symbol_add( lxt.t, info->name, 0, 0, 0, flags ); + } else { + acc_fetch_range( object, &msb, &lsb ); +#if DEBUG + io_printf( "lxt_add: %s [ %d : %d ]\n", + info->name, msb, lsb ); +#endif + info->symbol = lt_symbol_add( lxt.t, info->name, 0, msb, lsb, flags ); + } + lxt_dump( info, 1 ); + acc_vcl_add( object, lxt_changed, (char*)info, vcl_verilog_logic ); +#if DEBUG + io_printf( "lxt_recordvars: adding %p %s\n", info->symbol, info->name ); +#endif +} +/************************************************* + lxt_nexttimemarker + - record next time + ************************************************/ +static void lxt_nexttimemarker() +{ + int high; + int low; + lxttime_t time; + + tf_getnextlongtime( &low, &high ); + time = (((lxttime_t)(unsigned)high) << 32) + (unsigned)low; + lt_set_time64( lxt.t, time ); +#if DEBUG + io_printf( "lxt_nexttimemarker: %u %d\n", (unsigned)time, ftell(lxt.t->handle) ); +#endif +} +/************************************************* + lxt_timemarker + - record current time + ************************************************/ +static void lxt_timemarker() +{ + int high; + lxttime_t time; + + time = (unsigned)tf_igetlongtime( &high, ginstance ); + time += ((lxttime_t)(unsigned)high) << 32; + lt_set_time64( lxt.t, time ); +} +/************************************************* + lxt_timemarkerp1 + - record current time plus 1 tick + ************************************************/ +static void lxt_timemarkerp1() +{ + int high; + lxttime_t time; + + time = (unsigned)tf_igetlongtime( &high, ginstance ); + time += ((lxttime_t)(unsigned)high) << 32; + lt_set_time64( lxt.t, time+1 ); +} +/************************************************* + lxt_dump + - dump symbol value + ************************************************/ +static void lxt_dump( info_p info, int init ) +{ + if( info->real ) { + s_acc_value value; + value.format = accRealVal; + acc_fetch_value( info->object, "%%", &value ); + lt_emit_value_double( lxt.t, info->symbol, 0, value.value.real ); + } else if( info->event ) { + if( init ) { + lt_emit_value_bit_string( lxt.t, info->symbol, 0, "0" ); + } else { + lt_emit_value_bit_string( lxt.t, info->symbol, 0, "1" ); + info->updateNext = lxt.eventList; + lxt.eventList = info; + } + } else { + lt_emit_value_bit_string( lxt.t, info->symbol, 0, + acc_fetch_value( info->object, "%b", null ) ); +#if DEBUG + io_printf( "lxt_dump: %s %s\n", info->name, acc_fetch_value( info->object, + "%b", null ) ); +#endif + } +} +/************************************************* + lxt_changed + - record variable change + ************************************************/ +static int lxt_changed( p_vc_record vc_record ) +{ + info_p info = (info_p)vc_record->user_data; + if( !lxt.enabled ) { + return 0; + } + lxt_timemarker(); + if( info->sequence || info->event ) { + lxt_dump( info, 0 ); + } else { + if( !info->updateNext ) { + info->updateNext = lxt.updateList; + lxt.updateList = info; + } + } + tf_irosynchronize(ginstance); + return 0; +} +/************************************************* + lxt_init + - Open lxt file and enable collection + ************************************************/ +static void lxt_init() +{ + char* filename; + if( lxt.inited ) { + tf_error( "recording has alreay begun" ); + tf_dofinish(); + return; + } + if( lxt.filename ) { + filename = lxt.filename; + } else if( lxt.design ) { + filename = (char*)malloc( strlen(lxt.design)+4+1 ); + if( !filename ) { + tf_error( "could not allocate memory" ); + tf_dofinish(); + return; + } + sprintf( filename, "%s.lxt", lxt.design ); + lxt.filename = filename; + } else { + char* top = acc_fetch_name( acc_next_topmod(null) ); + filename = (char*)malloc( strlen(top)+3+1 ); + sprintf( filename, "%s.lxt", top ); + lxt.filename = filename; + } + lxt.t = lt_init( filename ); +#if DEBUG + io_printf( "lxt_init: %p\n", lxt.t ); +#endif + if( !lxt.t ) { + tf_error( "could not create file '%s'", filename ); + tf_dofinish(); + return; + } + lt_set_clock_compress( lxt.t ); + lt_set_chg_compress( lxt.t ); + lxt.inited = 1; + lxt.sequence = 0; + lxt.enabled = 1; + lxt.updateList = 0; + lxt.eventList = 0; + lxt.incSize = 100*1024*1024; + lxt.hunk = 0; + + lt_set_initial_value( lxt.t, 'x' ); + lt_symbol_bracket_stripping( lxt.t, 1 ); + lt_set_timescale( lxt.t, acc_fetch_precision() ); + lxt_timemarker(); +} +/************************************************* + lxt_incinit + - close current file and open a new one + maintaining the same trace info + ************************************************/ +static void lxt_incinit() +{ + char* filename; + char* dot; + info_p info; +#if DEBUG + io_printf( "lxt_incinit: %p\n", lxt.t ); +#endif + /* + * pinch off old file + */ + lxt_timemarker(); + lt_close( lxt.t ); + + /* + * create new filename + */ + lxt.hunk++; + filename = (char*)malloc( strlen(lxt.filename)+10+1 ); + dot = rindex( lxt.filename, '.' ); + *dot = 0; + if( lxt.hunk > 1 ) { + dot = rindex( lxt.filename, '-' ); + *dot = 0; + } + sprintf( filename, "%s-%d.lxt", lxt.filename, lxt.hunk ); + free( lxt.filename ); + lxt.filename = filename; + + /* + * open new wave file + */ + lxt.t = lt_init( filename ); + if( !lxt.t ) { + tf_error( "could not create file '%s'", filename ); + tf_dofinish(); + return; + } + lt_set_clock_compress( lxt.t ); + lt_set_chg_compress( lxt.t ); + lxt.updateList = 0; + lxt.eventList = 0; + lt_set_initial_value( lxt.t, 'x' ); + lt_symbol_bracket_stripping( lxt.t, 1 ); + lt_set_timescale( lxt.t, acc_fetch_precision() ); + lxt_timemarker(); + + /* + * add existing objects to new file + */ + info = lxt.objectList; + while( info ) { + int flags; + int msb; + int lsb; + if( info->real ) { + flags = LT_SYM_F_DOUBLE; + } else { + flags = LT_SYM_F_BITS; + } + if( info->real ) { + info->symbol = lt_symbol_add( lxt.t, info->name, 0, 0, 0, flags ); + } else if( info->event ) { + info->symbol = lt_symbol_add( lxt.t, info->name, 0, 0, 0, flags ); + } else { + acc_fetch_range( info->object, &msb, &lsb ); + info->symbol = lt_symbol_add( lxt.t, info->name, 0, msb, lsb, flags ); + } + lxt_dump( info, 1 ); + info = info->next; + } +} + + + + diff --git a/lxt/lxt.tab b/lxt/lxt.tab new file mode 100644 index 0000000..615bd54 --- /dev/null +++ b/lxt/lxt.tab @@ -0,0 +1,6 @@ +$lxt_recordvars call=lxt_recordvars misc=lxt_recordvars check=lxt_recordvars acc+=rw,cbk,frc:* +$lxt_recordon call=lxt_recordon misc=lxt_recordon check=lxt_recordon acc+=rw,cbk,frc:* +$lxt_recordoff call=lxt_recordoff misc=lxt_recordoff check=lxt_recordoff acc+=rw,cbk,frc:* +$lxt_recordclose call=lxt_recordclose misc=lxt_recordclose check=lxt_recordclose acc+=rw,cbk,frc:* +$lxt_recordfile call=lxt_recordfile misc=lxt_recordfile check=lxt_recordfile acc+=rw,cbk,frc:* +$lxt_recordsetup call=lxt_recordsetup misc=lxt_recordsetup check=lxt_recordsetup acc+=rw,cbk,frc:* diff --git a/lxt/lxt_write.c b/lxt/lxt_write.c new file mode 100644 index 0000000..0fc5db9 --- /dev/null +++ b/lxt/lxt_write.c @@ -0,0 +1,2057 @@ +/* + * Copyright (c) 2001 Tony Bybell. + * + * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "lxt_write.h" + +/* + * functions which emit various big endian + * data to a file + */ +static int lt_emit_u8(struct lt_trace *lt, int value) +{ +unsigned char buf[1]; +int nmemb; + +buf[0] = value & 0xff; +nmemb=fwrite(buf, sizeof(char), 1, lt->handle); +lt->position+=nmemb; +return(nmemb); +} + + +static int lt_emit_u16(struct lt_trace *lt, int value) +{ +unsigned char buf[2]; +int nmemb; + +buf[0] = (value>>8) & 0xff; +buf[1] = value & 0xff; +nmemb = fwrite(buf, sizeof(char), 2, lt->handle); +lt->position+=nmemb; +return(nmemb); +} + + +static int lt_emit_u24(struct lt_trace *lt, int value) +{ +unsigned char buf[3]; +int nmemb; + +buf[0] = (value>>16) & 0xff; +buf[1] = (value>>8) & 0xff; +buf[2] = value & 0xff; +nmemb=fwrite(buf, sizeof(char), 3, lt->handle); +lt->position+=nmemb; +return(nmemb); +} + + +static int lt_emit_u32(struct lt_trace *lt, int value) +{ +unsigned char buf[4]; +int nmemb; + +buf[0] = (value>>24) & 0xff; +buf[1] = (value>>16) & 0xff; +buf[2] = (value>>8) & 0xff; +buf[3] = value & 0xff; +nmemb=fwrite(buf, sizeof(char), 4, lt->handle); +lt->position+=nmemb; +return(nmemb); +} + + +static int lt_emit_u64(struct lt_trace *lt, int valueh, int valuel) +{ +int rc; + +if((rc=lt_emit_u32(lt, valueh))) + { + rc=lt_emit_u32(lt, valuel); + } + +return(rc); +} + + +static int lt_emit_double(struct lt_trace *lt, double value) +{ +int nmemb; + +nmemb=fwrite(&value, sizeof(char), sizeof(double)/sizeof(char), lt->handle); +lt->position+=nmemb; +return(nmemb); +} + + +static int lt_emit_string(struct lt_trace *lt, char *value) +{ +int rc=1; +do + { + rc&=lt_emit_u8(lt, *value); + } while(*(value++)); +return(rc); +} + + +/* + * gzfunctions which emit various big endian + * data to a file. (lt->position needs to be + * fixed up on gzclose so the tables don't + * get out of sync!) + */ +static int lt_emit_u8z(struct lt_trace *lt, int value) +{ +unsigned char buf[1]; +int nmemb; + +buf[0] = value & 0xff; +nmemb=gzwrite(lt->zhandle, buf, 1); +lt->zpackcount++; +lt->position++; +return(nmemb); +} + + +static int lt_emit_u16z(struct lt_trace *lt, int value) +{ +unsigned char buf[2]; +int nmemb; + +buf[0] = (value>>8) & 0xff; +buf[1] = value & 0xff; +nmemb = gzwrite(lt->zhandle, buf, 2); +lt->zpackcount+=2; +lt->position+=2; +return(nmemb); +} + + +static int lt_emit_u24z(struct lt_trace *lt, int value) +{ +unsigned char buf[3]; +int nmemb; + +buf[0] = (value>>16) & 0xff; +buf[1] = (value>>8) & 0xff; +buf[2] = value & 0xff; +nmemb=gzwrite(lt->zhandle, buf, 3); +lt->zpackcount+=3; +lt->position+=3; +return(nmemb); +} + + +static int lt_emit_u32z(struct lt_trace *lt, int value) +{ +unsigned char buf[4]; +int nmemb; + +buf[0] = (value>>24) & 0xff; +buf[1] = (value>>16) & 0xff; +buf[2] = (value>>8) & 0xff; +buf[3] = value & 0xff; +nmemb=gzwrite(lt->zhandle, buf, 4); + +lt->zpackcount+=4; +lt->position+=4; +return(nmemb); +} + + +static int lt_emit_u64z(struct lt_trace *lt, int valueh, int valuel) +{ +int rc; + +if((rc=lt_emit_u32z(lt, valueh))) + { + rc=lt_emit_u32z(lt, valuel); + } + +return(rc); +} + + +static int lt_emit_doublez(struct lt_trace *lt, double value) +{ +int nmemb; + +nmemb=gzwrite(lt->zhandle, &value, sizeof(double)/sizeof(char)); +lt->zpackcount+=(sizeof(double)/sizeof(char)); +lt->position+=(sizeof(double)/sizeof(char));; +return(nmemb); +} + + +static int lt_emit_stringz(struct lt_trace *lt, char *value) +{ +int rc=1; +do + { + rc&=lt_emit_u8z(lt, *value); + } while(*(value++)); +return(rc); +} + + +/* + * switch between compression modes above + */ +static void lt_set_zmode(struct lt_trace *lt, int mode) +{ +if(!mode) + { + lt->lt_emit_u8 = lt_emit_u8; + lt->lt_emit_u16 = lt_emit_u16; + lt->lt_emit_u24 = lt_emit_u24; + lt->lt_emit_u32 = lt_emit_u32; + lt->lt_emit_u64 = lt_emit_u64; + lt->lt_emit_double = lt_emit_double; + lt->lt_emit_string = lt_emit_string; + } + else + { + lt->lt_emit_u8 = lt_emit_u8z; + lt->lt_emit_u16 = lt_emit_u16z; + lt->lt_emit_u24 = lt_emit_u24z; + lt->lt_emit_u32 = lt_emit_u32z; + lt->lt_emit_u64 = lt_emit_u64z; + lt->lt_emit_double = lt_emit_doublez; + lt->lt_emit_string = lt_emit_stringz; + } +} + + +/* + * hash/symtable manipulation + */ +static int lt_hash(const char *s) +{ +const char *p; +char ch; +unsigned int h=0, h2=0, pos=0, g; +for(p=s;*p;p++) + { + ch=*p; + h2<<=3; + h2-=((unsigned int)ch+(pos++)); /* this handles stranded vectors quite well.. */ + + h=(h<<4)+ch; + if((g=h&0xf0000000)) + { + h=h^(g>>24); + h=h^g; + } + } + +h^=h2; /* combine the two hashes */ +return(h%LT_SYMPRIME); +} + + +static struct lt_symbol *lt_symadd(struct lt_trace *lt, const char *name, int hv) +{ +struct lt_symbol *s; + +s=(struct lt_symbol *)calloc(1,sizeof(struct lt_symbol)); +strcpy(s->name=(char *)malloc((s->namlen=strlen(name))+1),name); +s->next=lt->sym[hv]; +lt->sym[hv]=s; +return(s); +} + + +static struct lt_symbol *lt_symfind(struct lt_trace *lt, const char *s) +{ +int hv; +struct lt_symbol *temp; + +hv=lt_hash(s); +if(!(temp=lt->sym[hv])) return(NULL); /* no hash entry, add here wanted to add */ + +while(temp) + { + if(!strcmp(temp->name,s)) + { + return(temp); /* in table already */ + } + if(!temp->next) break; + temp=temp->next; + } + +return(NULL); /* not found, add here if you want to add*/ +} + + +/* + * compress facs to a prefix count + string + 0x00 + */ +static void lt_compress_fac(struct lt_trace *lt, char *str) +{ +int i; +int len = strlen(str); +int minlen = (lencompress_fac_len) ? len : lt->compress_fac_len; + +if(minlen>65535) minlen=65535; /* keep in printable range--most hierarchies won't be this big anyway */ + +if(lt->compress_fac_str) + { + for(i=0;icompress_fac_str[i]!=str[i]) break; + } + lt_emit_u16z(lt, i); + lt_emit_stringz(lt, str+i); + free(lt->compress_fac_str); + } + else + { + lt_emit_u16z(lt, 0); + lt_emit_stringz(lt, str); + } + +lt->compress_fac_str = (char *) malloc((lt->compress_fac_len=len)+1); +strcpy(lt->compress_fac_str, str); +} + + +/* + * emit facs in sorted order along with geometry + * and sync table info + */ +static int lt_compare(const void *v1, const void *v2) +{ +struct lt_symbol *s1 = *(struct lt_symbol **)v1; +struct lt_symbol *s2 = *(struct lt_symbol **)v2; +int rc = strcmp(s1->name, s2->name); +if(rc) + { + return(rc); + } + else + { + return(s1->msb - s2->msb); + } +} + + +static void strip_brack(struct lt_symbol *s) +{ +char *lastch = s->name+s->namlen - 1; +if(*lastch!=']') return; +if(s->namlen<3) return; +lastch--; +while(lastch!=s->name) + { + if(*lastch=='[') + { + *lastch=0x00; + return; + } + lastch--; + } +return; +} + + +static void lt_emitfacs(struct lt_trace *lt) +{ +int i; + +if((lt)&&(lt->numfacs)) + { + struct lt_symbol *s = lt->symchain; + if((lt->sorted_facs = (struct lt_symbol **)calloc(lt->numfacs, sizeof(struct lt_symbol *)))) + { + if(lt->do_strip_brackets) + for(i=0;inumfacs;i++) + { + lt->sorted_facs[i] = s; + strip_brack(s); + s=s->symchain; + } + else + for(i=0;inumfacs;i++) + { + lt->sorted_facs[i] = s; + s=s->symchain; + } + qsort((void *)lt->sorted_facs, lt->numfacs, sizeof(struct lt_symbol *), lt_compare); + lt->facname_offset=lt->position; + + lt_emit_u32(lt, lt->numfacs); /* uncompressed */ + lt_emit_u32(lt, lt->numfacbytes); /* uncompressed */ + fflush(lt->handle); + lt->zfacname_size = lt->position; + lt->zhandle = gzdopen(dup(fileno(lt->handle)), "wb9"); + + lt->zpackcount = 0; + for(i=0;inumfacs;i++) + { + lt->sorted_facs[i]->facnum = i; + lt_compress_fac(lt, lt->sorted_facs[i]->name); + } + free(lt->compress_fac_str); lt->compress_fac_str=NULL; + lt->compress_fac_len=0; + lt->zfacname_predec_size = lt->zpackcount; + + gzclose(lt->zhandle); + fseek(lt->handle, 0L, SEEK_END); + lt->position=ftell(lt->handle); + lt->zfacname_size = lt->position - lt->zfacname_size; + + lt->zhandle = gzdopen(dup(fileno(lt->handle)), "wb9"); + + lt->facgeometry_offset = lt->position; + for(i=0;inumfacs;i++) + { + if((lt->sorted_facs[i]->flags<_SYM_F_ALIAS)==0) + { + lt_emit_u32z(lt, lt->sorted_facs[i]->rows); + lt_emit_u32z(lt, lt->sorted_facs[i]->msb); + lt_emit_u32z(lt, lt->sorted_facs[i]->lsb); + lt_emit_u32z(lt, lt->sorted_facs[i]->flags); + } + else + { + lt_emit_u32z(lt, lt->sorted_facs[i]->aliased_to->facnum); + lt_emit_u32z(lt, lt->sorted_facs[i]->msb); + lt_emit_u32z(lt, lt->sorted_facs[i]->lsb); + lt_emit_u32z(lt, LT_SYM_F_ALIAS); + } + } + + gzclose(lt->zhandle); + fseek(lt->handle, 0L, SEEK_END); + lt->position=ftell(lt->handle); + lt->zfacgeometry_size = lt->position - lt->facgeometry_offset; + lt->zhandle = gzdopen(dup(fileno(lt->handle)), "wb9"); + + lt->sync_table_offset = lt->position; + for(i=0;inumfacs;i++) + { + lt_emit_u32z(lt, lt->sorted_facs[i]->last_change); + } + + gzclose(lt->zhandle); lt->zhandle = NULL; + fseek(lt->handle, 0L, SEEK_END); + lt->position=ftell(lt->handle); + lt->zsync_table_size = lt->position - lt->sync_table_offset; + } + } +} + + +/* + * initialize the trace and get back and lt context + */ +struct lt_trace *lt_init(const char *name) +{ +struct lt_trace *lt=(struct lt_trace *)calloc(1, sizeof(struct lt_trace)); + +if(!(lt->handle=fopen(name, "wb"))) + { + free(lt); + lt=NULL; + } + else + { + lt_emit_u16(lt, LT_HDRID); + lt_emit_u16(lt, LT_VERSION); + lt->change_field_offset = lt->position; + lt->initial_value = -1; /* if a user sets this it will have a different POSITIVE val */ + lt->timescale = -256; /* will be in range of -128<=x<=127 if set */ + + lt_set_zmode(lt, 0); + + lt->mintime=ULLDescriptor(1); + lt->maxtime=ULLDescriptor(0); + } + +return(lt); +} + +/* + * clock flushing.. + */ +static void lt_flushclock(struct lt_trace *lt, struct lt_symbol *s) +{ +unsigned int last_change_delta = lt->position - s->last_change - 2; +unsigned int start_position = lt->position; +int tag; +int numbytes, numbytes_trans; +int numtrans = s->clk_numtrans - LT_CLKPACK - 1; + +if(numtrans<0) + { + /* it never got around to caching */ + fprintf(stderr, "Possible Problem with %s with %d?\n", s->name, s->clk_numtrans); + return; + } + +if(last_change_delta >= 256*65536) + { + numbytes = 3; + } +else +if(last_change_delta >= 65536) + { + numbytes = 2; + } +else +if(last_change_delta >= 256) + { + numbytes = 1; + } +else + { + numbytes = 0; + } + +if(numtrans >= 256*65536) + { + numbytes_trans = 3; + } +else +if(numtrans >= 65536) + { + numbytes_trans = 2; + } +else +if(numtrans >= 256) + { + numbytes_trans = 1; + } +else + { + numbytes_trans = 0; + } + +tag = (numbytes<<4) + 0xC + numbytes_trans; /* yields xC..xF */ + +lt->lt_emit_u8(lt, tag); +switch(numbytes&3) + { + case 0: lt->lt_emit_u8(lt, last_change_delta); break; + case 1: lt->lt_emit_u16(lt, last_change_delta); break; + case 2: lt->lt_emit_u24(lt, last_change_delta); break; + case 3: lt->lt_emit_u32(lt, last_change_delta); break; + } + +s->last_change = start_position; + +/* s->clk_prevval CAN BE INFERRED! */ +/* s->clk_prevtrans CAN BE INFERRED! */ +/* s->clk_delta CAN BE INFERRED! */ + +switch(numbytes_trans&3) + { + case 0: lt->lt_emit_u8(lt, numtrans); break; + case 1: lt->lt_emit_u16(lt, numtrans); break; + case 2: lt->lt_emit_u24(lt, numtrans); break; + case 3: lt->lt_emit_u32(lt, numtrans); break; + } + +/* printf("Clock finish for '%s' at %Ld ending with '%c' for %d repeats over a switch delta of %d\n", + s->name, lt->timeval, s->clk_prevval, s->clk_numtrans - LT_CLKPACK, s->clk_delta); */ +s->clk_prevtrans = ULLDescriptor(~0); +s->clk_numtrans = 0; +} + +static void lt_flushclock_m(struct lt_trace *lt, struct lt_symbol *s) +{ +unsigned int last_change_delta = lt->position - s->last_change - 2; +unsigned int start_position = lt->position; +int tag; +int numbytes, numbytes_trans; +int numtrans = s->clk_numtrans - LT_CLKPACK_M - 1; + +if(numtrans<0) + { + /* it never got around to caching */ + fprintf(stderr, "Possible Problem with %s with %d?\n", s->name, s->clk_numtrans); + return; + } + +if(last_change_delta >= 256*65536) + { + numbytes = 3; + } +else +if(last_change_delta >= 65536) + { + numbytes = 2; + } +else +if(last_change_delta >= 256) + { + numbytes = 1; + } +else + { + numbytes = 0; + } + +if(numtrans >= 256*65536) + { + numbytes_trans = 3; + } +else +if(numtrans >= 65536) + { + numbytes_trans = 2; + } +else +if(numtrans >= 256) + { + numbytes_trans = 1; + } +else + { + numbytes_trans = 0; + } + +tag = (numbytes<<4) + 0xC + numbytes_trans; /* yields xC..xF */ + +lt->lt_emit_u8(lt, tag); +switch(numbytes&3) + { + case 0: lt->lt_emit_u8(lt, last_change_delta); break; + case 1: lt->lt_emit_u16(lt, last_change_delta); break; + case 2: lt->lt_emit_u24(lt, last_change_delta); break; + case 3: lt->lt_emit_u32(lt, last_change_delta); break; + } + +s->last_change = start_position; + +/* s->clk_prevval CAN BE INFERRED! */ +/* s->clk_prevtrans CAN BE INFERRED! */ +/* s->clk_delta CAN BE INFERRED! */ + +switch(numbytes_trans&3) + { + case 0: lt->lt_emit_u8(lt, numtrans); break; + case 1: lt->lt_emit_u16(lt, numtrans); break; + case 2: lt->lt_emit_u24(lt, numtrans); break; + case 3: lt->lt_emit_u32(lt, numtrans); break; + } + +/* printf("Clock finish for '%s' at %Ld ending with '%08x' for %d repeats over a switch delta of %Ld\n", + s->name, lt->timeval, s->clk_prevval, s->clk_numtrans - LT_CLKPACK_M, s->clk_delta); */ +s->clk_prevtrans = ULLDescriptor(~0); +s->clk_numtrans = 0; +} + + +/* + * close out the trace and fixate it + */ +void lt_close(struct lt_trace *lt) +{ +lxttime_t lasttime=ULLDescriptor(0); +int lastposition=0; +char is64=0; + +if(lt) + { + struct lt_symbol *s = lt->symchain; + + if(lt->clock_compress) + while(s) + { + if(s->clk_prevtrans!=ULLDescriptor(~0)) + { + int len = ((s->flags)<_SYM_F_INTEGER) ? 32 : s->len; + if(len>1) + { + if(s->clk_numtrans > LT_CLKPACK_M) lt_flushclock_m(lt, s); + } + else + { + if(s->clk_numtrans > LT_CLKPACK) lt_flushclock(lt, s); + } + } + + s=s->symchain; + } + + if(lt->zmode) + { + lt->chg_table_size = lt->position - lt->change_field_offset; + gzclose(lt->zhandle); lt->zhandle = NULL; + fseek(lt->handle, 0L, SEEK_END); + lt->position=ftell(lt->handle); + + lt_set_zmode(lt, 0); + lt->zchg_table_size = lt->position - lt->change_field_offset; + } + + lt_emitfacs(lt); + + if(lt->timebuff) + { + free(lt->timebuff); + lt->timebuff=NULL; + } + if(lt->timehead) + { + struct lt_timetrail *t=lt->timehead; + struct lt_timetrail *t2; + + lt->time_table_offset = lt->position; + + lt_emit_u32(lt, lt->timechangecount); /* this is uncompressed! */ + + fflush(lt->handle); + lt->zhandle = gzdopen(dup(fileno(lt->handle)), "wb9"); + lt->ztime_table_size = lt->position; + + is64=(lt->maxtime > ULLDescriptor(0xFFFFFFFF)); + + if(is64) + { + lt_emit_u64z(lt, (int)((lt->mintime)>>32), (int)lt->mintime); + lt_emit_u64z(lt, (int)((lt->maxtime)>>32), (int)lt->maxtime); + } + else + { + lt_emit_u32z(lt, (int)lt->mintime); + lt_emit_u32z(lt, (int)lt->maxtime); + } + + while(t) + { + lt_emit_u32z(lt, t->position - lastposition); lastposition = t->position; + t=t->next; + } + + t=lt->timehead; + if(is64) + { + while(t) + { + lxttime_t delta = t->timeval - lasttime; + lt_emit_u64z(lt, (int)(delta>>32), (int)delta); lasttime = t->timeval; + + t2=t->next; + free(t); + t=t2; + } + } + else + { + while(t) + { + lt_emit_u32z(lt, (int)(t->timeval - lasttime)); lasttime = t->timeval; + + t2=t->next; + free(t); + t=t2; + } + + lt->timehead = lt->timecurr = NULL; + } + + gzclose(lt->zhandle); lt->zhandle = NULL; + fseek(lt->handle, 0L, SEEK_END); + lt->position=ftell(lt->handle); + lt->ztime_table_size = lt->position - lt->ztime_table_size; + } + + if(lt->initial_value>=0) + { + lt->initial_value_offset = lt->position; + lt_emit_u8(lt, lt->initial_value); + } + + if((lt->timescale>-129)&(lt->timescale<128)) + { + lt->timescale_offset = lt->position; + lt_emit_u8(lt, lt->timescale); + } + + if(lt->double_used) + { + lt->double_test_offset = lt->position; + lt_emit_double(lt, 3.14159); + } + + lt_emit_u8(lt, LT_SECTION_END); + if(lt->change_field_offset) { lt_emit_u32(lt, lt->change_field_offset); lt_emit_u8(lt, LT_SECTION_CHG); } + if(lt->sync_table_offset) { lt_emit_u32(lt, lt->sync_table_offset); lt_emit_u8(lt, LT_SECTION_SYNC_TABLE); } + if(lt->facname_offset) { lt_emit_u32(lt, lt->facname_offset); lt_emit_u8(lt, LT_SECTION_FACNAME); } + if(lt->facgeometry_offset) { lt_emit_u32(lt, lt->facgeometry_offset); lt_emit_u8(lt, LT_SECTION_FACNAME_GEOMETRY); } + if(lt->timescale_offset) { lt_emit_u32(lt, lt->timescale_offset); lt_emit_u8(lt, LT_SECTION_TIMESCALE); } + if(lt->time_table_offset) { lt_emit_u32(lt, lt->time_table_offset); lt_emit_u8(lt, is64 ? LT_SECTION_TIME_TABLE64 : LT_SECTION_TIME_TABLE); } + if(lt->initial_value_offset) { lt_emit_u32(lt, lt->initial_value_offset); lt_emit_u8(lt, LT_SECTION_INITIAL_VALUE); } + if(lt->double_test_offset) { lt_emit_u32(lt, lt->double_test_offset); lt_emit_u8(lt, LT_SECTION_DOUBLE_TEST); } + + /* Version 2 adds */ + if(lt->zfacname_predec_size) { lt_emit_u32(lt, lt->zfacname_predec_size); lt_emit_u8(lt, LT_SECTION_ZFACNAME_PREDEC_SIZE); } + if(lt->zfacname_size) { lt_emit_u32(lt, lt->zfacname_size); lt_emit_u8(lt, LT_SECTION_ZFACNAME_SIZE); } + if(lt->zfacgeometry_size) { lt_emit_u32(lt, lt->zfacgeometry_size); lt_emit_u8(lt, LT_SECTION_ZFACNAME_GEOMETRY_SIZE); } + if(lt->zsync_table_size) { lt_emit_u32(lt, lt->zsync_table_size); lt_emit_u8(lt, LT_SECTION_ZSYNC_SIZE); } + if(lt->ztime_table_size) { lt_emit_u32(lt, lt->ztime_table_size); lt_emit_u8(lt, LT_SECTION_ZTIME_TABLE_SIZE); } + if(lt->chg_table_size) { lt_emit_u32(lt, lt->chg_table_size); lt_emit_u8(lt, LT_SECTION_ZCHG_PREDEC_SIZE); } + if(lt->zchg_table_size) { lt_emit_u32(lt, lt->zchg_table_size); lt_emit_u8(lt, LT_SECTION_ZCHG_SIZE); } + + lt_emit_u8(lt, LT_TRLID); + + if(lt->symchain) + { + struct lt_symbol *s = lt->symchain; + struct lt_symbol *s2; + + while(s) + { + free(s->name); + s2=s->next; + free(s); + s=s2; + } + } + + fclose(lt->handle); + free(lt); + } + +} + + +/* + * maint function for finding a symbol if it exists + */ +struct lt_symbol *lt_symbol_find(struct lt_trace *lt, const char *name) +{ +struct lt_symbol *s=NULL; + +if((lt)&&(name)) s=lt_symfind(lt, name); +return(s); +} + + +/* + * add a trace (if it doesn't exist already) + */ +struct lt_symbol *lt_symbol_add(struct lt_trace *lt, const char *name, unsigned int rows, int msb, int lsb, int flags) +{ +struct lt_symbol *s; +int len; +int flagcnt; + +flagcnt = ((flags<_SYM_F_INTEGER)!=0) + ((flags<_SYM_F_DOUBLE)!=0) + ((flags<_SYM_F_STRING)!=0); + +if((flagcnt>1)||(!lt)||(!name)||(lt_symfind(lt, name))) return (NULL); + +if(flags<_SYM_F_DOUBLE) lt->double_used = 1; + +s=lt_symadd(lt, name, lt_hash(name)); +s->rows = rows; +s->flags = flags&(~LT_SYM_F_ALIAS); /* aliasing makes no sense here.. */ + +if(!flagcnt) + { + s->msb = msb; + s->lsb = lsb; + s->len = (msblen==1)&&(s->rows==0)) s->clk_prevtrans = ULLDescriptor(~0); + } + +s->symchain = lt->symchain; +lt->symchain = s; +lt->numfacs++; +if((len=strlen(name)) > lt->longestname) lt->longestname = len; +lt->numfacbytes += (len+1); + +return(s); +} + +/* + * add an alias trace (if it doesn't exist already and orig is found) + */ +struct lt_symbol *lt_symbol_alias(struct lt_trace *lt, const char *existing_name, const char *alias, int msb, int lsb) +{ +struct lt_symbol *s, *sa; +int len; +int bitlen; +int flagcnt; + +if((!lt)||(!existing_name)||(!alias)||(!(s=lt_symfind(lt, existing_name)))||(lt_symfind(lt, alias))) return (NULL); + +while(s->aliased_to) /* find root alias */ + { + s=s->aliased_to; + } + +flagcnt = ((s->flags<_SYM_F_INTEGER)!=0) + ((s->flags<_SYM_F_DOUBLE)!=0) + ((s->flags<_SYM_F_STRING)!=0); +bitlen = (msblen)) return(NULL); + +sa=lt_symadd(lt, alias, lt_hash(alias)); +sa->flags = LT_SYM_F_ALIAS; /* only point this can get set */ +sa->aliased_to = s; + +if(!flagcnt) + { + sa->msb = msb; + sa->lsb = lsb; + sa->len = bitlen; + } + +sa->symchain = lt->symchain; +lt->symchain = sa; +lt->numfacs++; +if((len=strlen(alias)) > lt->longestname) lt->longestname = len; +lt->numfacbytes += (len+1); + +return(sa); +} + + +/* + * set current time + */ +int lt_inc_time_by_delta(struct lt_trace *lt, unsigned int timeval) +{ +return(lt_set_time64(lt, lt->maxtime + (lxttime_t)timeval)); +} + +int lt_set_time(struct lt_trace *lt, unsigned int timeval) +{ +return(lt_set_time64(lt, (lxttime_t)timeval)); +} + +int lt_inc_time_by_delta64(struct lt_trace *lt, lxttime_t timeval) +{ +return(lt_set_time64(lt, lt->maxtime + timeval)); +} + +int lt_set_time64(struct lt_trace *lt, lxttime_t timeval) +{ +int rc=0; + +if(lt) + { + struct lt_timetrail *trl=(struct lt_timetrail *)calloc(1, sizeof(struct lt_timetrail)); + if(trl) + { + trl->timeval = timeval; + trl->position = lt->position; + + if((lt->timecurr)||(lt->timebuff)) + { + if(((timeval>lt->mintime)&&(timeval>lt->maxtime))||((lt->mintime==ULLDescriptor(1))&&(lt->maxtime==ULLDescriptor(0)))) + { + lt->maxtime = timeval; + } + else + { + free(trl); + goto bail; + } + } + else + { + lt->mintime = lt->maxtime = timeval; + } + + if(lt->timebuff) + { + free(lt->timebuff); + } + lt->timebuff = trl; + lt->timeval = timeval; + rc=1; + } + } + +bail: +return(rc); +} + + +/* + * sets trace timescale as 10**x seconds + */ +void lt_set_timescale(struct lt_trace *lt, int timescale) +{ +if(lt) + { + lt->timescale = timescale; + } +} + + +/* + * sets clock compression heuristic + */ +void lt_set_clock_compress(struct lt_trace *lt) +{ +if(lt) + { + lt->clock_compress = 1; + } +} + + +/* + * sets change dump compression + */ +void lt_set_chg_compress(struct lt_trace *lt) +{ +if(lt) + { + if((!lt->zmode)&&(!lt->emitted)) + { + lt_set_zmode(lt, lt->zmode = 1); + fflush(lt->handle); + lt->zhandle = gzdopen(dup(fileno(lt->handle)), "wb9"); + } + } +} + + + + +/* + * sets trace initial value + */ +void lt_set_initial_value(struct lt_trace *lt, char value) +{ +if(lt) + { + int tag; + switch(value) + { + case '0': tag = 0; break; + case '1': tag = 1; break; + case 'Z': + case 'z': tag = 2; break; + case 'X': + case 'x': tag = 3; break; + case 'H': + case 'h': tag = 4; break; + case 'U': + case 'u': tag = 5; break; + case 'W': + case 'w': tag = 6; break; + case 'L': + case 'l': tag = 0x7; break; + case '-': tag = 0x8; break; + default: tag = -1; break; + } + lt->initial_value = tag; + } +} + + +/* + * Sets bracket stripping (useful for VCD conversions of + * bitblasted nets) + */ +void lt_symbol_bracket_stripping(struct lt_trace *lt, int doit) +{ +if(lt) + { + lt->do_strip_brackets = (doit!=0); + } +} + + +/* + * emission for trace values.. + */ +static int lt_optimask[]= +{ +0x00000000, + +0x00000001, +0x00000003, +0x00000007, +0x0000000f, + +0x0000001f, +0x0000003f, +0x0000007f, +0x000000ff, + +0x000001ff, +0x000003ff, +0x000007ff, +0x00000fff, + +0x00001fff, +0x00003fff, +0x00007fff, +0x0000ffff, + +0x0001ffff, +0x0003ffff, +0x0007ffff, +0x000fffff, + +0x001fffff, +0x003fffff, +0x007fffff, +0x00ffffff, + +0x01ffffff, +0x03ffffff, +0x07ffffff, +0x0fffffff, + +0x1fffffff, +0x3fffffff, +0x7fffffff, +0xffffffff +}; + + +int lt_emit_value_int(struct lt_trace *lt, struct lt_symbol *s, unsigned int row, int value) +{ +int rc=0; + +if((!lt)||(!s)) return(rc); + +if(!lt->emitted) lt->emitted = 1; + +while(s->aliased_to) /* find root alias if exists */ + { + s=s->aliased_to; + } + +if(!(s->flags&(LT_SYM_F_DOUBLE|LT_SYM_F_STRING))) + { + int numbytes; /* number of bytes to store value minus one */ + int len = ((s->flags)<_SYM_F_INTEGER) ? 32 : s->len; + unsigned int last_change_delta; + + if((lt->clock_compress)&&(s->rows==0)) + if((len>1)&&(len<=32)) + { + int ivalue = value; + s->clk_mask <<= 1; + s->clk_mask |= 1; + + if(((s->clk_mask&0x1f)==0x1f) && ((ivalue - s->clk_prevval1)==(s->clk_prevval1 - s->clk_prevval3)) && + ((s->clk_prevval - s->clk_prevval2)==(s->clk_prevval2 - s->clk_prevval4))) + { + if(s->clk_prevtrans==ULLDescriptor(~0)) + { + s->clk_prevtrans = lt->timeval; + s->clk_numtrans = 0; + } + else + if(s->clk_numtrans == 0) + { + s->clk_delta = lt->timeval - s->clk_prevtrans; + s->clk_prevtrans = lt->timeval; + s->clk_numtrans++; + } + else + { + if(s->clk_delta == (lt->timeval - s->clk_prevtrans)) + { + s->clk_numtrans++; + s->clk_prevtrans = lt->timeval; + if(s->clk_numtrans > LT_CLKPACK_M) + { + s->clk_prevval4 = s->clk_prevval3; + s->clk_prevval3 = s->clk_prevval2; + s->clk_prevval2 = s->clk_prevval1; + s->clk_prevval1 = s->clk_prevval; + s->clk_prevval = ivalue; + + /* printf("Clock value '%08x' for '%s' at %Ld (#%d)\n", ivalue, s->name, lt->timeval, s->clk_numtrans); */ + return(1); + } + } + else + { + if(s->clk_numtrans > LT_CLKPACK_M) + { + lt_flushclock_m(lt, s); + /* flush clock then continue below! */ + } + else + { + s->clk_prevtrans=ULLDescriptor(~0); + } + } + } + + } + else + { + if(s->clk_numtrans > LT_CLKPACK_M) + { + lt_flushclock_m(lt, s); + /* flush clock then continue below! */ + } + else + { + s->clk_prevtrans=ULLDescriptor(~0); + } + } + + s->clk_prevval4 = s->clk_prevval3; + s->clk_prevval3 = s->clk_prevval2; + s->clk_prevval2 = s->clk_prevval1; + s->clk_prevval1 = s->clk_prevval; + s->clk_prevval = ivalue; + } + else + if(len==1) /* possible clock handling */ + { + int ivalue = value&1; + + if(((s->clk_prevval == '1') && (ivalue==0)) || ((s->clk_prevval == '0') && (ivalue==1))) + { + if(s->clk_prevtrans==ULLDescriptor(~0)) + { + s->clk_prevtrans = lt->timeval; + s->clk_numtrans = 0; + } + else + if(s->clk_numtrans == 0) + { + s->clk_delta = lt->timeval - s->clk_prevtrans; + s->clk_prevtrans = lt->timeval; + s->clk_numtrans++; + } + else + { + if(s->clk_delta == (lt->timeval - s->clk_prevtrans)) + { + s->clk_numtrans++; + s->clk_prevtrans = lt->timeval; + if(s->clk_numtrans > LT_CLKPACK) + { + s->clk_prevval = ivalue + '0'; + + /* printf("Clock value '%d' for '%s' at %d (#%d)\n", ivalue, s->name, lt->timeval, s->clk_numtrans); */ + return(1); + } + } + else + { + if(s->clk_numtrans > LT_CLKPACK) + { + lt_flushclock(lt, s); + /* flush clock then continue below! */ + } + else + { + s->clk_prevtrans=ULLDescriptor(~0); + } + } + } + + } + else + { + if(s->clk_numtrans > LT_CLKPACK) + { + lt_flushclock(lt, s); + /* flush clock then continue below! */ + } + else + { + s->clk_prevtrans=ULLDescriptor(~0); + } + } + + s->clk_prevval = ivalue + '0'; + } + + /* normal trace handling */ + + last_change_delta = lt->position - s->last_change - 2; + + if(last_change_delta >= 256*65536) + { + numbytes = 3; + } + else + if(last_change_delta >= 65536) + { + numbytes = 2; + } + else + if(last_change_delta >= 256) + { + numbytes = 1; + } + else + { + numbytes = 0; + } + + if(len<=32) + { + int start_position = lt->position; + int tag; + int optimized0 = ((value<_optimask[len])==0); + int optimized1 = ((value<_optimask[len])==lt_optimask[len]); + int optimized = optimized0|optimized1; + + if(optimized) + { + tag = (numbytes<<4) | (3+optimized1); /* for x3 and x4 cases */ + } + else + { + tag = (numbytes<<4); + } + + lt->lt_emit_u8(lt, tag); + switch(numbytes&3) + { + case 0: lt->lt_emit_u8(lt, last_change_delta); break; + case 1: lt->lt_emit_u16(lt, last_change_delta); break; + case 2: lt->lt_emit_u24(lt, last_change_delta); break; + case 3: lt->lt_emit_u32(lt, last_change_delta); break; + } + + s->last_change = start_position; + + if(s->rows>0) + { + if(s->rows >= 256*65536) + { + numbytes = 3; + } + else + if(s->rows >= 65536) + { + numbytes = 2; + } + else + if(s->rows >= 256) + { + numbytes = 1; + } + else + { + numbytes = 0; + } + + switch(numbytes&3) + { + case 0: lt->lt_emit_u8(lt, row); break; + case 1: lt->lt_emit_u16(lt, row); break; + case 2: lt->lt_emit_u24(lt, row); break; + case 3: lt->lt_emit_u32(lt, row); break; + } + } + + if(!optimized) + { + if(len<9) + { + value <<= (8-len); + rc=lt->lt_emit_u8(lt, value); + } + else + if(len<17) + { + value <<= (16-len); + rc=lt->lt_emit_u16(lt, value); + } + else + if(len<25) + { + value <<= (24-len); + rc=lt->lt_emit_u24(lt, value); + } + else + { + value <<= (32-len); + rc=lt->lt_emit_u32(lt, value); + } + } + } + + if(lt->timebuff) + { + lt->timechangecount++; + if(lt->timecurr) + { + lt->timecurr->next = lt->timebuff; + lt->timecurr = lt->timebuff; + } + else + { + lt->timehead = lt->timecurr = lt->timebuff; + } + + lt->timebuff=NULL; + } + } + +return(rc); +} + + +int lt_emit_value_double(struct lt_trace *lt, struct lt_symbol *s, unsigned int row, double value) +{ +int rc=0; +int start_position; +int tag; + +if((!lt)||(!s)) return(rc); + +if(!lt->emitted) lt->emitted = 1; + +while(s->aliased_to) /* find root alias if exists */ + { + s=s->aliased_to; + } + +if((s->flags)<_SYM_F_DOUBLE) + { + int numbytes; /* number of bytes to store value minus one */ + unsigned int last_change_delta = lt->position - s->last_change - 2; + + if(last_change_delta >= 256*65536) + { + numbytes = 3; + } + else + if(last_change_delta >= 65536) + { + numbytes = 2; + } + else + if(last_change_delta >= 256) + { + numbytes = 1; + } + else + { + numbytes = 0; + } + + start_position = lt->position; + tag = (numbytes<<4); + lt->lt_emit_u8(lt, tag); + switch(numbytes&3) + { + case 0: lt->lt_emit_u8(lt, last_change_delta); break; + case 1: lt->lt_emit_u16(lt, last_change_delta); break; + case 2: lt->lt_emit_u24(lt, last_change_delta); break; + case 3: lt->lt_emit_u32(lt, last_change_delta); break; + } + + s->last_change = start_position; + + if(s->rows>0) + { + if(s->rows >= 256*65536) + { + numbytes = 3; + } + else + if(s->rows >= 65536) + { + numbytes = 2; + } + else + if(s->rows >= 256) + { + numbytes = 1; + } + else + { + numbytes = 0; + } + + switch(numbytes&3) + { + case 0: lt->lt_emit_u8(lt, row); break; + case 1: lt->lt_emit_u16(lt, row); break; + case 2: lt->lt_emit_u24(lt, row); break; + case 3: lt->lt_emit_u32(lt, row); break; + } + } + + rc=lt->lt_emit_double(lt, value); + + if(lt->timebuff) + { + lt->timechangecount++; + if(lt->timecurr) + { + lt->timecurr->next = lt->timebuff; + lt->timecurr = lt->timebuff; + } + else + { + lt->timehead = lt->timecurr = lt->timebuff; + } + + lt->timebuff=NULL; + } + } + +return(rc); +} + + +int lt_emit_value_string(struct lt_trace *lt, struct lt_symbol *s, unsigned int row, char *value) +{ +int rc=0; +int start_position; +int tag; + +if((!lt)||(!s)||(!value)) return(rc); + +if(!lt->emitted) lt->emitted = 1; + +while(s->aliased_to) /* find root alias if exists */ + { + s=s->aliased_to; + } + +if((s->flags)<_SYM_F_STRING) + { + int numbytes; /* number of bytes to store value minus one */ + unsigned int last_change_delta = lt->position - s->last_change - 2; + + if(last_change_delta >= 256*65536) + { + numbytes = 3; + } + else + if(last_change_delta >= 65536) + { + numbytes = 2; + } + else + if(last_change_delta >= 256) + { + numbytes = 1; + } + else + { + numbytes = 0; + } + + start_position = lt->position; + tag = (numbytes<<4); + lt->lt_emit_u8(lt, tag); + switch(numbytes&3) + { + case 0: lt->lt_emit_u8(lt, last_change_delta); break; + case 1: lt->lt_emit_u16(lt, last_change_delta); break; + case 2: lt->lt_emit_u24(lt, last_change_delta); break; + case 3: lt->lt_emit_u32(lt, last_change_delta); break; + } + + s->last_change = start_position; + + if(s->rows>0) + { + if(s->rows >= 256*65536) + { + numbytes = 3; + } + else + if(s->rows >= 65536) + { + numbytes = 2; + } + else + if(s->rows >= 256) + { + numbytes = 1; + } + else + { + numbytes = 0; + } + + switch(numbytes&3) + { + case 0: lt->lt_emit_u8(lt, row); break; + case 1: lt->lt_emit_u16(lt, row); break; + case 2: lt->lt_emit_u24(lt, row); break; + case 3: lt->lt_emit_u32(lt, row); break; + } + } + + rc=lt->lt_emit_string(lt, value); + + if(lt->timebuff) + { + lt->timechangecount++; + if(lt->timecurr) + { + lt->timecurr->next = lt->timebuff; + lt->timecurr = lt->timebuff; + } + else + { + lt->timehead = lt->timecurr = lt->timebuff; + } + + lt->timebuff=NULL; + } + } + +return(rc); +} + + +int lt_emit_value_bit_string(struct lt_trace *lt, struct lt_symbol *s, unsigned int row, char *value) +{ +int rc=0; +int start_position; +int tag, tagadd; + +if((!lt)||(!s)||(!value)||(!*value)) return(rc); + +if(!lt->emitted) lt->emitted = 1; + +while(s->aliased_to) /* find root alias if exists */ + { + s=s->aliased_to; + } + +if(!(s->flags&(LT_SYM_F_DOUBLE|LT_SYM_F_STRING))) + { + int numbytes; /* number of bytes to store value minus one */ + char *pnt; + int mvl=0; + char ch; + char prevch; + unsigned int last_change_delta; + + int len = ((s->flags)<_SYM_F_INTEGER) ? 32 : s->len; + + if((lt->clock_compress)&&(s->rows==0)) + if((len>1)&&(len<=32)) + { + int legal = 0; + int ivalue = 0; + int i; + char *pnt = value; + + for(i=0;i0)) + { + pnt--; + } + else + { + legal = 0; + break; + } + } + + ivalue = (((unsigned int)ivalue) << 1); + ivalue |= (*pnt & 1); + legal = 1; + pnt++; + } + s->clk_mask <<= 1; + s->clk_mask |= legal; + + if(((s->clk_mask&0x1f)==0x1f) && ((ivalue - s->clk_prevval1)==(s->clk_prevval1 - s->clk_prevval3)) && + ((s->clk_prevval - s->clk_prevval2)==(s->clk_prevval2 - s->clk_prevval4))) + { + if(s->clk_prevtrans==ULLDescriptor(~0)) + { + s->clk_prevtrans = lt->timeval; + s->clk_numtrans = 0; + } + else + if(s->clk_numtrans == 0) + { + s->clk_delta = lt->timeval - s->clk_prevtrans; + s->clk_prevtrans = lt->timeval; + s->clk_numtrans++; + } + else + { + if(s->clk_delta == (lt->timeval - s->clk_prevtrans)) + { + s->clk_numtrans++; + s->clk_prevtrans = lt->timeval; + if(s->clk_numtrans > LT_CLKPACK_M) + { + s->clk_prevval4 = s->clk_prevval3; + s->clk_prevval3 = s->clk_prevval2; + s->clk_prevval2 = s->clk_prevval1; + s->clk_prevval1 = s->clk_prevval; + s->clk_prevval = ivalue; + + /* printf("Clock value '%08x' for '%s' [len=%d] at %Ld (#%d)\n", + ivalue, s->name, len, lt->timeval, s->clk_numtrans); */ + return(1); + } + } + else + { + if(s->clk_numtrans > LT_CLKPACK_M) + { + lt_flushclock_m(lt, s); + /* flush clock then continue below! */ + } + else + { + s->clk_prevtrans=ULLDescriptor(~0); + } + } + } + + } + else + { + if(s->clk_numtrans > LT_CLKPACK_M) + { + lt_flushclock_m(lt, s); + /* flush clock then continue below! */ + } + else + { + s->clk_prevtrans=ULLDescriptor(~0); + } + } + + s->clk_prevval4 = s->clk_prevval3; + s->clk_prevval3 = s->clk_prevval2; + s->clk_prevval2 = s->clk_prevval1; + s->clk_prevval1 = s->clk_prevval; + s->clk_prevval = ivalue; + } + else + if(len==1) /* possible clock handling */ + { + if(((s->clk_prevval == '1') && (value[0]=='0')) || ((s->clk_prevval == '0') && (value[0]=='1'))) + { + if(s->clk_prevtrans==ULLDescriptor(~0)) + { + s->clk_prevtrans = lt->timeval; + s->clk_numtrans = 0; + } + else + if(s->clk_numtrans == 0) + { + s->clk_delta = lt->timeval - s->clk_prevtrans; + s->clk_prevtrans = lt->timeval; + s->clk_numtrans++; + } + else + { + if(s->clk_delta == (lt->timeval - s->clk_prevtrans)) + { + s->clk_numtrans++; + s->clk_prevtrans = lt->timeval; + if(s->clk_numtrans > LT_CLKPACK) + { + s->clk_prevval = value[0]; + + /* printf("Clock value '%c' for '%s' at %Ld (#%d)\n", value[0], s->name, lt->timeval, s->clk_numtrans); */ + return(1); + } + } + else + { + if(s->clk_numtrans > LT_CLKPACK) + { + lt_flushclock(lt, s); + /* flush clock then continue below! */ + } + else + { + s->clk_prevtrans=ULLDescriptor(~0); + } + } + } + + } + else + { + if(s->clk_numtrans > LT_CLKPACK) + { + lt_flushclock(lt, s); + /* flush clock then continue below! */ + } + else + { + s->clk_prevtrans=ULLDescriptor(~0); + } + } + + s->clk_prevval = value[0]; + } + + /* normal trace handling */ + + last_change_delta = lt->position - s->last_change - 2; + + if(last_change_delta >= 256*65536) + { + numbytes = 3; + } + else + if(last_change_delta >= 65536) + { + numbytes = 2; + } + else + if(last_change_delta >= 256) + { + numbytes = 1; + } + else + { + numbytes = 0; + } + + pnt = value; + prevch = *pnt; + while((ch=*(pnt++))) + { + switch(ch) + { + case '0': + case '1': mvl|=LT_MVL_2; break; + case 'Z': + case 'z': + case 'X': + case 'x': mvl|=LT_MVL_4; break; + default: mvl|=LT_MVL_9; break; + } + + if(prevch!=ch) prevch = 0; + } + + switch(prevch) + { + case 0x00: tagadd = 0; break; + case '0': tagadd = 3; break; + case '1': tagadd = 4; break; + case 'Z': + case 'z': tagadd = 5; break; + case 'X': + case 'x': tagadd = 6; break; + case 'H': + case 'h': tagadd = 7; break; + case 'U': + case 'u': tagadd = 8; break; + case 'W': + case 'w': tagadd = 9; break; + case 'L': + case 'l': tagadd = 0xa; break; + default: tagadd = 0xb; break; + } + + if(mvl) + { + start_position = lt->position; + if(tagadd) + { + tag = (numbytes<<4) + tagadd; + } + else + { + tag = (numbytes<<4) + ((mvl<_MVL_9)? 2 : ((mvl<_MVL_4)? 1 : 0)); + } + lt->lt_emit_u8(lt, tag); + switch(numbytes&3) + { + case 0: lt->lt_emit_u8(lt, last_change_delta); break; + case 1: lt->lt_emit_u16(lt, last_change_delta); break; + case 2: lt->lt_emit_u24(lt, last_change_delta); break; + case 3: lt->lt_emit_u32(lt, last_change_delta); break; + } + + s->last_change = start_position; + + if(s->rows>0) + { + if(s->rows >= 256*65536) + { + numbytes = 3; + } + else + if(s->rows >= 65536) + { + numbytes = 2; + } + else + if(s->rows >= 256) + { + numbytes = 1; + } + else + { + numbytes = 0; + } + + switch(numbytes&3) + { + case 0: lt->lt_emit_u8(lt, row); break; + case 1: lt->lt_emit_u16(lt, row); break; + case 2: lt->lt_emit_u24(lt, row); break; + case 3: lt->lt_emit_u32(lt, row); break; + } + } + + if(!tagadd) + { + int len = ((s->flags)<_SYM_F_INTEGER) ? 32 : s->len; + if((mvl & (LT_MVL_2|LT_MVL_4|LT_MVL_9)) == LT_MVL_2) + { + int i; + int bitpos = 7; + int outval = 0; + int thisval= 0; + + pnt = value; + + for(i=0;ilt_emit_u8(lt, outval); + outval = 0; + bitpos = 7; + } + } + } + else + if((mvl & (LT_MVL_4|LT_MVL_9)) == LT_MVL_4) + { + int i; + int bitpos = 6; + int outval = 0; + int thisval= 0; + + pnt = value; + + for(i=0;ilt_emit_u8(lt, outval); + outval = 0; + bitpos = 6; + } + } + } + else + /* if(mvl & LT_MVL_9) */ + { + int i; + int bitpos = 4; + int outval = 0; + int thisval= 0; + + pnt = value; + + for(i=0;ilt_emit_u8(lt, outval); + outval = 0; + bitpos = 4; + } + } + } + } + + rc=1; + } + + if(lt->timebuff) + { + lt->timechangecount++; + if(lt->timecurr) + { + lt->timecurr->next = lt->timebuff; + lt->timecurr = lt->timebuff; + } + else + { + lt->timehead = lt->timecurr = lt->timebuff; + } + + lt->timebuff=NULL; + } + } + +return(rc); +} diff --git a/lxt/lxt_write.h b/lxt/lxt_write.h new file mode 100644 index 0000000..43d6a9f --- /dev/null +++ b/lxt/lxt_write.h @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2001 Tony Bybell. + * + * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef DEFS_LXT_H +#define DEFS_LXT_H + +#include +#include +#include +#include +#include +#include +#include + +#define LT_HDRID (0x0138) +#define LT_VERSION (0x0003) +#define LT_TRLID (0xB4) + +#define LT_CLKPACK (4) +#define LT_CLKPACK_M (2) + +#define LT_MVL_2 (1<<0) +#define LT_MVL_4 (1<<1) +#define LT_MVL_9 (1<<2) + +typedef unsigned long long lxttime_t; +#define ULLDescriptor(x) x##ULL + +struct lt_timetrail +{ +struct lt_timetrail *next; +lxttime_t timeval; +unsigned int position; +}; + + +#define LT_SYMPRIME 65519 + +#define LT_SECTION_END (0) +#define LT_SECTION_CHG (1) +#define LT_SECTION_SYNC_TABLE (2) +#define LT_SECTION_FACNAME (3) +#define LT_SECTION_FACNAME_GEOMETRY (4) +#define LT_SECTION_TIMESCALE (5) +#define LT_SECTION_TIME_TABLE (6) +#define LT_SECTION_INITIAL_VALUE (7) +#define LT_SECTION_DOUBLE_TEST (8) +#define LT_SECTION_TIME_TABLE64 (9) +#define LT_SECTION_ZFACNAME_PREDEC_SIZE (10) +#define LT_SECTION_ZFACNAME_SIZE (11) +#define LT_SECTION_ZFACNAME_GEOMETRY_SIZE (12) +#define LT_SECTION_ZSYNC_SIZE (13) +#define LT_SECTION_ZTIME_TABLE_SIZE (14) +#define LT_SECTION_ZCHG_PREDEC_SIZE (15) +#define LT_SECTION_ZCHG_SIZE (16) + + +struct lt_trace +{ +FILE *handle; +gzFile zhandle; + +int (*lt_emit_u8)(struct lt_trace *lt, int value); +int (*lt_emit_u16)(struct lt_trace *lt, int value); +int (*lt_emit_u24)(struct lt_trace *lt, int value); +int (*lt_emit_u32)(struct lt_trace *lt, int value); +int (*lt_emit_u64)(struct lt_trace *lt, int valueh, int valuel); +int (*lt_emit_double)(struct lt_trace *lt, double value); +int (*lt_emit_string)(struct lt_trace *lt, char *value); + +unsigned int position; +unsigned int zfacname_predec_size, zfacname_size, zfacgeometry_size, zsync_table_size, ztime_table_size; +unsigned int zpackcount, zchg_table_size, chg_table_size; + +struct lt_symbol *sym[LT_SYMPRIME]; +struct lt_symbol **sorted_facs; +struct lt_symbol *symchain; +int numfacs; +int numfacbytes; +int longestname; +lxttime_t mintime, maxtime; +int timescale; +int initial_value; + +struct lt_timetrail *timehead, *timecurr, *timebuff; +int timechangecount; + +unsigned int change_field_offset; +unsigned int facname_offset; +unsigned int facgeometry_offset; +unsigned int time_table_offset; +unsigned int sync_table_offset; +unsigned int initial_value_offset; +unsigned int timescale_offset; +unsigned int double_test_offset; + +char *compress_fac_str; +int compress_fac_len; + +lxttime_t timeval; /* for clock induction, current time */ + +unsigned double_used : 1; +unsigned do_strip_brackets : 1; +unsigned clock_compress : 1; +unsigned zmode : 1; /* for value changes */ +unsigned emitted : 1; /* gate off change field zmode changes when set */ +}; + + +struct lt_symbol +{ +struct lt_symbol *next; +struct lt_symbol *symchain; +char *name; +int namlen; + +int facnum; +struct lt_symbol *aliased_to; + +unsigned int rows; +int msb, lsb; +int len; +int flags; + +unsigned int last_change; + +lxttime_t clk_delta; +lxttime_t clk_prevtrans; +int clk_numtrans; +int clk_prevval; +int clk_prevval1; +int clk_prevval2; +int clk_prevval3; +int clk_prevval4; +unsigned char clk_mask; +}; + +#define LT_SYM_F_BITS (0) +#define LT_SYM_F_INTEGER (1<<0) +#define LT_SYM_F_DOUBLE (1<<1) +#define LT_SYM_F_STRING (1<<2) +#define LT_SYM_F_ALIAS (1<<3) + + +struct lt_trace * lt_init(const char *name); +void lt_close(struct lt_trace *lt); + +struct lt_symbol * lt_symbol_find(struct lt_trace *lt, const char *name); +struct lt_symbol * lt_symbol_add(struct lt_trace *lt, const char *name, unsigned int rows, int msb, int lsb, int flags); +struct lt_symbol * lt_symbol_alias(struct lt_trace *lt, const char *existing_name, const char *alias, int msb, int lsb); +void lt_symbol_bracket_stripping(struct lt_trace *lt, int doit); + +void lt_set_chg_compress(struct lt_trace *lt); +void lt_set_clock_compress(struct lt_trace *lt); +void lt_set_initial_value(struct lt_trace *lt, char value); +void lt_set_timescale(struct lt_trace *lt, int timescale); + +int lt_set_time(struct lt_trace *lt, unsigned int timeval); +int lt_inc_time_by_delta(struct lt_trace *lt, unsigned int timeval); +int lt_set_time64(struct lt_trace *lt, lxttime_t timeval); +int lt_inc_time_by_delta64(struct lt_trace *lt, lxttime_t timeval); + +/* + * value change functions..note that if the value string len for + * lt_emit_value_bit_string() is shorter than the symbol length + * it will be left justified with the rightmost character used as + * a repeat value that will be propagated to pad the value string out: + * + * "10x" for 8 bits becomes "10xxxxxx" + * "z" for 8 bits becomes "zzzzzzzz" + */ +int lt_emit_value_int(struct lt_trace *lt, struct lt_symbol *s, unsigned int row, int value); +int lt_emit_value_double(struct lt_trace *lt, struct lt_symbol *s, unsigned int row, double value); +int lt_emit_value_string(struct lt_trace *lt, struct lt_symbol *s, unsigned int row, char *value); +int lt_emit_value_bit_string(struct lt_trace *lt, struct lt_symbol *s, unsigned int row, char *value); + +#endif diff --git a/lxt/test.v b/lxt/test.v new file mode 100644 index 0000000..80cd390 --- /dev/null +++ b/lxt/test.v @@ -0,0 +1,66 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +`timescale 1 ns /1 ps +module inv(o,i); +input i; +output o; + +assign o = ~i; + +endmodule + +module test; +reg clk; +wire clk1; +wire clk2; +wire clk3; +integer count; +time t1; +event xevent; +real xyz; + +initial begin + $lxt_recordvars(); + xyz = 0.0001; + #1 + clk = 0; + count = 0; + #10000000 $finish; +end + +always begin + clk = 0; + clk <= #5 1; + #10; +end + +always @(posedge clk) begin + t1 = $time; + count = count+1; + xyz = xyz + xyz; + -> xevent; +end + +inv i0(clk1,clk); +inv i1(clk2,clk1); +inv i2(clk3,clk2); + +endmodule + diff --git a/replace/Makefile.am b/replace/Makefile.am new file mode 100644 index 0000000..f7a4e9c --- /dev/null +++ b/replace/Makefile.am @@ -0,0 +1,6 @@ +INCLUDES = -I$(top_builddir) -I$(top_srcdir) + +noinst_LTLIBRARIES = libreplace.la +libreplace_la_SOURCES = +libreplace_la_LIBADD = $(LTLIBOBJS) + diff --git a/replace/Makefile.in b/replace/Makefile.in new file mode 100644 index 0000000..00ddc2f --- /dev/null +++ b/replace/Makefile.in @@ -0,0 +1,431 @@ +# Makefile.in generated by automake 1.9.5 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@ + +SOURCES = $(libreplace_la_SOURCES) + +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 = replace +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in malloc.c \ + readline.c vfscanf.c +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = @LTLIBOBJS@ +libreplace_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libreplace_la_OBJECTS = +libreplace_la_OBJECTS = $(am_libreplace_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libreplace_la_SOURCES) +DIST_SOURCES = $(libreplace_la_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@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +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@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_LXT_FALSE = @USE_LXT_FALSE@ +USE_LXT_TRUE = @USE_LXT_TRUE@ +VERSION = @VERSION@ +XGPERF = @XGPERF@ +YACC = @YACC@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +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@ +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@ +INCLUDES = -I$(top_builddir) -I$(top_srcdir) +noinst_LTLIBRARIES = libreplace.la +libreplace_la_SOURCES = +libreplace_la_LIBADD = $(LTLIBOBJS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu replace/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu replace/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libreplace.la: $(libreplace_la_OBJECTS) $(libreplace_la_DEPENDENCIES) + $(LINK) $(libreplace_la_LDFLAGS) $(libreplace_la_OBJECTS) $(libreplace_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/malloc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/readline.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vfscanf.Plo@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) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +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: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf $(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +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 \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + 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-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + 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/replace/malloc.c b/replace/malloc.c new file mode 100644 index 0000000..13fb2ec --- /dev/null +++ b/replace/malloc.c @@ -0,0 +1,13 @@ +#if HAVE_CONFIG_H +# include +#endif +#undef malloc + +#include + +void *malloc (); + +/* Allocate an N-byte block of memory from the heap. If N is zero, allocate a 1-byte block. */ + +void * rpl_malloc (size_t n) { if (n == 0) n = 1; return malloc (n); } + diff --git a/replace/readline.c b/replace/readline.c new file mode 100644 index 0000000..1e746b8 --- /dev/null +++ b/replace/readline.c @@ -0,0 +1,39 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/************************************************************** + readline replacment functions + **************************************************************/ + +#include +#include + +char *readline( char* prompt ) +{ + char buffer[256]; + char* result; + if( prompt ) { + printf( "%s ", prompt ); + } + result = fgets( buffer, sizeof(buffer), stdin ); + if( result ) { + result = strdup( result ); + } + return result; +} diff --git a/replace/vfscanf.c b/replace/vfscanf.c new file mode 100644 index 0000000..a696e51 --- /dev/null +++ b/replace/vfscanf.c @@ -0,0 +1,40 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/************************************************************** + vfscanf replacment functions + **************************************************************/ + +#include +#include + +int vfscanf(FILE *stream, const char *format, va_list ap) +{ + + if( !strcmp( format, "%s" ) ) { + char* p = va_arg(ap,char*); + fscanf( stream, format, p ); + } else if( !strcmp( format, "%lx" ) ) { + long* p = va_arg(ap,long*); + fscanf( stream, format, p ); + } else { + fprintf( stderr, "FIXME: format '%s' is currently unsupported in replacement vfscanf\n", format ); + abort(); + } +} diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..c79bacf --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,44 @@ +if USE_LXT + LXTLIB=../lxt/liblxt.la + ZLIB=-lz +endif +libveriwell_la_CPPFLAGS = -DBINDIR=\"$(bindir)\" \ + -DLIBDIR=\"$(libdir)\" \ + -DINCLUDEDIR=\"$(includedir)\" \ + -DCFLAGS="\"$(CFLAGS)\"" \ + -DLDFLAGS="\"$(LDFLAGS)\"" \ + -DLIBS="\"$(LIBS) $(ZLIB)\"" +nobase_include_HEADERS = veriuser.h acc_user.h veriuser.c + +bin_PROGRAMS = veriwell +veriwell_SOURCES = defaultveriuser.cc +veriwell_LDADD = $(vl_cv_lib_readline) libveriwell.la $(ZLIB) + +AM_GPEFLAGS= -L C++ -a -p -j1 -i 1 -g -o -t -N is_reserved_word +EXTRA_DIST = v.h +GPE = gperf +.gpe.h: + $(GPE) $(GPEFLAGS) $(AM_GPEFLAGS) $< > $@ + + +lib_LTLIBRARIES = libveriwell.la +libveriwell_la_SOURCES = parse.yy multdiv.cc print.cc usertask.cc flags.cc store.cc \ + nsched.cc verisys.cc check.cc gates.cc schedule.cc \ + strobe.cc glue.cc obstack.cc scope.cc \ + systask.cc copy.cc veriwell.cc pass2.cc sdf.cc timescal.cc \ + sdfclex.cc decl.cc io.cc pass3.cc trace.cc dumpvar.cc \ + lex.cc pli.cc tree.cc sdflex.cc eval.cc macro.cc plihacks.cc \ + udp.cc exec.cc specify.cc sdfcpars.yy sdfparse.yy v.gpe \ + acc_user.h check.h copy.h decl.h dumpvar.h eval.h \ + exec.h flags.h gates.h glue.h io.h lex.h macro.h multdiv.h \ + nsched.h obstack.h parse.h pass2.h pass3.h pli.h plihacks.h \ + print.h runtime.h schedule.h scope.h sdfclex.h sdfcpars.h \ + sdf.h sdflex.h sdfparse.h specify.h store.h strobe.h \ + systask.h timescal.h trace.h tree.h udp.h usertask.h \ + verisys.h veriuser.h veriwell.h v.h vtypes.h tree.def +libveriwell_la_LDFLAGS = -version-info 0:0:0 +libveriwell_la_LIBADD = $(LXTLIB) ../replace/libreplace.la + +AM_YFLAGS = -y -d + + diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..b90c761 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,927 @@ +# Makefile.in generated by automake 1.9.5 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@ + + + +SOURCES = $(libveriwell_la_SOURCES) $(veriwell_SOURCES) + +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 = veriwell$(EXEEXT) +subdir = src +DIST_COMMON = $(nobase_include_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in parse.cc parse.h sdfcpars.cc sdfcpars.h \ + sdfparse.cc sdfparse.h +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +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)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(includedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +@USE_LXT_TRUE@am__DEPENDENCIES_1 = ../lxt/liblxt.la +libveriwell_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + ../replace/libreplace.la +am_libveriwell_la_OBJECTS = libveriwell_la-parse.lo \ + libveriwell_la-multdiv.lo libveriwell_la-print.lo \ + libveriwell_la-usertask.lo libveriwell_la-flags.lo \ + libveriwell_la-store.lo libveriwell_la-nsched.lo \ + libveriwell_la-verisys.lo libveriwell_la-check.lo \ + libveriwell_la-gates.lo libveriwell_la-schedule.lo \ + libveriwell_la-strobe.lo libveriwell_la-glue.lo \ + libveriwell_la-obstack.lo libveriwell_la-scope.lo \ + libveriwell_la-systask.lo libveriwell_la-copy.lo \ + libveriwell_la-veriwell.lo libveriwell_la-pass2.lo \ + libveriwell_la-sdf.lo libveriwell_la-timescal.lo \ + libveriwell_la-sdfclex.lo libveriwell_la-decl.lo \ + libveriwell_la-io.lo libveriwell_la-pass3.lo \ + libveriwell_la-trace.lo libveriwell_la-dumpvar.lo \ + libveriwell_la-lex.lo libveriwell_la-pli.lo \ + libveriwell_la-tree.lo libveriwell_la-sdflex.lo \ + libveriwell_la-eval.lo libveriwell_la-macro.lo \ + libveriwell_la-plihacks.lo libveriwell_la-udp.lo \ + libveriwell_la-exec.lo libveriwell_la-specify.lo \ + libveriwell_la-sdfcpars.lo libveriwell_la-sdfparse.lo +libveriwell_la_OBJECTS = $(am_libveriwell_la_OBJECTS) +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_veriwell_OBJECTS = defaultveriuser.$(OBJEXT) +veriwell_OBJECTS = $(am_veriwell_OBJECTS) +am__DEPENDENCIES_2 = +veriwell_DEPENDENCIES = libveriwell.la $(am__DEPENDENCIES_2) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) +LTYACCCOMPILE = $(LIBTOOL) --mode=compile $(YACC) $(YFLAGS) \ + $(AM_YFLAGS) +YLWRAP = $(top_srcdir)/config/ylwrap +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libveriwell_la_SOURCES) $(veriwell_SOURCES) +DIST_SOURCES = $(libveriwell_la_SOURCES) $(veriwell_SOURCES) +nobase_includeHEADERS_INSTALL = $(install_sh_DATA) +HEADERS = $(nobase_include_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +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@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_LXT_FALSE = @USE_LXT_FALSE@ +USE_LXT_TRUE = @USE_LXT_TRUE@ +VERSION = @VERSION@ +XGPERF = @XGPERF@ +YACC = @YACC@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +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@ +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@ +@USE_LXT_TRUE@LXTLIB = ../lxt/liblxt.la +@USE_LXT_TRUE@ZLIB = -lz +libveriwell_la_CPPFLAGS = -DBINDIR=\"$(bindir)\" \ + -DLIBDIR=\"$(libdir)\" \ + -DINCLUDEDIR=\"$(includedir)\" \ + -DCFLAGS="\"$(CFLAGS)\"" \ + -DLDFLAGS="\"$(LDFLAGS)\"" \ + -DLIBS="\"$(LIBS) $(ZLIB)\"" + +nobase_include_HEADERS = veriuser.h acc_user.h veriuser.c +veriwell_SOURCES = defaultveriuser.cc +veriwell_LDADD = $(vl_cv_lib_readline) libveriwell.la $(ZLIB) +AM_GPEFLAGS = -L C++ -a -p -j1 -i 1 -g -o -t -N is_reserved_word +EXTRA_DIST = v.h +GPE = gperf +lib_LTLIBRARIES = libveriwell.la +libveriwell_la_SOURCES = parse.yy multdiv.cc print.cc usertask.cc flags.cc store.cc \ + nsched.cc verisys.cc check.cc gates.cc schedule.cc \ + strobe.cc glue.cc obstack.cc scope.cc \ + systask.cc copy.cc veriwell.cc pass2.cc sdf.cc timescal.cc \ + sdfclex.cc decl.cc io.cc pass3.cc trace.cc dumpvar.cc \ + lex.cc pli.cc tree.cc sdflex.cc eval.cc macro.cc plihacks.cc \ + udp.cc exec.cc specify.cc sdfcpars.yy sdfparse.yy v.gpe \ + acc_user.h check.h copy.h decl.h dumpvar.h eval.h \ + exec.h flags.h gates.h glue.h io.h lex.h macro.h multdiv.h \ + nsched.h obstack.h parse.h pass2.h pass3.h pli.h plihacks.h \ + print.h runtime.h schedule.h scope.h sdfclex.h sdfcpars.h \ + sdf.h sdflex.h sdfparse.h specify.h store.h strobe.h \ + systask.h timescal.h trace.h tree.h udp.h usertask.h \ + verisys.h veriuser.h veriwell.h v.h vtypes.h tree.def + +libveriwell_la_LDFLAGS = -version-info 0:0:0 +libveriwell_la_LIBADD = $(LXTLIB) ../replace/libreplace.la +AM_YFLAGS = -y -d +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .gpe .h .lo .o .obj .yy +$(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-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +parse.h: parse.cc + @if test ! -f $@; then \ + rm -f parse.cc; \ + $(MAKE) parse.cc; \ + else :; fi +sdfcpars.h: sdfcpars.cc + @if test ! -f $@; then \ + rm -f sdfcpars.cc; \ + $(MAKE) sdfcpars.cc; \ + else :; fi +sdfparse.h: sdfparse.cc + @if test ! -f $@; then \ + rm -f sdfparse.cc; \ + $(MAKE) sdfparse.cc; \ + else :; fi +libveriwell.la: $(libveriwell_la_OBJECTS) $(libveriwell_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libveriwell_la_LDFLAGS) $(libveriwell_la_OBJECTS) $(libveriwell_la_LIBADD) $(LIBS) +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 \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(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: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +veriwell$(EXEEXT): $(veriwell_OBJECTS) $(veriwell_DEPENDENCIES) + @rm -f veriwell$(EXEEXT) + $(CXXLINK) $(veriwell_LDFLAGS) $(veriwell_OBJECTS) $(veriwell_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defaultveriuser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-check.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-copy.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-decl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-dumpvar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-eval.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-exec.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-flags.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-gates.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-glue.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-io.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-lex.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-macro.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-multdiv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-nsched.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-obstack.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-parse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-pass2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-pass3.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-pli.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-plihacks.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-print.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-schedule.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-scope.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-sdf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-sdfclex.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-sdfcpars.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-sdflex.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-sdfparse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-specify.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-store.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-strobe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-systask.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-timescal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-trace.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-tree.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-udp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-usertask.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-verisys.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libveriwell_la-veriwell.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +libveriwell_la-parse.lo: parse.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-parse.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-parse.Tpo" -c -o libveriwell_la-parse.lo `test -f 'parse.cc' || echo '$(srcdir)/'`parse.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-parse.Tpo" "$(DEPDIR)/libveriwell_la-parse.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-parse.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parse.cc' object='libveriwell_la-parse.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-parse.lo `test -f 'parse.cc' || echo '$(srcdir)/'`parse.cc + +libveriwell_la-multdiv.lo: multdiv.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-multdiv.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-multdiv.Tpo" -c -o libveriwell_la-multdiv.lo `test -f 'multdiv.cc' || echo '$(srcdir)/'`multdiv.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-multdiv.Tpo" "$(DEPDIR)/libveriwell_la-multdiv.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-multdiv.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='multdiv.cc' object='libveriwell_la-multdiv.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-multdiv.lo `test -f 'multdiv.cc' || echo '$(srcdir)/'`multdiv.cc + +libveriwell_la-print.lo: print.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-print.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-print.Tpo" -c -o libveriwell_la-print.lo `test -f 'print.cc' || echo '$(srcdir)/'`print.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-print.Tpo" "$(DEPDIR)/libveriwell_la-print.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-print.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='print.cc' object='libveriwell_la-print.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-print.lo `test -f 'print.cc' || echo '$(srcdir)/'`print.cc + +libveriwell_la-usertask.lo: usertask.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-usertask.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-usertask.Tpo" -c -o libveriwell_la-usertask.lo `test -f 'usertask.cc' || echo '$(srcdir)/'`usertask.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-usertask.Tpo" "$(DEPDIR)/libveriwell_la-usertask.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-usertask.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='usertask.cc' object='libveriwell_la-usertask.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-usertask.lo `test -f 'usertask.cc' || echo '$(srcdir)/'`usertask.cc + +libveriwell_la-flags.lo: flags.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-flags.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-flags.Tpo" -c -o libveriwell_la-flags.lo `test -f 'flags.cc' || echo '$(srcdir)/'`flags.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-flags.Tpo" "$(DEPDIR)/libveriwell_la-flags.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-flags.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='flags.cc' object='libveriwell_la-flags.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-flags.lo `test -f 'flags.cc' || echo '$(srcdir)/'`flags.cc + +libveriwell_la-store.lo: store.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-store.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-store.Tpo" -c -o libveriwell_la-store.lo `test -f 'store.cc' || echo '$(srcdir)/'`store.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-store.Tpo" "$(DEPDIR)/libveriwell_la-store.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-store.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='store.cc' object='libveriwell_la-store.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-store.lo `test -f 'store.cc' || echo '$(srcdir)/'`store.cc + +libveriwell_la-nsched.lo: nsched.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-nsched.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-nsched.Tpo" -c -o libveriwell_la-nsched.lo `test -f 'nsched.cc' || echo '$(srcdir)/'`nsched.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-nsched.Tpo" "$(DEPDIR)/libveriwell_la-nsched.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-nsched.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='nsched.cc' object='libveriwell_la-nsched.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-nsched.lo `test -f 'nsched.cc' || echo '$(srcdir)/'`nsched.cc + +libveriwell_la-verisys.lo: verisys.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-verisys.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-verisys.Tpo" -c -o libveriwell_la-verisys.lo `test -f 'verisys.cc' || echo '$(srcdir)/'`verisys.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-verisys.Tpo" "$(DEPDIR)/libveriwell_la-verisys.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-verisys.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='verisys.cc' object='libveriwell_la-verisys.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-verisys.lo `test -f 'verisys.cc' || echo '$(srcdir)/'`verisys.cc + +libveriwell_la-check.lo: check.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-check.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-check.Tpo" -c -o libveriwell_la-check.lo `test -f 'check.cc' || echo '$(srcdir)/'`check.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-check.Tpo" "$(DEPDIR)/libveriwell_la-check.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-check.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='check.cc' object='libveriwell_la-check.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-check.lo `test -f 'check.cc' || echo '$(srcdir)/'`check.cc + +libveriwell_la-gates.lo: gates.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-gates.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-gates.Tpo" -c -o libveriwell_la-gates.lo `test -f 'gates.cc' || echo '$(srcdir)/'`gates.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-gates.Tpo" "$(DEPDIR)/libveriwell_la-gates.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-gates.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='gates.cc' object='libveriwell_la-gates.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-gates.lo `test -f 'gates.cc' || echo '$(srcdir)/'`gates.cc + +libveriwell_la-schedule.lo: schedule.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-schedule.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-schedule.Tpo" -c -o libveriwell_la-schedule.lo `test -f 'schedule.cc' || echo '$(srcdir)/'`schedule.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-schedule.Tpo" "$(DEPDIR)/libveriwell_la-schedule.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-schedule.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='schedule.cc' object='libveriwell_la-schedule.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-schedule.lo `test -f 'schedule.cc' || echo '$(srcdir)/'`schedule.cc + +libveriwell_la-strobe.lo: strobe.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-strobe.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-strobe.Tpo" -c -o libveriwell_la-strobe.lo `test -f 'strobe.cc' || echo '$(srcdir)/'`strobe.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-strobe.Tpo" "$(DEPDIR)/libveriwell_la-strobe.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-strobe.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strobe.cc' object='libveriwell_la-strobe.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-strobe.lo `test -f 'strobe.cc' || echo '$(srcdir)/'`strobe.cc + +libveriwell_la-glue.lo: glue.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-glue.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-glue.Tpo" -c -o libveriwell_la-glue.lo `test -f 'glue.cc' || echo '$(srcdir)/'`glue.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-glue.Tpo" "$(DEPDIR)/libveriwell_la-glue.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-glue.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='glue.cc' object='libveriwell_la-glue.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-glue.lo `test -f 'glue.cc' || echo '$(srcdir)/'`glue.cc + +libveriwell_la-obstack.lo: obstack.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-obstack.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-obstack.Tpo" -c -o libveriwell_la-obstack.lo `test -f 'obstack.cc' || echo '$(srcdir)/'`obstack.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-obstack.Tpo" "$(DEPDIR)/libveriwell_la-obstack.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-obstack.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='obstack.cc' object='libveriwell_la-obstack.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-obstack.lo `test -f 'obstack.cc' || echo '$(srcdir)/'`obstack.cc + +libveriwell_la-scope.lo: scope.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-scope.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-scope.Tpo" -c -o libveriwell_la-scope.lo `test -f 'scope.cc' || echo '$(srcdir)/'`scope.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-scope.Tpo" "$(DEPDIR)/libveriwell_la-scope.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-scope.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scope.cc' object='libveriwell_la-scope.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-scope.lo `test -f 'scope.cc' || echo '$(srcdir)/'`scope.cc + +libveriwell_la-systask.lo: systask.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-systask.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-systask.Tpo" -c -o libveriwell_la-systask.lo `test -f 'systask.cc' || echo '$(srcdir)/'`systask.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-systask.Tpo" "$(DEPDIR)/libveriwell_la-systask.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-systask.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='systask.cc' object='libveriwell_la-systask.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-systask.lo `test -f 'systask.cc' || echo '$(srcdir)/'`systask.cc + +libveriwell_la-copy.lo: copy.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-copy.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-copy.Tpo" -c -o libveriwell_la-copy.lo `test -f 'copy.cc' || echo '$(srcdir)/'`copy.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-copy.Tpo" "$(DEPDIR)/libveriwell_la-copy.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-copy.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='copy.cc' object='libveriwell_la-copy.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-copy.lo `test -f 'copy.cc' || echo '$(srcdir)/'`copy.cc + +libveriwell_la-veriwell.lo: veriwell.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-veriwell.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-veriwell.Tpo" -c -o libveriwell_la-veriwell.lo `test -f 'veriwell.cc' || echo '$(srcdir)/'`veriwell.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-veriwell.Tpo" "$(DEPDIR)/libveriwell_la-veriwell.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-veriwell.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='veriwell.cc' object='libveriwell_la-veriwell.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-veriwell.lo `test -f 'veriwell.cc' || echo '$(srcdir)/'`veriwell.cc + +libveriwell_la-pass2.lo: pass2.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-pass2.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-pass2.Tpo" -c -o libveriwell_la-pass2.lo `test -f 'pass2.cc' || echo '$(srcdir)/'`pass2.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-pass2.Tpo" "$(DEPDIR)/libveriwell_la-pass2.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-pass2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='pass2.cc' object='libveriwell_la-pass2.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-pass2.lo `test -f 'pass2.cc' || echo '$(srcdir)/'`pass2.cc + +libveriwell_la-sdf.lo: sdf.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-sdf.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-sdf.Tpo" -c -o libveriwell_la-sdf.lo `test -f 'sdf.cc' || echo '$(srcdir)/'`sdf.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-sdf.Tpo" "$(DEPDIR)/libveriwell_la-sdf.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-sdf.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sdf.cc' object='libveriwell_la-sdf.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-sdf.lo `test -f 'sdf.cc' || echo '$(srcdir)/'`sdf.cc + +libveriwell_la-timescal.lo: timescal.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-timescal.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-timescal.Tpo" -c -o libveriwell_la-timescal.lo `test -f 'timescal.cc' || echo '$(srcdir)/'`timescal.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-timescal.Tpo" "$(DEPDIR)/libveriwell_la-timescal.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-timescal.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='timescal.cc' object='libveriwell_la-timescal.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-timescal.lo `test -f 'timescal.cc' || echo '$(srcdir)/'`timescal.cc + +libveriwell_la-sdfclex.lo: sdfclex.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-sdfclex.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-sdfclex.Tpo" -c -o libveriwell_la-sdfclex.lo `test -f 'sdfclex.cc' || echo '$(srcdir)/'`sdfclex.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-sdfclex.Tpo" "$(DEPDIR)/libveriwell_la-sdfclex.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-sdfclex.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sdfclex.cc' object='libveriwell_la-sdfclex.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-sdfclex.lo `test -f 'sdfclex.cc' || echo '$(srcdir)/'`sdfclex.cc + +libveriwell_la-decl.lo: decl.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-decl.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-decl.Tpo" -c -o libveriwell_la-decl.lo `test -f 'decl.cc' || echo '$(srcdir)/'`decl.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-decl.Tpo" "$(DEPDIR)/libveriwell_la-decl.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-decl.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='decl.cc' object='libveriwell_la-decl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-decl.lo `test -f 'decl.cc' || echo '$(srcdir)/'`decl.cc + +libveriwell_la-io.lo: io.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-io.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-io.Tpo" -c -o libveriwell_la-io.lo `test -f 'io.cc' || echo '$(srcdir)/'`io.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-io.Tpo" "$(DEPDIR)/libveriwell_la-io.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='io.cc' object='libveriwell_la-io.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-io.lo `test -f 'io.cc' || echo '$(srcdir)/'`io.cc + +libveriwell_la-pass3.lo: pass3.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-pass3.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-pass3.Tpo" -c -o libveriwell_la-pass3.lo `test -f 'pass3.cc' || echo '$(srcdir)/'`pass3.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-pass3.Tpo" "$(DEPDIR)/libveriwell_la-pass3.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-pass3.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='pass3.cc' object='libveriwell_la-pass3.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-pass3.lo `test -f 'pass3.cc' || echo '$(srcdir)/'`pass3.cc + +libveriwell_la-trace.lo: trace.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-trace.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-trace.Tpo" -c -o libveriwell_la-trace.lo `test -f 'trace.cc' || echo '$(srcdir)/'`trace.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-trace.Tpo" "$(DEPDIR)/libveriwell_la-trace.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-trace.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='trace.cc' object='libveriwell_la-trace.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-trace.lo `test -f 'trace.cc' || echo '$(srcdir)/'`trace.cc + +libveriwell_la-dumpvar.lo: dumpvar.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-dumpvar.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-dumpvar.Tpo" -c -o libveriwell_la-dumpvar.lo `test -f 'dumpvar.cc' || echo '$(srcdir)/'`dumpvar.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-dumpvar.Tpo" "$(DEPDIR)/libveriwell_la-dumpvar.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-dumpvar.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dumpvar.cc' object='libveriwell_la-dumpvar.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-dumpvar.lo `test -f 'dumpvar.cc' || echo '$(srcdir)/'`dumpvar.cc + +libveriwell_la-lex.lo: lex.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-lex.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-lex.Tpo" -c -o libveriwell_la-lex.lo `test -f 'lex.cc' || echo '$(srcdir)/'`lex.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-lex.Tpo" "$(DEPDIR)/libveriwell_la-lex.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-lex.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lex.cc' object='libveriwell_la-lex.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-lex.lo `test -f 'lex.cc' || echo '$(srcdir)/'`lex.cc + +libveriwell_la-pli.lo: pli.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-pli.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-pli.Tpo" -c -o libveriwell_la-pli.lo `test -f 'pli.cc' || echo '$(srcdir)/'`pli.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-pli.Tpo" "$(DEPDIR)/libveriwell_la-pli.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-pli.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='pli.cc' object='libveriwell_la-pli.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-pli.lo `test -f 'pli.cc' || echo '$(srcdir)/'`pli.cc + +libveriwell_la-tree.lo: tree.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-tree.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-tree.Tpo" -c -o libveriwell_la-tree.lo `test -f 'tree.cc' || echo '$(srcdir)/'`tree.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-tree.Tpo" "$(DEPDIR)/libveriwell_la-tree.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-tree.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tree.cc' object='libveriwell_la-tree.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-tree.lo `test -f 'tree.cc' || echo '$(srcdir)/'`tree.cc + +libveriwell_la-sdflex.lo: sdflex.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-sdflex.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-sdflex.Tpo" -c -o libveriwell_la-sdflex.lo `test -f 'sdflex.cc' || echo '$(srcdir)/'`sdflex.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-sdflex.Tpo" "$(DEPDIR)/libveriwell_la-sdflex.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-sdflex.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sdflex.cc' object='libveriwell_la-sdflex.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-sdflex.lo `test -f 'sdflex.cc' || echo '$(srcdir)/'`sdflex.cc + +libveriwell_la-eval.lo: eval.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-eval.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-eval.Tpo" -c -o libveriwell_la-eval.lo `test -f 'eval.cc' || echo '$(srcdir)/'`eval.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-eval.Tpo" "$(DEPDIR)/libveriwell_la-eval.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-eval.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='eval.cc' object='libveriwell_la-eval.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-eval.lo `test -f 'eval.cc' || echo '$(srcdir)/'`eval.cc + +libveriwell_la-macro.lo: macro.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-macro.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-macro.Tpo" -c -o libveriwell_la-macro.lo `test -f 'macro.cc' || echo '$(srcdir)/'`macro.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-macro.Tpo" "$(DEPDIR)/libveriwell_la-macro.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-macro.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='macro.cc' object='libveriwell_la-macro.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-macro.lo `test -f 'macro.cc' || echo '$(srcdir)/'`macro.cc + +libveriwell_la-plihacks.lo: plihacks.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-plihacks.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-plihacks.Tpo" -c -o libveriwell_la-plihacks.lo `test -f 'plihacks.cc' || echo '$(srcdir)/'`plihacks.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-plihacks.Tpo" "$(DEPDIR)/libveriwell_la-plihacks.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-plihacks.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='plihacks.cc' object='libveriwell_la-plihacks.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-plihacks.lo `test -f 'plihacks.cc' || echo '$(srcdir)/'`plihacks.cc + +libveriwell_la-udp.lo: udp.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-udp.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-udp.Tpo" -c -o libveriwell_la-udp.lo `test -f 'udp.cc' || echo '$(srcdir)/'`udp.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-udp.Tpo" "$(DEPDIR)/libveriwell_la-udp.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-udp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='udp.cc' object='libveriwell_la-udp.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-udp.lo `test -f 'udp.cc' || echo '$(srcdir)/'`udp.cc + +libveriwell_la-exec.lo: exec.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-exec.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-exec.Tpo" -c -o libveriwell_la-exec.lo `test -f 'exec.cc' || echo '$(srcdir)/'`exec.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-exec.Tpo" "$(DEPDIR)/libveriwell_la-exec.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-exec.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='exec.cc' object='libveriwell_la-exec.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-exec.lo `test -f 'exec.cc' || echo '$(srcdir)/'`exec.cc + +libveriwell_la-specify.lo: specify.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-specify.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-specify.Tpo" -c -o libveriwell_la-specify.lo `test -f 'specify.cc' || echo '$(srcdir)/'`specify.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-specify.Tpo" "$(DEPDIR)/libveriwell_la-specify.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-specify.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='specify.cc' object='libveriwell_la-specify.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-specify.lo `test -f 'specify.cc' || echo '$(srcdir)/'`specify.cc + +libveriwell_la-sdfcpars.lo: sdfcpars.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-sdfcpars.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-sdfcpars.Tpo" -c -o libveriwell_la-sdfcpars.lo `test -f 'sdfcpars.cc' || echo '$(srcdir)/'`sdfcpars.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-sdfcpars.Tpo" "$(DEPDIR)/libveriwell_la-sdfcpars.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-sdfcpars.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sdfcpars.cc' object='libveriwell_la-sdfcpars.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-sdfcpars.lo `test -f 'sdfcpars.cc' || echo '$(srcdir)/'`sdfcpars.cc + +libveriwell_la-sdfparse.lo: sdfparse.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libveriwell_la-sdfparse.lo -MD -MP -MF "$(DEPDIR)/libveriwell_la-sdfparse.Tpo" -c -o libveriwell_la-sdfparse.lo `test -f 'sdfparse.cc' || echo '$(srcdir)/'`sdfparse.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libveriwell_la-sdfparse.Tpo" "$(DEPDIR)/libveriwell_la-sdfparse.Plo"; else rm -f "$(DEPDIR)/libveriwell_la-sdfparse.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sdfparse.cc' object='libveriwell_la-sdfparse.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libveriwell_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libveriwell_la-sdfparse.lo `test -f 'sdfparse.cc' || echo '$(srcdir)/'`sdfparse.cc + +.yy.cc: + $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-nobase_includeHEADERS: $(nobase_include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" + @$(am__vpath_adj_setup) \ + list='$(nobase_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + $(am__vpath_adj) \ + echo " $(nobase_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ + $(nobase_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ + done + +uninstall-nobase_includeHEADERS: + @$(NORMAL_UNINSTALL) + @$(am__vpath_adj_setup) \ + list='$(nobase_include_HEADERS)'; for p in $$list; do \ + $(am__vpath_adj) \ + echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(includedir)/$$f"; \ + 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: $(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: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) +install-binPROGRAMS: install-libLTLIBRARIES + +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; 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." + -rm -f parse.cc + -rm -f parse.h + -rm -f sdfcpars.cc + -rm -f sdfcpars.h + -rm -f sdfparse.cc + -rm -f sdfparse.h +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-nobase_includeHEADERS + +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + +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 \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ + uninstall-libLTLIBRARIES uninstall-nobase_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libLTLIBRARIES clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-man install-nobase_includeHEADERS install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-info-am uninstall-libLTLIBRARIES \ + uninstall-nobase_includeHEADERS + +.gpe.h: + $(GPE) $(GPEFLAGS) $(AM_GPEFLAGS) $< > $@ +# 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/acc_user.h b/src/acc_user.h new file mode 100644 index 0000000..bf88e52 --- /dev/null +++ b/src/acc_user.h @@ -0,0 +1,661 @@ +/**************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* ACC_USER.C - PLI access routine header */ + +#ifndef ACC_USER_H +#define ACC_USER_H + + + +/**********************************************************************/ +/*** General constant definitions ***/ + + +typedef int *handle; + +#define bool int +#define true 1 +#define TRUE 1 +#define false 0 +#define FALSE 0 + +#define global extern +#define exfunc +#define local static +#define null 0L + +extern bool acc_error_flag; + + +/**********************************************************************/ +/*** Type and configuration constant definitions ***/ + +#define accModule 20 +#define accScope 21 +#define accNet 25 +#define accReg 30 +#define accRegister 30 +#define accPort 35 +#define accTerminal 45 +#define accInputTerminal 46 +#define accOutputTerminal 47 +#define accInoutTerminal 48 +#define accCombPrim 140 +#define accSeqPrim 142 +#define accAndGate 144 +#define accNandGate 146 +#define accNorGate 148 +#define accOrGate 150 +#define accXorGate 152 +#define accXnorGate 154 +#define accBufGate 156 +#define accNotGate 158 +#define accBufif0Gate 160 +#define accBufif1Gate 162 +#define accNotif0Gate 164 +#define accNotif1Gate 166 +#define accNmosGate 168 +#define accPmosGate 170 +#define accCmosGate 172 +#define accRnmosGate 174 +#define accRpmosGate 176 +#define accRcmosGate 178 +#define accRtranGate 180 +#define accRtranif0Gate 182 +#define accRtranif1Gate 184 +#define accTranGate 186 +#define accTranif0Gate 188 +#define accTranif1Gate 190 +#define accPullupGate 192 +#define accPulldownGate 194 +#define accIntegerParam 200 +#define accIntParam 200 +#define accRealParam 202 +#define accStringParam 204 +#define accPath 206 +#define accTchk 208 +#define accPrimitive 210 +#define accBit 212 +#define accPortBit 214 +#define accNetBit 216 +#define accRegBit 218 +#define accParameter 220 +#define accSpecparam 222 +#define accTopModule 224 +#define accModuleInstance 226 +#define accCellInstance 228 +#define accModPath 230 +#define accPrimPath 232 +#define accWirePath 234 +#define accModNetPath 236 /*alias for accInterModPath */ +#define accInterModPath 236 +#define accTermPath 238 +#define accModTermPath 240 +#define accTermModPath 242 +#define accScalarPort 250 +#define accBitSelectPort 252 +#define accPartSelectPort 254 +#define accVectorPort 256 +#define accConcatPort 258 +#define accWire 260 +#define accWand 261 +#define accWor 262 +#define accTri 263 +#define accTriand 264 +#define accTrior 265 +#define accTri0 266 +#define accTri1 267 +#define accTrireg 268 +#define accSupply0 269 +#define accSupply1 270 +#define accNamedEvent 280 +#define accEventVar 280 +#define accIntegerVar 281 +#define accIntVar 281 +#define accRealVar 282 +#define accTimeVar 283 +#define accScalar 300 +#define accVector 302 +#define accCollapsedNet 304 +#define accExpandedVector 306 +#define accUnexpandedVector 307 +#define accProtected 308 +#define accVlogSimPath 310 +#define accExpandedPath 312 +#define accModPathHasIfnone 313 +#define accSwXlInvisibleNet 314 +#define accAcceleratedNet 316 +#define accSetup 366 +#define accHold 367 +#define accWidth 368 +#define accPeriod 369 +#define accRecovery 370 +#define accSkew 371 +#define accNochange 376 +#define accNoChange 376 +#define accSetuphold 377 +#define accInput 402 +#define accOutput 404 +#define accInout 406 +#define accMixedIo 407 +#define accPositive 408 +#define accNegative 410 +#define accUnknown 412 +#define accPathTerminal 420 +#define accPathInput 422 +#define accPathOutput 424 +#define accDataPath 426 +#define accTchkTerminal 428 +#define accBitSelect 500 +#define accPartSelect 502 +#define accTask 504 +#define accFunction 506 +#define accStatement 508 +#define accTaskCall 510 +#define accFunctionCall 512 +#define accSystemTask 514 +#define accSystemFunction 516 +#define accSystemRealFunction 518 +#define accUserTask 520 +#define accUserFunction 522 +#define accUserRealFunction 524 +#define accAssignmentStat 526 +#define accContAssignStat 527 +#define accNullStat 528 +#define accDelayStat 530 +#define accAssignDelayStat 532 +#define accRtlDelayStat 534 +#define accAssignEventStat 536 +#define accAssignMultiStat 537 +#define accRtlEventStat 538 +#define accRtlMultiStat 539 +#define accGenEventStat 540 +#define accDisableStat 542 +#define accAssignStat 544 +#define accDeassignStat 546 +#define accForceStat 548 +#define accReleaseStat 550 +#define accInitialStat 552 +#define accAlwaysStat 554 +#define accAtEventStat 556 +#define accUnnamedBeginStat 558 +#define accNamedBeginStat 560 +#define accUnnamedForkStat 562 +#define accNamedForkStat 564 +#define accIfStat 566 +#define accCaseStat 568 +#define accCaseZStat 570 +#define accCaseXStat 572 +#define accForeverStat 574 +#define accRepeatStat 576 +#define accWhileStat 578 +#define accForStat 580 +#define accWaitStat 582 +#define accConstant 600 +#define accConcat 610 +#define accOperator 620 + +/* acc_configure() parameters */ +#define accPathDelayCount 1 +#define accPathDelimStr 2 +#define accDisplayErrors 3 +#define accDefaultAttr0 4 +#define accToHiZDelay 5 +#define accEnableArgs 6 +#define accSpecitemScope 7 +#define accDisplayWarnings 8 +#define accWarnNestedLoconn 9 +#define accWarnNestedHiconn 10 +#define accDevelopmentVersion 11 +#define accMinMultiplier 12 +#define accTypMultiplier 13 +#define accMaxMultiplier 14 +#define accAttrDelimStr 15 +#define accDelayCount 16 +#define accMapToMipd 17 +#define accDelayArrays 18 +#define accMinTypMaxDelays 19 +#define accUserErrorString 20 +#define accTwoLimitChecks 21 + +/* Edge information used by acc_handle_tchk, etc. */ +#define accNoedge 0 +#define accNoEdge 0 +#define accEdge01 1 +#define accEdge10 2 +#define accEdge0x 4 +#define accEdgex1 8 +#define accEdge1x 16 +#define accEdgex0 32 +#define accPosedge 13 /* accEdge01 & accEdge0x & accEdgex1 */ +#define accPosEdge 13 /* accEdge01 & accEdge0x & accEdgex1 */ +#define accNegedge 50 /* accEdge10 & accEdge1x & accEdgex0 */ +#define accNegEdge 50 /* accEdge10 & accEdge1x & accEdgex0 */ + +/* Product types */ +#define accVerilog 1 +#define accVeritime 2 +#define accVerifault 3 + +/* Version defines */ +#define accVersion15Beta 1 +#define accVersion15a 2 +#define accVersion15b 3 +#define accVersion15b1 4 +#define accVersion15b2Beta 5 +#define accVersion15b2 6 +#define accVersion15b3 7 +#define accVersion15b4 8 +#define accVersion15b5 9 +#define accVersion15cBeta 12 +#define accVersion15c 16 +#define accVersion15c03 20 +#define accVersion15c04 21 +#define accVersion15c10 24 +#define accVersion15c30 28 +#define accVersion15c40 32 +#define accVersion15c41 33 +#define accVersion16Beta 36 +#define accVersion16Beta2 37 +#define accVersion16Beta3 38 +#define accVersion16Beta4 39 +#define accVersion16 40 +#define accVersion161 41 +#define accVersion16aBeta 42 +#define accVersion16aBeta3 43 +#define accVersion16aBeta5 44 +#define accVersion16a 45 +#define accVersion16a1 46 +#define accVersion16a3 47 +#define accVersion16a4 48 +#define accVersion16a5 49 +#define accVersionLatest accVersion16a5 + +/* Delay modes */ +#define accDelayModeNone 0 +#define accDelayModePath 1 +#define accDelayModeDistrib 2 +#define accDelayModeUnit 3 +#define accDelayModeZero 4 +#define accDelayModeVeritime 5 +#define accDelayModeMTM 6 + + +/***************************** +** typedefs for time structure +*/ + +typedef struct t_acc_time { + int type; /* one of accTime accSimTime accRealTime */ + int low, high; /* for accTime and accSimTime */ + double real; /* for accRealTime */ +} s_acc_time, *p_acc_time; + +/* t_acc_time types */ +#define accTime 1 /* timescaled time */ +#define accSimTime 2 /* internal simulation time */ +#define accRealTime 3 /* timescaled real time */ + +/* **************************************** +** typedef for fetch_timescale_info +*/ + +typedef struct t_timescale_info { + short unit; + short precision; +} s_timescale_info, *p_timescale_info; + + +/****************************************** +** typedefs and defines for acc_set_value() +*/ + +typedef struct t_setval_delay { + s_acc_time time; + int model; + /* accNoDelay */ + /* accInertialDelay */ + /* accTransportDelay */ + /* accPureTransportDelay */ +} s_setval_delay, *p_setval_delay; + + +/* t_setval_delay types */ +#define accNoDelay 0 +#define accInertialDelay 1 +#define accTransportDelay 2 +#define accPureTransportDelay 3 +#define accAssignFlag 4 +#define accDeassignFlag 5 +#define accForceFlag 6 +#define accReleaseFlag 7 + +typedef struct t_acc_vecval { + int aval; /* bit-coding for each bit of vector: */ + int bval; /* ab: 00=0, 10=1, 11=X, 01=Z */ +} s_acc_vecval, *p_acc_vecval; + +typedef struct t_setval_value { + int format; /* acc[[Bin,Oct,Dec,Hex]Str,Scalar,Int,Real,Vector]Val */ + union { + char *str; + int scalar; /* acc[0,1,X,Z] */ + int integer; + double real; + p_acc_vecval vector; + } value; +} s_setval_value, *p_setval_value, s_acc_value, *p_acc_value; + +/* t_setval_value fromats */ +#define accBinStrVal 1 +#define accOctStrVal 2 +#define accDecStrVal 3 +#define accHexStrVal 4 +#define accScalarVal 5 +#define accIntVal 6 +#define accRealVal 7 +#define accStringVal 8 +#define accCompactVal 9 +#define accVectorVal 10 + +/* scalar values */ +#define acc0 0 +#define acc1 1 +#define accX 2 +#define accZ 3 + + +/**********************************************************************/ +/* + * includes for Value Change Link + */ + +#define logic_value_change 1 +#define strength_value_change 2 +#define real_value_change 3 +#define vector_value_change 4 +#define event_value_change 5 +#define integer_value_change 6 +#define time_value_change 7 +#define sregister_value_change 8 +#define vregister_value_change 9 +#define realtime_value_change 10 +#define compact_value_change 11 + + +typedef void (*consumer_function) (); + +/* structure that stores strengths */ +typedef struct t_strengths { + unsigned char logic_value; + unsigned char strength1; + unsigned char strength2; +} s_strengths, *p_strengths; + + +typedef struct t_vc_record { + int vc_reason; + unsigned int vc_hightime; + unsigned int vc_lowtime; + char *user_data; + union { + unsigned char logic_value; + double real_value; + handle vector_handle; + s_strengths strengths_s; + } out_value; +} s_vc_record, *p_vc_record; + +/* logic values */ +#define vcl0 acc0 +#define vcl1 acc1 +#define vclX accX +#define vclZ accZ + +/* VCL strength values */ +#define vclSupply 7 +#define vclStrong 6 +#define vclPull 5 +#define vclLarge 4 +#define vclWeak 3 +#define vclMedium 2 +#define vclSmall 1 +#define vclHighZ 0 + +/* vcl bit flag definitions */ +#define vcl_strength_flag 1 +#define vcl_verilog_flag 2 +#define vcl_veritime_flag 4 +#define vcl_compact_flag 8 + + +/* flags used with acc_vcl_add */ +#define vcl_verilog_logic (vcl_verilog_flag) +#define VCL_VERILOG_LOGIC (vcl_verilog_flag) + +#define vcl_verilog_strength (vcl_verilog_flag + vcl_strength_flag) +#define VCL_VERILOG_STRENGTH (vcl_verilog_flag + vcl_strength_flag) + +/* flags used with acc_vcl_delete */ +#define vcl_verilog (vcl_verilog_flag) +#define VCL_VERILOG (vcl_verilog_flag) + +/* test whether strength information is requested for vcl */ +#define vcl_setstr_m(flags_) ( flags_ |= vcl_strength_flag ) +#define vcl_clearstr_m(flags_) ( flags_ &= ~vcl_strength_flag ) +#define vcl_isstr_m(flags_) ( flags_ & vcl_strength_flag ) + +/* test whether Verilog information is requested for vcl */ +#define vcl_setvl_m(flags_) ( flags_ |= vcl_verilog_flag ) +#define vcl_clearvl_m(flags_) ( flags_ &= ~vcl_verilog_flag ) +#define vcl_isvl_m(flags_) ( flags_ & vcl_verilog_flag ) + +/* test whether Veritime information is requested for vcl */ +#define vcl_setvt_m(flags_) ( flags_ |= vcl_veritime_flag ) +#define vcl_clearvt_m(flags_) ( flags_ &= ~vcl_veritime_flag ) +#define vcl_isvt_m(flags_) ( flags_ & vcl_veritime_flag ) + +/* test whether vcl trigger is compact or normal */ +#define vcl_setcompact_m(flags_) ( flags_ |= vcl_compact_flag ) +#define vcl_clearcompact_m(flags_) ( flags_ &= ~vcl_compact_flag ) +#define vcl_iscompact_m(flags_) ( flags_ & vcl_compact_flag ) + +/* constants for acc_product_type */ +#define accSimulator 1 +#define accTimingAnalyser 2 +#define accFaultSimulator 3 +#define accOther 4 + + +/**********************************************************************/ +/*** includes for the location structure ***/ +/* structure that stores location */ +typedef struct t_location { + int line_no; + char *filename; +} s_location, *p_location; + +/**********************************************************************/ +/*** includes for the time callbacks ***/ +#define reason_begin_of_simtime 1 +#define reason_end_of_simtime 2 + +/**********************************************************************/ +/* + * include information for stability checks + */ +#define accTaskFuncStable 0x0001 +#define accSystfStable 0x0002 +#define accPrimStable 0x0004 +#define accContAssignStable 0x0008 +#define accBehavStable 0x0010 +#define accNetRegVarStable 0x0020 +#define acc_taskfunc_stable accTaskFuncStable +#define acc_systf_stable accSystfStable +#define acc_primitive_stable accPrimStable +#define acc_contassign_stable accContAssignStable +#define acc_behav_stable accBehavStable +#define acc_netreg_stable accNetRegVarStable +#define acc_setstabflags_m(_flags,_pos) (_flags |= _pos) +#define acc_clearstabflags_m(_flags,_pos) (_flags &= ~_pos) +#define acc_isstabflags_m(_flags,_pos) (_flags & _pos) + + +/**********************************************************************/ +/*** Routine declarations ***/ + + +#ifdef __cplusplus +extern "C" { +#endif + +/* Handle routines */ + void acc_vcl_add(handle, int (*)(s_vc_record *), char *, int); + void acc_vcl_delete(handle, int (*)(s_vc_record *), char *, int); + handle acc_next_topmod(handle); + handle acc_handle_tfarg(int); + handle acc_next_scope(handle, handle); + int acc_fetch_size(handle); + char *acc_fetch_value(handle, char *, ...); + char *acc_fetch_name(handle); + int acc_set_value(handle, p_setval_value, p_setval_delay); + int acc_fetch_type(handle); + int acc_configure(int, char *); + int acc_initialize(void); + void acc_close(void); + handle acc_handle_object(char *); + handle acc_handle_tchkarg1(handle); + handle acc_handle_tchkarg2(handle); + handle acc_handle_parent(handle); + char *acc_fetch_fullname(handle); + int acc_fetch_fulltype(handle); + handle acc_handle_by_name(char *, handle); + handle acc_next_child(handle, handle); + handle acc_next_port(handle, handle); + char *acc_fetch_defname(handle); + handle acc_next_modpath(handle, handle); + handle acc_handle_pathin(handle); + handle acc_handle_pathout(handle); + handle acc_handle_modpath(handle, char *, char *, ...); + handle acc_next_primitive(handle, handle); + bool acc_fetch_delays(handle object, ...); + bool acc_replace_delays(handle object, ...); + bool acc_append_delays(handle object, ...); + + handle acc_handle_simulated_net(handle collapsed_net_handle); + + + bool acc_append_pulsere(handle path, double f1, double e1, double f2, + double e2, double f3, double e3, double f4, + double e4, double f5, double e5, double f6, + double e6); + bool acc_replace_pulsere(handle path, double f1, double e1, double f2, + double e2, double f3, double e3, double f4, + double e4, double f5, double e5, double f6, + double e6); + bool acc_set_pulsere(handle path, double reject_percentage, + double e_percentage); + bool acc_fetch_pulsere(handle path, double *f1, double *e1, double *f2, + double *e2, double *f3, double *e3, double *f4, + double *e4, double *f5, double *e5, double *f6, + double *e6); + + int acc_fetch_direction(handle); + handle acc_handle_conn(handle); + handle acc_next_terminal(handle, handle); + handle acc_next_driver(handle, handle); + handle acc_next_tchk(handle, handle); + handle acc_handle_tchkarg1(handle); + handle acc_handle_tchkarg2(handle); + handle acc_handle_tchk(handle, int, char *, int, char *, int, ...); + char *acc_fetch_type_str(int); + handle *acc_collect(handle(*nextFunction) (handle, handle), + handle reference, int *numberOfObjects); + bool acc_object_in_typelist(handle object, int *typeList); + int acc_product_type(void); + char *acc_product_version(void); + char *acc_version(void); + handle acc_next_cell(handle reference, handle cell); + handle acc_next_cell_load(handle reference, handle load); + handle acc_next_load(handle reference, handle load); + handle acc_next_bit(handle reference, handle bit); + handle acc_handle_port(handle module, int argumentNumber); + handle acc_handle_interactive_scope(void); + handle acc_handle_tfinst(void); + handle acc_handle_scope(handle object); + char *acc_set_scope(handle module, char *name); + void acc_reset_buffer(void); + handle acc_set_interactive_scope(void); + double acc_fetch_tfarg(int argumentNumber); + int acc_fetch_tfarg_int(int argumentNumber); + char *acc_fetch_tfarg_str(int argumentNumber); + handle acc_next_parameter(handle reference, handle param); + handle acc_next_specparam(handle reference, handle param); + int acc_fetch_delay_mode(handle module); + int acc_fetch_paramtype(handle param); + double acc_fetch_paramval(handle param); + handle acc_next_portout(handle reference, handle port); + int acc_fetch_argc(void); + char **acc_fetch_argv(void); + + void acc_free(handle * list); + int acc_count(handle(*nextFunction) (handle, handle), + handle reference); + + void acc_fetch_timescale_info(handle, p_timescale_info); + int acc_fetch_precision(void); + int acc_release_object(handle); + + handle acc_next_net(handle, handle); + handle acc_next(int *, handle, handle); + int acc_fetch_range(handle, int *, int *); + handle acc_handle_loconn(handle); + bool acc_object_of_type(handle object, int type); + handle acc_next_input(handle, handle); + handle acc_next_output(handle, handle); + void acc_mod_lcb_add(handle, void (*)(char *, unsigned int, char *), + char *); + void acc_mod_lcb_delete(handle, void (*)(char *, unsigned int, char *), + char *); + void acc_fetch_location(p_location loc_p, handle object); + bool acc_compare_handles(handle object1, handle object2); + int acc_fetch_index(handle object); + handle acc_handle_path(handle port_output_handle, + handle port_input_handle); + handle acc_handle_terminal(handle primitive_handle, + int terminal_index); + handle acc_handle_datapath(handle modpath); + handle acc_next_loconn(handle port, handle bit); + int acc_fetch_polarity(handle object); + handle acc_next_hiconn(handle port, handle bit); + int acc_fetch_edge(handle object); + handle acc_handle_index(handle object); + handle acc_handle_notifier(handle object); + double acc_fetch_attribute(handle object, char *string, double def); + handle acc_handle_hiconn(handle terminal); + handle acc_handle_calling_mod_m(void); + handle acc_handle_condition(handle); + int acc_fetch_attribute_int(handle object, char *string, int def); + char *acc_fetch_attribute_str(handle object, char *string, char *def); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/check.cc b/src/check.cc new file mode 100644 index 0000000..9f6d839 --- /dev/null +++ b/src/check.cc @@ -0,0 +1,815 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* CHECK.C - Compile-time semantic checking */ + +#include +#include "vtypes.h" +#include "tree.h" +#include "decl.h" +#include "check.h" +#include "veriwell.h" + +extern tree current_scope; +extern int in_tf; +extern int in_systask; /* defined in parse.y */ +extern int in_event; + +unsigned int big_label = 0; + + +static void fixup_labels(tree t, tree op1, tree op2) +{ + unsigned int label1, label2, sub_label1, sub_label2; + enum tree_code code_op1 = TREE_CODE(op1); + enum tree_code code_op2 = TREE_CODE(op2); + char *type_ptr = tree_code_type[code_op1]; + + if (*type_ptr == 'e' || + code_op1 == BIT_REF || code_op1 == ARRAY_REF + || code_op1 == CONCAT_REF) { + label1 = TREE_LABEL(op1); + /* cond or reduction */ + if (*++type_ptr == '1' || *type_ptr == 'r') { + sub_label1 = 1; + } else { + sub_label1 = TREE_SUB_LABEL(op1); + } + } else { + label1 = 1; + sub_label1 = 1; + } + + type_ptr = tree_code_type[TREE_CODE(op2)]; + if (*type_ptr == 'e' + || code_op2 == BIT_REF + || code_op2 == ARRAY_REF || code_op2 == CONCAT_REF) { + label2 = TREE_LABEL(op2); + /* cond or reduction */ + if (*++type_ptr == '1' || *type_ptr == 'r') { + sub_label2 = 0; + } else { + sub_label2 = TREE_SUB_LABEL(op2); + } + } else { + label2 = 0; + sub_label2 = 0; + } + + if (label1 == label2) { + TREE_LABEL(t) = label1 + 1; + } else { + TREE_LABEL(t) = max(label1, label2); + } + if (sub_label1 == sub_label2) { + TREE_SUB_LABEL(t) = sub_label1 + 1; + } else { + TREE_SUB_LABEL(t) = max(sub_label1, sub_label2); + } + + if (TREE_LABEL(t) > big_label) { + big_label = TREE_LABEL(t); + } + if (TREE_LABEL(t) == 0) { + error("Expression has too many subexpressions", NULL_CHAR, + NULL_CHAR); + } +} + +/* Build a binary operation. Also determine if this operation will + require another stack entry. Later, we'll try to be smart about + applying associativity and stack swapping to reduce the number of + stack levels required (and speed up operation). Also determine + depth of stack for a subexpression using the same expression + bit lengths (self-determining operators, like conditionals will + cause a possible bit-length change). +*/ + +tree build_binary_op(enum tree_code code, tree op1, tree op2) +{ + tree t = build_nt(code, op1, op2); + + fixup_labels(t, op1, op2); + + /* Handle default conversion when going from REAL to any other type; + that is, convert to real type if another real is there */ + if (TREE_REAL_ATTR(op1) ^ TREE_REAL_ATTR(op2)) { + if (TREE_REAL_ATTR(op1)) { + TREE_OPERAND(t, 1) = build_unary_op(REAL_CONV_EXPR, op2); + } else { + TREE_OPERAND(t, 0) = build_unary_op(REAL_CONV_EXPR, op1); + } + } + + TREE_CONSTANT_ATTR(t) = TREE_CONSTANT_ATTR(op1) & + TREE_CONSTANT_ATTR(op2); + TREE_INTEGER_ATTR(t) = TREE_INTEGER_ATTR(op1) & TREE_INTEGER_ATTR(op2); + TREE_REAL_ATTR(t) = TREE_REAL_ATTR(op1) | TREE_REAL_ATTR(op2); + if (tree_code_type[code][0] == 'e' && tree_code_type[code][1] == '1') { + TREE_INTEGER_ATTR(t) = 0; + TREE_REAL_ATTR(t) = 0; + } + + return t; +} + +tree build_unary_op(enum tree_code code, tree op) +{ + tree t = build_nt(code, op); + + TREE_LABEL(t) = TREE_LABEL(op); + TREE_SUB_LABEL(t) = TREE_SUB_LABEL(op); + TREE_CONSTANT_ATTR(t) = TREE_CONSTANT_ATTR(op); + TREE_INTEGER_ATTR(t) = TREE_INTEGER_ATTR(op); + TREE_REAL_ATTR(t) = TREE_REAL_ATTR(op); + + /* force type changes for conversion */ + if (TREE_CODE(t) == INT_CONV_EXPR) { + TREE_REAL_ATTR(t) = 0; + TREE_INTEGER_ATTR(t) = 1; + } else if (TREE_CODE(t) == REAL_CONV_EXPR) { + TREE_REAL_ATTR(t) = 1; + TREE_INTEGER_ATTR(t) = 0; + } + return t; +} + +tree build_cond_expr(tree op1, tree op2, tree op3) +{ + tree t = make_node(COND_EXPR); + + COND_EXPR(t) = op1; + COND_TRUE(t) = op2; + COND_FALSE(t) = op3; + TREE_CONSTANT_ATTR(t) = TREE_CONSTANT_ATTR(op1) & + TREE_CONSTANT_ATTR(op2) & TREE_CONSTANT_ATTR(op3); + TREE_INTEGER_ATTR(t) = TREE_INTEGER_ATTR(op2) & TREE_INTEGER_ATTR(op3); + TREE_REAL_ATTR(t) = TREE_REAL_ATTR(op2) | TREE_REAL_ATTR(op3); + + /* Handle default conversion when going from REAL to any other type */ + if (TREE_REAL_ATTR(op2) ^ TREE_REAL_ATTR(op3)) { + if (TREE_REAL_ATTR(op2)) { + op3 = build_unary_op(REAL_CONV_EXPR, op3); + } else { + op2 = build_unary_op(REAL_CONV_EXPR, op2); + } + } + TREE_LABEL(t) = 1 + max(TREE_LABEL(op2), TREE_LABEL(op3)); + TREE_SUB_LABEL(t) = 1 + max(TREE_SUB_LABEL(op2), TREE_SUB_LABEL(op3)); + if (TREE_LABEL(t) > big_label) { + big_label = TREE_LABEL(t); + } + if (TREE_LABEL(t) == 0) { + error("Expression has too many subexpressions", NULL_CHAR, + NULL_CHAR); + } + return t; +} + +/* Make the label of a concat ref the highest of he labels of its + components. Also, if all of its components are constant, then make + the reference constant. */ + +void concat_labels(tree node) +{ + tree t; + tree t1; + + TREE_CONSTANT_ATTR(node) = 1; + for (t = CONCAT_LIST(node); t; t = TREE_CHAIN(t)) { + t1 = TREE_PURPOSE(t); + if (TREE_LABEL(node) < TREE_LABEL(t1)) { + TREE_LABEL(node) = TREE_LABEL(t1); + } + if (TREE_SUB_LABEL(node) < TREE_SUB_LABEL(t1)) { + TREE_SUB_LABEL(node) = TREE_SUB_LABEL(t1); + } + if (!TREE_CONSTANT_ATTR(t1)) { + TREE_CONSTANT_ATTR(t) = 0; + } + } +} + +/* Determine if this is a legal lval, return decl node */ + +tree check_lval(tree node, enum lval_type lval_type, tree spec) +{ + tree t = IDENT_CURRENT_DECL(node); + + if (node) { + if ((t = IDENT_CURRENT_DECL(node)) != 0) { + if (TREE_CODE(t) == ARRAY_DECL) { + error("Illegal reference to array '%s'", + IDENT(node), NULL_CHAR); + return error_mark_node; + } + } + } + return check_lval_nocheck(node, lval_type, spec); +} + +tree check_lval_nocheck(tree node, enum lval_type lval_type, tree spec) +{ + tree t = IDENT_CURRENT_DECL(node); + enum tree_code code; + char *type; + tree tmp; + + if (lval_type == LVAL_GATE) { // for gates + t = node; + } else { + t = IDENT_CURRENT_DECL(node); + } + + if (!t && lval_type != LVAL_NEW_NET && lval_type != LVAL_GATE) { + if (HIERARCHICAL_ATTR(node)) { + return node; + } else { + error("'%s' not declared", IDENT(node), NULL_CHAR); + return error_mark_node; + } + } else if (t == error_mark_node) { + return error_mark_node; + /* Continuous assignment inside net declaration (ex: "wire foo = bar;") */ + } else if (lval_type == LVAL_NEW_NET) { /* net decl with con't assignment */ + if (check_net(node) == error_mark_node) { + error("'%s' previously declared", IDENT(node), NULL_CHAR); + } else { /* make net */ + t = make_decl(node, spec, NULL_TREE, NULL_TREE); + BLOCK_DECL(current_scope) = + chainon(t, BLOCK_DECL(current_scope)); + NET_DELAY(t) = NULL_TREE; + if (TREE_CODE(t) == NET_SCALAR_DECL) { + tmp = make_node(NET_SCALAR_DECL); + } else { + tmp = make_node(NET_VECTOR_DECL); + } + DECL_NAME(tmp) = DECL_NAME(t); /* Do this for trace */ + TREE_TYPE(tmp) = TREE_TYPE(t); + STMT_SURROGATE_ATTR(tmp) = 1; + NET_ASSIGN_ATTR(tmp) = 1; + DECL_SOURCE_LINE(tmp) = lineno; + DECL_SOURCE_FILE(tmp) = input_filename; + PORT_OUTPUT_ATTR(tmp) = 0; + PORT_INPUT_ATTR(tmp) = 0; + PORT_COLLAPSED_ATTR(tmp) = 0; + + NET_SOURCE(tmp) = NET_SOURCE(t); /* thread me into source list */ + NET_SOURCE(t) = tmp; + TREE_CHAIN(tmp) = t; /* point back to original net */ + return tmp; + } + } + + code = TREE_CODE(t); + type = tree_code_type[code]; + + if (*type == 'e' || *type == 'c' || *type == 'b') { + error("Illegal Lvalue", NULL_CHAR, NULL_CHAR); + return error_mark_node; + /* This is an OK non-net, non-continuous assignment */ + } else if (lval_type == LVAL_REG && + code != NET_VECTOR_DECL && code != NET_SCALAR_DECL) { + return t; + } else if (lval_type == LVAL_REG_NET) { /* All types allowed (FORCE stmt) */ + return t; + /* Net, but not continuous */ + } else if (lval_type == LVAL_REG) { + error("Lval '%s' cannot be a net", IDENT(node), NULL_CHAR); + return error_mark_node; + /* Continuous assignment (ex: "assign foo = bar;") */ + } else if (lval_type == LVAL_NET || /* continuous assignment */ + lval_type == LVAL_GATE) { /* gates assignment */ + if (code == NET_VECTOR_DECL) { + tmp = make_node(NET_VECTOR_DECL); + } else if (code == NET_SCALAR_DECL) { + tmp = make_node(NET_SCALAR_DECL); + } else { + error("Continuous assignment lval '%s' not a net", + IDENT(node), NULL_CHAR); + return error_mark_node; + } + DECL_NAME(tmp) = DECL_NAME(t); + TREE_TYPE(tmp) = 0; + STMT_SURROGATE_ATTR(tmp) = 1; + DECL_SOURCE_LINE(tmp) = lineno; + DECL_SOURCE_FILE(tmp) = input_filename; + PORT_OUTPUT_ATTR(tmp) = 0; + PORT_INPUT_ATTR(tmp) = 0; + PORT_COLLAPSED_ATTR(tmp) = 0; + NET_SOURCE(tmp) = NET_SOURCE(t); /* thread me into source list */ + NET_SOURCE(t) = tmp; + TREE_CHAIN(tmp) = t; /* point back to original net */ + REFERENCED_ATTR(t) = 1; + return tmp; + } else { /* Port connections */ + fatal("Shouldn't here for port connections", NULL); + tmp = copy_node(spec); + DECL_NAME(tmp) = DECL_NAME(spec); + TREE_TYPE(tmp) = 0; + STMT_SURROGATE_ATTR(tmp) = 1; + DECL_SOURCE_LINE(tmp) = lineno; + DECL_SOURCE_FILE(tmp) = input_filename; + PORT_OUTPUT_ATTR(tmp) = 0; + PORT_INPUT_ATTR(tmp) = 0; + PORT_COLLAPSED_ATTR(tmp) = 0; + NET_SOURCE(tmp) = NET_SOURCE(spec); /* thread me into source list */ + NET_SOURCE(spec) = tmp; + TREE_CHAIN(tmp) = spec; /* point back to original net */ + return tmp; + } +} + +/* Add a source to a net. It should be already qualified as a decl node. */ + +tree make_net_source(tree decl) +{ + tree tmp = copy_node(decl); + DECL_NAME(tmp) = DECL_NAME(decl); + TREE_TYPE(tmp) = 0; + STMT_SURROGATE_ATTR(tmp) = 1; + DECL_SOURCE_LINE(tmp) = lineno; + DECL_SOURCE_FILE(tmp) = input_filename; + PORT_OUTPUT_ATTR(tmp) = 0; + PORT_INPUT_ATTR(tmp) = 0; + PORT_COLLAPSED_ATTR(tmp) = 0; + NET_SOURCE(tmp) = NET_SOURCE(decl); /* thread me into source list */ + NET_SOURCE(decl) = tmp; + TREE_CHAIN(tmp) = decl; /* point back to original net */ + return tmp; +} + +/* Port might be a bit or part select. Since this is lval, it must be + a net, so it can't be an array ref. It is assumed that the port + is already tested for net-ness. */ + +tree check_lval_port(tree port) +{ + tree new_t; + tree t; + tree t1; + tree prev; + tree first; + + switch (TREE_CODE(port)) { + case BIT_REF: + new_t = copy_node(port); + BIT_REF_DECL(new_t) = make_net_source(BIT_REF_DECL(port)); + break; + + case PART_REF: + new_t = copy_node(port); + PART_DECL(new_t) = make_net_source(PART_DECL(port)); + break; + + /* If this is a concat, then each component needs to be copied */ + case CONCAT_REF: + new_t = copy_node(port); + prev = NULL_TREE; + first = NULL_TREE; + for (t = CONCAT_LIST(port); t; t = TREE_CHAIN(t)) { + t1 = build_tree_list(check_lval_port + (TREE_PURPOSE(t)), NULL_TREE); + if (first) { + TREE_CHAIN(prev) = t1; + } else { + first = t1; + } + prev = t1; + } + CONCAT_LIST(new_t) = first; + break; + + default: + new_t = make_net_source(port); + break; + } + return new_t; +} + +/* This is to support pass2; set the immediate attr in the right place */ + +void set_immediate_attr(tree port, int attr) +{ + tree t; + + switch (TREE_CODE(port)) { + case BIT_REF: + PORT_IMMEDIATE_ATTR(BIT_REF_DECL(port)) = attr; + break; + + case PART_REF: + PORT_IMMEDIATE_ATTR(PART_DECL(port)) = attr; + break; + + /* If this is a concat, then each component needs to be copied */ + case CONCAT_REF: + for (t = CONCAT_LIST(port); t; t = TREE_CHAIN(t)) { + set_immediate_attr(TREE_PURPOSE(t), attr); + } + break; + + default: + PORT_IMMEDIATE_ATTR(port) = attr; + break; + } +} + +tree check_rval(tree ident) +{ + extern int in_instantiation; /* defined in parse.y */ + tree decl = IDENT_CURRENT_DECL(ident); + enum tree_code code; + char *type; + + + if (!decl) { + /* There is no decl node if this is hierachical; also, don't complain + for systasks -- let them test it themselves in case of forward decls + that will not be resolved 'till pass3, like module names */ + if (HIERARCHICAL_ATTR(ident) || in_systask) { + return ident; + } else if (in_instantiation) { + return make_default_net(ident); + } else { + error("'%s' not declared", IDENT(ident), NULL_CHAR); + return error_mark_node; + } + } else if (decl == error_mark_node) { + return error_mark_node; + } else if (*tree_code_type[TREE_CODE(decl)] == 'b' && !in_systask) { /* module block */ + error("'%s' is a module type and is being usd illegally", + IDENT(ident), NULL_CHAR); + return error_mark_node; + } else if (TREE_CODE(decl) == EVENT_DECL && !in_event) { + error("'%s' is an EVENT type and is being used illegally", + IDENT(ident), NULL_CHAR); + return error_mark_node; + } else if (TREE_CODE(decl) == ARRAY_DECL && !in_systask) { + error("Illegal array reference: '%s'", IDENT(ident), NULL_CHAR); + + } else { + REFERENCED_ATTR(decl) = 1; + return decl; + } + + return error_mark_node; +} + +tree check_rval_nocheck(tree ident) +{ + tree decl = IDENT_CURRENT_DECL(ident); + + if (!decl) { + if (HIERARCHICAL_ATTR(ident)) { + return ident; + } else { + error("'%s' not declared", IDENT(ident), NULL_CHAR); + return error_mark_node; + } + } else if (decl == error_mark_node) { + return error_mark_node; + } else if (TREE_CODE(decl) == EVENT_DECL && !in_event) { + error("'%s' is an EVENT type and is being used illegally", + IDENT(ident), NULL_CHAR); + return error_mark_node; + } else { + REFERENCED_ATTR(decl) = 1; + return decl; + } +} + +tree check_block(tree ident) +{ + tree t = IDENT_CURRENT_DECL(ident); + + if (t) { + error("Block '%s' previously declared", IDENT(ident), NULL_CHAR); + return error_mark_node; + } + return ident; +} + +/* Bit reference (foo [i]) may be a bit select of a reg or net vector or + may be an array reference. */ + +tree build_bit_ref(tree decl, tree index) +{ + tree ident = DECL_NAME(decl); + tree node; + + if (decl == error_mark_node) { + return error_mark_node; + } + switch (TREE_CODE(decl)) { + case REG_SCALAR_DECL: + case NET_SCALAR_DECL: + case REG_VECTOR_DECL: + case NET_VECTOR_DECL: + case INTEGER_DECL: + case PARAM_DECL: + node = build_nt(BIT_REF, decl, index, NULL_TREE, ident); + TREE_LABEL(node) = TREE_LABEL(index); + TREE_SUB_LABEL(node) = TREE_SUB_LABEL(index); + return node; + case (ARRAY_DECL): + node = build_nt(ARRAY_REF, decl, index, NULL_TREE, ident); + TREE_LABEL(node) = TREE_LABEL(index); + TREE_SUB_LABEL(node) = TREE_SUB_LABEL(index); + TREE_INTEGER_ATTR(node) = TREE_INTEGER_ATTR(decl); + TREE_REAL_ATTR(node) = TREE_REAL_ATTR(decl); + return node; + case IDENTIFIER_NODE: /* for hierarchical reference. */ + node = build_nt(BIT_REF, decl, index, NULL_TREE, decl); + HIERARCHICAL_ATTR(node) = 1; + TREE_LABEL(node) = TREE_LABEL(index); + TREE_SUB_LABEL(node) = TREE_SUB_LABEL(index); + return node; + default: + error("'%s' is not of a type that supports bit indexing", + IDENT(ident), NULL_CHAR); + } + return error_mark_node; +} + +/* Part reference (foo [2:5]) must be a reg or a net vector. May also work + with integers, reals, and parameter, but this needs further investigation. + msb and lsb trees will already have been tested for constant expressions. */ + +tree build_part_ref(tree decl, tree msb, tree lsb) +{ + tree tmp; + tree ident = DECL_NAME(decl); + if (decl == error_mark_node) { + return error_mark_node; + } + + switch (TREE_CODE(decl)) { + case (REG_VECTOR_DECL): + case (NET_VECTOR_DECL): + case INTEGER_DECL: + case PARAM_DECL: + tmp = make_node(PART_REF); + PART_MSB_(tmp) = msb; + PART_LSB_(tmp) = lsb; + PART_NAME(tmp) = PART_DECL(tmp) = decl; + return tmp; + case (REG_SCALAR_DECL): + case (NET_SCALAR_DECL): + error("'%s' is not a vector", IDENT(ident), NULL_CHAR); + return error_mark_node; + case (ARRAY_DECL): + error + ("'%s' is an array; it cannot be be referenced as a part-select", + IDENT(ident), NULL_CHAR); + break; + case IDENTIFIER_NODE: /* for hierarchical reference */ + tmp = make_node(PART_REF); + PART_MSB_(tmp) = msb; + PART_LSB_(tmp) = lsb; + PART_NAME(tmp) = PART_DECL(tmp) = decl; + HIERARCHICAL_ATTR(tmp) = 1; + return tmp; + default: + error("'%s' is not of a type that supports part-selects", + IDENT(ident), NULL_CHAR); + } + return error_mark_node; +} + +tree build_function_call(tree ident, tree args) +{ + tree t = IDENT_CURRENT_DECL(ident), tmp; + + if (t) { + if (DECL_CONTEXT(t) == current_scope && + !(TREE_CODE(t) == BLOCK_DECL && + TREE_CODE(DECL_THREAD(t)) == FUNCTION_BLOCK)) { + error("The name '%s' is already used", IDENT(ident), + NULL_CHAR); + return error_mark_node; + } else if (t == error_mark_node) { + return error_mark_node; + } + } + tmp = build_nt(FUNCTION_REF, IDENTIFIER_POINTER(ident), args, + NULL_TREE, NULL_TREE, lineno, input_filename, + current_scope); + TREE_NBITS(tmp) = 1; /* default; if function not defined */ + return tmp; +} + +tree check_task(tree node) +{ + tree t = IDENT_CURRENT_DECL(node); + + if (t && DECL_CONTEXT(t) == current_scope) { + error("The name '%s' is previously declared", IDENT(node), + NULL_CHAR); + return error_mark_node; + } else if (t == error_mark_node) { + return error_mark_node; + } else { + return node; + } +} + +tree check_function(tree node) +{ + tree t = IDENT_CURRENT_DECL(node); + + if (t && DECL_CONTEXT(t) == current_scope) { + error("The name '%s' is already used", IDENT(node), NULL_CHAR); + return error_mark_node; + } else if (t == error_mark_node) { + return error_mark_node; + } else { + return node; + } +} + +tree check_reg(tree node) +{ + tree t = IDENT_CURRENT_DECL(node); + + if (t && (DECL_CONTEXT(t) == current_scope)) { + if (!PORT_INPUT_ATTR(t) && !PORT_OUTPUT_ATTR(t)) { + error("The name '%s' has already been declared", + IDENT(node), NULL_CHAR); + return error_mark_node; + } else if (PORT_REDEFINED_ATTR(t)) { + error("The port '%s' has already been redefined", + IDENT(node), NULL_CHAR); + return error_mark_node; + } else if (PORT_INPUT_ATTR(t) && + TREE_CODE(current_scope) == MODULE_BLOCK) { + error("Input port '%s' cannot be redefined as a REG", + IDENT(node), NULL_CHAR); + return error_mark_node; + } else if (t == error_mark_node) { + return error_mark_node; + } + } + return node; +} + +tree check_non_reg(tree node) +{ + tree t = IDENT_CURRENT_DECL(node); + + if (t && (DECL_CONTEXT(t) == current_scope)) { + error("The name '%s' has already been declared", + IDENT(node), NULL_CHAR); + return error_mark_node; + } else if (t == error_mark_node) { + return error_mark_node; + } else { + return node; + } +} + +tree check_net(tree node) +{ + tree t = IDENT_CURRENT_DECL(node); + + if (t && !PORT_INPUT_ATTR(t) && !PORT_OUTPUT_ATTR(t)) { + error("The name '%s' has already been declared", + IDENT(node), NULL_CHAR); + return error_mark_node; + } else if (t && PORT_REDEFINED_ATTR(t)) { + error("The port '%s' has already been redefined", + IDENT(node), NULL_CHAR); + return error_mark_node; + } else if (t == error_mark_node) { + return error_mark_node; + } else { + return node; + } +} + +/* Make sure INPUT/OUTPUT/INOUT identifier is legal. The critera is slighty + different for modules than for tasks and functions. */ + +tree check_port(tree node) +{ + tree t = IDENT_CURRENT_DECL(node); + + if (in_tf) { + if (t && (DECL_CONTEXT(t) == current_scope)) { + error("Port '%s' has already been declared", IDENT(node), + NULL_CHAR); + return error_mark_node; + } + /* If this is a module port, search the port + * list to make sure its in there. + */ + } else { + /* If the ident is listed in the port list, + * then it will either point + * to itself or point to a ref to itself. + */ + if (!t) { + error("'%s' is not in the port list", IDENT(node), NULL_CHAR); + return error_mark_node; + } else if (root_port_decl(t) != node) { + error("'%s' is not in the port list", IDENT(node), NULL_CHAR); + return error_mark_node; + } + return t; + } + + return node; +} + +tree check_named_event(tree ident) +{ + tree decl = IDENT_CURRENT_DECL(ident); + + if (HIERARCHICAL_ATTR(ident)) { + return ident; + } else if (!decl) { + error("Event '%s' is not defined\n", IDENT(ident), NULL_CHAR); + return error_mark_node; + } else if (TREE_CODE(decl) != EVENT_DECL) { + error("'%s' is not an EVENT type.\n", IDENT(ident), NULL_CHAR); + return error_mark_node; + } else { + return decl; + } +} + +tree double_check_named_event(tree decl) +{ + tree ident = DECL_NAME(decl); + + if (decl == error_mark_node) { + return decl; + } + + if (TREE_CODE(decl) != EVENT_DECL) { + error("'%s' is not an EVENT type", IDENT(ident), NULL_CHAR); + return error_mark_node; + } else { + return decl; + } +} + +/* In pass3, make sure that the referenced ident node points to a block_decl. + This cannot be checked at parse time because it may be a forward reference. + Return the pointed-to block if ok, else return error (note that + if NULL were returned on an error, a second error would be printed + about the scope not being found.) */ + +tree double_check_block(tree ident) +{ + tree decl = IDENT_CURRENT_DECL(ident); + + if (TREE_CODE(decl) != BLOCK_DECL) { + error("Illegal block reference '%s'", IDENT(ident), NULL_CHAR); + return error_mark_node; + } + return DECL_THREAD(decl); +} + +/* Insert type conversion instructions if necessary, return new rval tree */ + +tree implicit_conversion(tree lval, tree rval) +{ + /* test if rval is real but lval is not; convert to integer (bits) */ + if (!TREE_REAL_ATTR(lval) && TREE_REAL_ATTR(rval)) { + return build_unary_op(INT_CONV_EXPR, rval); + /* test if rval is not real, but lval is; convert to real */ + } else if (TREE_REAL_ATTR(lval) && !TREE_REAL_ATTR(rval)) { + return build_unary_op(REAL_CONV_EXPR, rval); + } else { + return rval; + } +} + +/************************************************************* + * + * init_check + * - initializes global and static variables for check.c + * + ************************************************************* + */ +void init_check() +{ + big_label = 0; +} diff --git a/src/check.h b/src/check.h new file mode 100644 index 0000000..a39f92b --- /dev/null +++ b/src/check.h @@ -0,0 +1,54 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* CHECK.H - CHECK.c routine prototypes */ + +#ifndef CHECK_H +#define CHECK_H + + +tree build_binary_op(enum tree_code code, tree op1, tree op2); +tree build_unary_op(enum tree_code code, tree op); +tree build_cond_expr(tree op1, tree op2, tree op3); +void concat_labels(tree node); +tree check_lval(tree node, enum lval_type lval_type, tree spec); +tree check_lval_nocheck(tree node, enum lval_type lval_type, tree spec); +tree make_net_source(tree decl); +tree check_lval_port(tree port); +void set_immediate_attr(tree port, int attr); +tree check_rval(tree ident); +tree check_rval_nocheck(tree ident); +tree check_block(tree ident); +tree build_bit_ref(tree decl, tree index); +tree build_part_ref(tree decl, tree msb, tree lsb); +tree build_function_call(tree ident, tree args); +tree check_task(tree node); +tree check_function(tree node); +tree check_reg(tree node); +tree check_non_reg(tree node); +tree check_net(tree node); +tree check_port(tree node); +tree check_named_event(tree ident); +tree double_check_named_event(tree decl); +tree double_check_block(tree ident); +tree implicit_conversion(tree lval, tree rval); +void init_check(void); + + +#endif // CHECK_H diff --git a/src/copy.cc b/src/copy.cc new file mode 100644 index 0000000..5a29f2b --- /dev/null +++ b/src/copy.cc @@ -0,0 +1,705 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* COPY.C - Copy structures for multiple module instances */ + +#include +#include "vtypes.h" +#include "tree.h" +#include "obstack.h" +#include "decl.h" +#include "schedule.h" +#include "scope.h" +#include "io.h" +#include "copy.h" +#include "veriwell.h" + +static void copy_assignment(tree dest_node, tree source_node); +static tree copy_delay(tree node); +static tree copy_cont_assigns(tree node); +static tree copy_instances(tree node); +static tree copy_decl(tree t); +static tree copy_decl_chain(tree node, int parameter); +static void copy_decl_defs(tree dest_scope, tree source_scope); +static tree substitute_new_decl(tree old_decl); +static tree copy_list(tree node); +static tree copy_tree(tree node); + + +extern tree current_scope; +static int in_lval = 0; +static tree current_gate; +static tree current_treelist; + +static void copy_assignment(tree dest_node, tree source_node) +{ + enum tree_code code = TREE_CODE(source_node); + + if (code != ASSIGN_CONT_STMT) { + STMT_ASSIGN_LVAL(dest_node) = + copy_tree(STMT_ASSIGN_LVAL(source_node)); + STMT_ASSIGN_RVAL(dest_node) = + copy_tree(STMT_ASSIGN_RVAL(source_node)); + } +} + +/* Copy delay expressions */ + +static tree copy_delay(tree node) +{ + tree new_node; + unsigned int i; + + if (!node) { + return NULL_TREE; + } + + new_node = copy_node(node); + for (i = 0; i < TREE_LABEL(new_node); i++) { + if (TREE_OPERAND(node, i)) { + TREE_OPERAND(new_node, i) = copy_tree(TREE_OPERAND(node, i)); + } + } + return new_node; +} + +/* Copy continuous assignments. NOTE: This does not distiguish between + continuous assignments and net assignments. */ + +static tree copy_cont_assigns(tree node) +{ + tree t; + tree t1; + tree new_node; + tree new_node_tree; + tree first = NULL_TREE; + tree prev = NULL_TREE; + tree new_lval; + + for (t1 = node; t1; t1 = TREE_CHAIN(t1)) { + t = TREE_PURPOSE(t1); + in_lval = 1; + if (TREE_CHAIN(t)) { + new_lval = copy_tree(STMT_ASSIGN_LVAL(TREE_CHAIN(t))); + NET_ASSIGN_ATTR(new_lval) = + NET_ASSIGN_ATTR(STMT_ASSIGN_LVAL(TREE_CHAIN(t))); + TREE_SET_TYPE(new_lval, TREE_TYPE + (STMT_ASSIGN_LVAL(TREE_CHAIN(t)))); + } else { + new_lval = copy_tree(STMT_ASSIGN_LVAL(t)); + NET_ASSIGN_ATTR(new_lval) = + NET_ASSIGN_ATTR(STMT_ASSIGN_LVAL(t)); + TREE_SET_TYPE(new_lval, TREE_TYPE(STMT_ASSIGN_LVAL(t))); + } + in_lval = 0; + new_node = build_cont_assign(new_lval, + copy_tree(STMT_ASSIGN_RVAL(t)), + STMT_SOURCE_LINE(t), + copy_delay(STMT_ASSIGN_DELAY(t)), + STMT_ASSIGN_DELAY(t) != NULL_TREE); + new_node_tree = build_tree_list(new_node, NULL_TREE); + if (!first) { + first = new_node_tree; + } else { + TREE_CHAIN(prev) = new_node_tree; + } + prev = new_node_tree; + } + return first; +} + +/* Copy INSTANCE_NODEs */ + +static tree copy_instances(tree node) +{ + tree t; + tree new_node; + tree first = NULL_TREE; + tree prev = NULL_TREE; + + for (t = node; t; t = TREE_CHAIN(t)) { + new_node = copy_node(t); + INSTANCE_PORTS(new_node) = copy_tree(INSTANCE_PORTS(t)); + INSTANCE_PARAMS(new_node) = copy_tree(INSTANCE_PORTS(t)); + if (!first) { + first = new_node; + } else { + TREE_CHAIN(prev) = new_node; + } + TREE_CHAIN(new_node) = NULL_TREE; + prev = new_node; + } + return first; +} + +static tree copy_decl(tree t) +{ + tree new_decl; + enum tree_code new_code; + + new_decl = copy_node(t); + new_code = TREE_CODE(new_decl); + if (TREE_CODE(t) == ARRAY_DECL) { + ARRAY_HI_EXPR(new_decl) = copy_tree(ARRAY_HI_EXPR(t)); + ARRAY_LO_EXPR(new_decl) = copy_tree(ARRAY_LO_EXPR(t)); + if (ARRAY_CODE(new_decl) == REG_VECTOR_DECL) { + DECL_MSB(new_decl) = copy_tree(DECL_MSB(t)); + DECL_LSB(new_decl) = copy_tree(DECL_LSB(t)); + } + } + DECL_CONTEXT(new_decl) = current_scope; + DECL_THREAD(new_decl) = DECL_THREAD(t); + if (new_code == NET_VECTOR_DECL || new_code == REG_VECTOR_DECL) { + DECL_MSB(new_decl) = copy_tree(DECL_MSB(t)); + DECL_LSB(new_decl) = copy_tree(DECL_LSB(t)); + } + + if (new_code == NET_VECTOR_DECL || new_code == NET_SCALAR_DECL) { + NET_SOURCE(new_decl) = NULL_TREE; + NET_DELAY(new_decl) = copy_tree(NET_DELAY(t)); + } else if (new_code == PARAM_DECL) { + DECL_PARAM_REDIRECT(new_decl) = NULL_TREE; + DECL_PARAM_RVAL(new_decl) = copy_tree(DECL_PARAM_RVAL(t)); + } + + set_decl(DECL_NAME(new_decl), new_decl); + return new_decl; +} + +/* scan a chain of decl nodes, make a copy, and set the ident node + to the new current decl */ + +static tree copy_decl_chain(tree node, int parameter) +{ + tree t; + tree new_decl; + tree prev_decl = NULL_TREE; + tree first_decl = NULL_TREE; + + for (t = node; t; t = TREE_CHAIN(t)) { + if (TREE_CODE(t) == BLOCK_DECL) { /* Don't copy block_decls */ + continue; + } + /* Either copy only parameters or no parameters */ + if (parameter) { + if (TREE_CODE(t) != PARAM_DECL) { + continue; + } + + } else { + if (TREE_CODE(t) == PARAM_DECL) { + continue; + } + } + new_decl = copy_decl(t); + if (!first_decl) { + first_decl = new_decl; + } else { + TREE_CHAIN(prev_decl) = new_decl; + } + TREE_CHAIN(new_decl) = NULL_TREE; + prev_decl = new_decl; + } + return first_decl; +} + +/* For the given block, copy the port list and the decl list. Then + go back and update the threads, since they are forward pointers + and must be updated in a second pass. */ + +static void copy_decl_defs(tree dest_scope, tree source_scope) +{ + tree t; + + /* First copy parameters */ + BLOCK_DECL(dest_scope) = NULL_TREE; + BLOCK_DECL(dest_scope) = copy_decl_chain(BLOCK_DECL(source_scope), 1); + + /* Copy ports first, since some ports are redefined as regs; we want + IDENT_CURRENT_DECL to reflect this */ + BLOCK_PORTS(dest_scope) = + copy_decl_chain(BLOCK_PORTS(source_scope), 0); + BLOCK_DECL(dest_scope) = + chainon(BLOCK_DECL(dest_scope), + copy_decl_chain(BLOCK_DECL(source_scope), 0)); + for (t = BLOCK_PORTS(dest_scope); t; t = TREE_CHAIN(t)) { + if (DECL_THREAD(t)) { + DECL_THREAD(t) = substitute_new_decl(DECL_THREAD(t)); + } + } + for (t = BLOCK_DECL(dest_scope); t; t = TREE_CHAIN(t)) { + if (DECL_THREAD(t)) { + DECL_THREAD(t) = substitute_new_decl(DECL_THREAD(t)); + } + } +} + +/* Given a reference to a decl of the module to be copied, return the + pointer of the newly copied decl. This is accomplished by looking at + the name of the decl and seeing what the new current decl is, since + the new current decl is set when the decl was copied. +*/ + +static tree substitute_new_decl(tree old_decl) +{ + if (!old_decl) { + return NULL_TREE; + } + if (IDENT_CURRENT_DECL(DECL_NAME(old_decl))) { + return (IDENT_CURRENT_DECL(DECL_NAME(old_decl))); + } else { + fatal + ("Attempting to copy a decl reference that does not exist: %s", + IDENT(DECL_NAME(old_decl))); + } + return NULL_TREE; /* won't get here (put here to avoid warnings */ +} + +static tree copy_list(tree node) +{ + tree t; + tree new_t; + tree first = NULL_TREE; + tree prev = NULL_TREE; + + for (t = node; t; t = TREE_CHAIN(t)) { + if (TREE_CODE(t) == TREE_LIST) { + new_t = build_tree_list(copy_tree + (TREE_PURPOSE(t)), + copy_tree(TREE_VALUE(t))); + } else { + new_t = copy_tree(t); + } + if (!first) { + first = new_t; + } else { + TREE_CHAIN(prev) = new_t; + } + prev = new_t; + } + return first; +} + +tree copy_block(tree node) +{ + enum tree_code code = TREE_CODE(node); + tree new_node; + tree up_scope; + + new_node = copy_node(node); + + /* Copy common block stuff */ + BLOCK_UP(new_node) = current_scope; + BLOCK_NAME(new_node) = BLOCK_NAME(node); + BLOCK_SOURCE_LINE(new_node) = BLOCK_SOURCE_LINE(node); + BLOCK_SOURCE_FILE(new_node) = BLOCK_SOURCE_FILE(node); + make_block_decl(BLOCK_NAME(new_node), current_scope, new_node); + up_scope = current_scope; + current_scope = new_node; + + /* Scan Module */ + + if (code == MODULE_BLOCK) { + INITIALIZED_ATTR(new_node) = 0; /* Allow pass2 to scan this */ + push_scope(); + MODULE_SPECINST(new_node) = NULL_TREE; + BLOCK_PARAM(new_node) = copy_tree(BLOCK_PARAM(node)); + copy_decl_defs(new_node, node); + BLOCK_DOWN(new_node) = NULL_TREE; + BLOCK_BODY(new_node) = copy_tree(BLOCK_BODY(node)); + BLOCK_DOWN(new_node) = chainon(BLOCK_DOWN(new_node), + copy_tree(BLOCK_DOWN(node))); + MODULE_ASSIGNMENTS(new_node) = copy_cont_assigns + (MODULE_ASSIGNMENTS(node)); + MODULE_PORT_LIST(new_node) = copy_tree(MODULE_PORT_LIST(node)); + BLOCK_UP(new_node) = NULL_TREE; + } else if (code == TASK_BLOCK || code == FUNCTION_BLOCK) { + /* Thread new sub block in */ + push_scope(); + copy_decl_defs(new_node, node); + DECL_THREAD(IDENT_CURRENT_DECL(BLOCK_NAME(new_node))) = new_node; + + if (code == FUNCTION_BLOCK) + FUNCT_DECL(current_scope) = copy_decl(FUNCT_DECL(node)); + + BLOCK_BODY(new_node) = copy_tree(BLOCK_BODY(node)); + BLOCK_DOWN(new_node) = copy_tree(BLOCK_DOWN(node)); + BLOCK_PARAM(new_node) = copy_tree(BLOCK_PARAM(node)); + } else if (code == NAMED_BLOCK) { + tree ident = BLOCK_NAME(new_node); + + /* Thread new sub block in */ + TREE_CHAIN(new_node) = BLOCK_DOWN(up_scope); + BLOCK_DOWN(up_scope) = new_node; + push_scope(); + /* Points BLOCK_DECL to block */ + copy_decl_defs(new_node, node); + DECL_THREAD(IDENT_CURRENT_DECL(ident)) = new_node; + BLOCK_BODY(new_node) = copy_tree(BLOCK_BODY(node)); + BLOCK_DOWN(new_node) = copy_tree(BLOCK_DOWN(node)); + BLOCK_PARAM(new_node) = copy_tree(BLOCK_PARAM(node)); + } + + current_scope = pop_scope(); + return new_node; +} + +/* Make a copy of a TREE LIST and everything under it. Return a pointer + to the head of the list. Note that although a TREE_LIST has three + operands, the third is always used to store generated code, so it is not + copied (generated code always occurs in pass3, after the module copy). +*/ + +static tree copy_tree(tree node) +{ + return copy_tree_with_stuff(node, NULL_TREE); +} + +/* recursively copy a node and everything under it. Return a pointer to + the head of the newly copied tree. */ + +tree copy_tree_with_stuff(tree node, tree stuff) +{ + enum tree_code code; // = TREE_CODE (node); + char *tree_type_ptr; // = tree_code_type [TREE_CODE (node)]; + tree new_node; + tree prev; + tree first; + int lval_save; + + if (!node) { + return NULL_TREE; + } + if ((unsigned long) node == 1) { + return (tree) 1; + } + code = TREE_CODE(node); + tree_type_ptr = tree_code_type[code]; + + switch (*tree_code_type[code]) { + case 'b': + /* Only copy one module; don't do sub modules and don't do + named blocks (named statement will generate one) */ + prev = first = NULL_TREE; + for (; node; node = TREE_CHAIN(node)) { + code = TREE_CODE(node); + if (code != MODULE_BLOCK && code != NAMED_BLOCK) { + new_node = copy_block(node); + if (prev) { + TREE_CHAIN(prev) = new_node; + } else { + first = new_node; + } + prev = new_node; + } + } + return first; + + case 'e': + new_node = copy_node(node); + switch (*++tree_type_ptr) { + case '3': + COND_EXPR(new_node) = copy_tree(COND_EXPR(node)); + COND_TRUE(new_node) = copy_tree(COND_TRUE(node)); + COND_FALSE(new_node) = copy_tree(COND_FALSE(node)); + break; + case 'x': + case '1': + case 's': + TREE_OPERAND(new_node, 1) = copy_tree(TREE_OPERAND(node, 1)); + case 'u': + case 'r': + default: + TREE_OPERAND(new_node, 0) = copy_tree(TREE_OPERAND(node, 0)); + break; + } /* switch 'e' */ + break; + + case 'r': + new_node = copy_node(node); + lval_save = in_lval; + switch (TREE_CODE(new_node)) { + case BIT_REF: + in_lval = 0; + BIT_EXPR(new_node) = copy_tree(BIT_EXPR(node)); + BIT_REF_NAME(new_node) = copy_tree(BIT_REF_NAME(node)); + in_lval = lval_save; + BIT_REF_DECL(new_node) = copy_tree(BIT_REF_DECL(node)); + break; + case ARRAY_REF: + in_lval = 0; + ARRAY_EXPR(new_node) = copy_tree(ARRAY_EXPR(node)); + ARRAY_REF_NAME(new_node) = copy_tree(ARRAY_REF_NAME(node)); + in_lval = lval_save; + ARRAY_REF_DECL(new_node) = copy_tree(ARRAY_REF_DECL(node)); + break; + case CONCAT_REP_REF: + CONCAT_EXPR(new_node) = copy_tree(CONCAT_EXPR(node)); + case CONCAT_REF: + CONCAT_LIST(new_node) = copy_tree(CONCAT_LIST(node)); + break; + case PART_REF: + in_lval = 0; + PART_MSB_(new_node) = copy_tree(PART_MSB_(node)); + PART_LSB_(new_node) = copy_tree(PART_LSB_(node)); + PART_NAME(new_node) = copy_tree(PART_NAME(node)); + in_lval = lval_save; + PART_DECL(new_node) = copy_tree(PART_DECL(node)); + break; + case SYSFUNCTION_REF: + case FUNCTION_REF: + FUNC_REF_ARGS(new_node) = copy_tree(FUNC_REF_ARGS(node)); + FUNC_REF_CONTEXT(new_node) = current_scope; + break; + } /* switch reference code */ + break; + + case 'd': + if (code == TMP_DECL) { + new_node = copy_node(node); + } else { + new_node = substitute_new_decl(node); + if (in_lval) { + /* Build a new driver for the continuous assignment. The parent + net has already been copied. Note that net assignments go + through here too, but that the NET_ASSIGN_ATTR was already set + in substitute_decl_node, as was the type. */ + new_node = check_lval(DECL_NAME(new_node), + LVAL_NET, new_node); + if (current_gate != NULL_TREE) { +// NET_ASSIGNMENT( new_node ) = current_gate; + NET_ASSIGNMENT(new_node) = current_treelist; + } + } + } + break; + + case 'c': + case 'x': + if (code == IDENTIFIER_NODE) { + new_node = node; + } else { + new_node = copy_node(node); + } + if (TREE_CODE(new_node) == TREE_LIST) { + current_treelist = new_node; + TREE_PURPOSE(new_node) = copy_tree(TREE_PURPOSE(node)); + if (current_gate != NULL) { + GATE_TERMINAL_GATE(new_node) = current_gate; + } else { + TREE_VALUE(new_node) = copy_tree(TREE_VALUE(node)); + } + TREE_CHAIN(new_node) = copy_tree(TREE_CHAIN(node)); + } + break; + + + case 'g': + case 's': + prev = first = NULL_TREE; + for (; node; node = TREE_CHAIN(node)) { + code = TREE_CODE(node); + /* Always and initials are headed by TREE_LISTs; get here if + INSTANCE_NODEs are first, otherwise TREE_LIST gets copied + somewhere else. */ + new_node = copy_node(node); + if (prev) { + TREE_CHAIN(prev) = new_node; + } + if (!first) { + first = new_node; + } + prev = new_node; + + if (TREE_CODE(node) == TREE_LIST) { + TREE_PURPOSE(new_node) = copy_tree(TREE_PURPOSE(node)); + TREE_VALUE(new_node) = copy_tree(TREE_VALUE(node)); + continue; + } else if (*tree_code_type[TREE_CODE(node)] != 's' && + *tree_code_type[TREE_CODE(node)] != 'g') { + printf_V("coping non-statement in statement chain"); + } + + if (*tree_code_type[TREE_CODE(node)] == 'g') { + GATE_SCOPE(new_node) = current_scope; + } else { + STMT_SCOPE(new_node) = current_scope; + } + switch (TREE_CODE(new_node)) { + case ALWAYS_BLOCK: + case INITIAL_BLOCK: + case BEGIN_STMT: + case FOREVER_STMT: + case DEASSIGN_STMT: + case RELEASE_STMT: + case ARROW_STMT: + STMT_BODY(new_node) = copy_tree(STMT_BODY(node)); + break; + case BEGIN_NAMED_STMT: + case FORK_NAMED_STMT: + STMT_BLOCK(new_node) = copy_block(STMT_BLOCK(node)); + /* decls have already been copied */ + set_scope(STMT_BLOCK(new_node)); + STMT_BODY(new_node) = copy_tree(STMT_BODY(node)); + current_scope = pop_scope(); + break; + case FORK_STMT: + STMT_BODY(new_node) = copy_tree(STMT_BODY(node)); + break; + case END_STMT: + case END_NAMED_STMT: + case JOIN_STMT: + case JOIN_NAMED_STMT: + break; + case ASSIGN_PROC_STMT: + case ASSIGN_STMT: + copy_assignment(new_node, node); + break; + case ASSIGN_DELAY_STMT: + case ASSIGN_NONBLK_DELAY_STMT: + copy_assignment(new_node, node); + STMT_ASSIGN_DELAY(new_node) = + copy_delay(STMT_ASSIGN_DELAY(node)); + break; + case ASSIGN_EVENT_STMT: + case ASSIGN_NONBLK_EVENT_STMT: + copy_assignment(new_node, node); + STMT_ASSIGN_EVENT(new_node) = + copy_tree(STMT_ASSIGN_DELAY(node)); + break; + case IF_STMT: + STMT_COND(new_node) = copy_tree(STMT_COND(node)); + STMT_THEN(new_node) = copy_tree(STMT_THEN(node)); + STMT_ELSE(new_node) = copy_tree(STMT_ELSE(node)); + break; + case WHILE_STMT: + STMT_BODY(new_node) = copy_tree(STMT_BODY(node)); + STMT_WHILE_COND(new_node) = + copy_tree(STMT_WHILE_COND(node)); + break; + case REPEAT_INIT_STMT: + STMT_REPEAT_EXPR(new_node) = + copy_tree(STMT_REPEAT_EXPR(node)); + STMT_BODY(new_node) = + copy_tree_with_stuff(STMT_BODY(node), new_node); + break; + case REPEAT_STMT: + STMT_REPEAT_EXPR(new_node) = + copy_tree(STMT_REPEAT_EXPR(node)); + STMT_BODY(new_node) = stuff; + break; + case FOR_STMT: + if (!STMT_SURROGATE_ATTR(node)) { + STMT_FOR_ASSIGN(new_node) = + copy_tree(STMT_FOR_ASSIGN(node)); + STMT_FOR_COND(new_node) = + copy_tree(STMT_FOR_COND(node)); + STMT_BODY(new_node) = + copy_tree_with_stuff(STMT_BODY(node), new_node); + } else { + STMT_FOR_ASSIGN(new_node) = + copy_tree(STMT_FOR_ASSIGN(node)); + STMT_FOR_COND(new_node) = STMT_FOR_COND(stuff); + STMT_BODY(new_node) = STMT_BODY(stuff); + TREE_CHAIN(new_node) = stuff; + return first; + } + break; + case CASE_STMT: + case CASEX_STMT: + case CASEZ_STMT: + STMT_CASE_EXPR(new_node) = copy_tree(STMT_CASE_EXPR(node)); + STMT_CASE_LIST(new_node) = copy_tree(STMT_CASE_LIST(node)); + STMT_CASE_DEFAULT(new_node) = + copy_tree(STMT_CASE_DEFAULT(node)); + break; + case DELAY_STMT: + STMT_DELAY_EXPR(new_node) = + copy_tree(STMT_DELAY_EXPR(node)); + STMT_BODY(new_node) = copy_tree(STMT_BODY(node)); + break; + case WAIT_STMT: + STMT_WAIT_EXPR(new_node) = copy_tree(STMT_WAIT_EXPR(node)); + STMT_BODY(new_node) = copy_tree(STMT_BODY(node)); + break; + case EVENT_STMT: + STMT_EVENT_EXPR_LIST(new_node) = + copy_tree(STMT_EVENT_EXPR_LIST(node)); + STMT_BODY(new_node) = copy_tree(STMT_BODY(node)); + STMT_EVENT_MARKER(new_node) = NULL; + break; + case FORCE_STMT: + copy_assignment(new_node, node); + break; + case DISABLE_STMT: + break; /* STMT_DISABLE_NAME copied by default */ + case TASK_STMT: + case SYSTASK_STMT: + STMT_TASK_ARGS(new_node) = copy_tree(STMT_TASK_ARGS(node)); + break; + case NULL_STMT: + break; + case INSTANCE_NODE: + INSTANCE_PORTS(new_node) = copy_tree(INSTANCE_PORTS(node)); + INSTANCE_PARAMS(new_node) = + copy_tree(INSTANCE_PARAMS(node)); + break; + case GATE_INSTANCE: + in_lval = 1; + current_gate = new_node; + GATE_OUTPUT_LIST(new_node) = + copy_tree(GATE_OUTPUT_LIST(node)); + in_lval = 0; + GATE_INPUT_LIST(new_node) = + copy_tree(GATE_INPUT_LIST(node)); + current_gate = NULL; + GATE_DELAY(new_node) = copy_tree(GATE_DELAY(node)); + break; + default: + fatal("Fatal error: Attempt to copy unknown statement", + NULL); + } + + } /* for */ + return first; + break; + + default: + if (node == (tree) ALWAYS_CODE) { + return (tree) ALWAYS_CODE; + } + fatal("Fatal: Unexpected structure encountered" + " during module copy", NULL); + } + return new_node; +} + +/**************************************************************** + * + * init_copy + * - initialize global and static variables for copy.c + * + **************************************************************** + */ + +void init_copy() +{ + in_lval = 0; + current_gate = NULL; +} diff --git a/src/copy.h b/src/copy.h new file mode 100644 index 0000000..d522a7c --- /dev/null +++ b/src/copy.h @@ -0,0 +1,30 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* COPY.H - Copy.c routine prototypes */ + +#ifndef COPY_H +#define COPY_H + + +tree copy_block(tree node); +tree copy_tree_with_stuff(tree node, tree stuff); +void init_copy(void); + +#endif // COPY_H diff --git a/src/decl.cc b/src/decl.cc new file mode 100644 index 0000000..725e4a3 --- /dev/null +++ b/src/decl.cc @@ -0,0 +1,403 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* DECL.C - Declaration node generation and utilities */ + + +#include "glue.h" +#include +#include "vtypes.h" +#include "tree.h" +#include "decl.h" +#include "flags.h" /* needed for "default_net_type" */ +#include "scope.h" +#include "schedule.h" +#include "pass2.h" + +/* Node for the integer constant 0 */ +tree integer_zero_node; + +/* Node for the integer constant 1 */ +tree integer_one_node; + +/* Node for the single-bit 0 */ +tree bit_zero_node; + +/* Node for the single-bit 1 */ +tree bit_one_node; + +/* Node to mark an error */ +tree error_mark_node; + +static void replace_port(tree here, tree ident, tree node) +{ + switch (TREE_CODE(TREE_PURPOSE(here))) { + case IDENTIFIER_NODE: + if (TREE_PURPOSE(here) == ident) { + TREE_PURPOSE(here) = node; + } + break; + case REG_SCALAR_DECL: + case REG_VECTOR_DECL: + case NET_SCALAR_DECL: + case NET_VECTOR_DECL: + if (DECL_NAME(TREE_PURPOSE(here)) == ident) { + PORT_OUTPUT_ATTR(node) = PORT_OUTPUT_ATTR(TREE_PURPOSE(here)); + PORT_INPUT_ATTR(node) = PORT_INPUT_ATTR(TREE_PURPOSE(here)); + TREE_PURPOSE(here) = node; + } + break; + case PART_REF: + if (TREE_PURPOSE(here) == ident) { + PART_DECL(TREE_PURPOSE(here)) = node; + PORT_OUTPUT_ATTR(TREE_PURPOSE(here)) = PORT_OUTPUT_ATTR(node); + PORT_INPUT_ATTR(TREE_PURPOSE(here)) = PORT_INPUT_ATTR(node); + HIERARCHICAL_ATTR(TREE_PURPOSE(here)) = 0; /* set in check */ + } + break; + case BIT_REF: + if (TREE_PURPOSE(here) == ident) { + BIT_REF_DECL(TREE_PURPOSE(here)) = node; + PORT_OUTPUT_ATTR(node) = PORT_OUTPUT_ATTR(TREE_PURPOSE(here)); + PORT_INPUT_ATTR(node) = PORT_INPUT_ATTR(TREE_PURPOSE(here)); + HIERARCHICAL_ATTR(TREE_PURPOSE(here)) = 0; /* set in check */ + } + break; + } +} + +/* Search list of ports, find IDENT, and replace with NODE. Ident may + been replaced once before with a NET. */ + +void redirect_port(tree ident, tree node) +{ + tree t; + tree t1; + + for (t = MODULE_PORT_LIST(current_scope); t; t = TREE_CHAIN(t)) { + if (TREE_CODE(TREE_PURPOSE(t)) == TREE_LIST) { + for (t1 = TREE_PURPOSE(t); t1; t1 = TREE_CHAIN(t1)) { + replace_port(t1, ident, node); + } + } else { + replace_port(t, ident, node); + } + } +} + +tree make_net_spec(enum tree_type net_type, tree range, tree delay) +{ + tree node; + + if (range == NULL) { + node = make_node(NET_SCALAR_DECL); + } else { + node = make_node(NET_VECTOR_DECL); + DECL_MSB(node) = TREE_OPERAND(range, 0); + DECL_LSB(node) = TREE_OPERAND(range, 1); + } + DECL_CONTEXT(node) = current_scope; + NET_DELAY(node) = delay; + TREE_TYPE(node) = net_type; + NET_SOURCE(node) = NULL_TREE; + return node; +} + +tree make_reg_spec(tree range) +{ + tree node; + + if (range == NULL) { + node = make_node(REG_SCALAR_DECL); + } else { + node = make_node(REG_VECTOR_DECL); + DECL_MSB(node) = TREE_OPERAND(range, 0); + DECL_LSB(node) = TREE_OPERAND(range, 1); + } + DECL_CONTEXT(node) = current_scope; + return node; +} + +tree make_integer_spec(tree range) +{ + tree node; + + node = make_node(INTEGER_DECL); + if (range == NULL) { + DECL_MSB(node) = NULL_TREE; + DECL_LSB(node) = NULL_TREE; + } else { + DECL_MSB(node) = TREE_OPERAND(range, 0); + DECL_LSB(node) = TREE_OPERAND(range, 1); + } + DECL_CONTEXT(node) = current_scope; + TREE_INTEGER_ATTR(node) = 1; + return node; +} + +tree make_real_spec(tree range) +{ + tree node; + + node = make_node(REAL_DECL); + if (range == NULL) { + DECL_MSB(node) = NULL_TREE; + DECL_LSB(node) = NULL_TREE; + } else { + DECL_MSB(node) = TREE_OPERAND(range, 0); + DECL_LSB(node) = TREE_OPERAND(range, 1); + } + DECL_CONTEXT(node) = current_scope; + TREE_REAL_ATTR(node) = 1; + return node; +} + +tree make_time_spec(tree range) +{ + tree node; + + node = make_node(TIME_DECL); + if (range == NULL) { + DECL_MSB(node) = NULL_TREE; + DECL_LSB(node) = NULL_TREE; + } else { + DECL_MSB(node) = TREE_OPERAND(range, 0); + DECL_LSB(node) = TREE_OPERAND(range, 1); + } + DECL_CONTEXT(node) = current_scope; + return node; +} + +tree make_event_spec() +{ + tree node = make_node(EVENT_DECL); + DECL_CONTEXT(node) = current_scope; + return node; +} + +tree make_param_spec(tree range) +{ + tree node = make_node(PARAM_DECL); + + TREE_CONSTANT_ATTR(node) = 1; /* treat parameter as a constant */ + if (range == NULL) { + DECL_MSB(node) = NULL_TREE; + DECL_LSB(node) = NULL_TREE; + } else { + DECL_MSB(node) = TREE_OPERAND(range, 0); + DECL_LSB(node) = TREE_OPERAND(range, 1); + } + DECL_CONTEXT(node) = current_scope; + return node; +} + +/* Take a declaration and assign a name to it and possible array bounds. + If more than one name associated with a declarations (reg [31:0] a, b, c) + copy the original node. */ + +tree make_decl(tree ident, tree spec, tree hibounds, tree lobounds) +{ + tree node = spec; + tree decl; + + if (ident == error_mark_node) { + return copy_node(error_mark_node); + } + + /* + * if no name associated with declaration, + * use this node, else make a copy + */ + if (DECL_NAME(node) != NULL_TREE) { + node = copy_node(node); + } + DECL_NAME(node) = root_port_name(ident); /* Give it a name */ + + if (TREE_CODE(node) == NET_SCALAR_DECL || + TREE_CODE(node) == NET_VECTOR_DECL) { + NET_SOURCE(node) = NULL_TREE; + /* Make sure TRI1 and TRI0 get scheduled to be eval'ed in time 0, + * Do this by making a dummy driver; con't assgn initialization + * will know what to do. + */ + if (TREE_TYPE(node) == NET_TRI1_TYPE || + TREE_TYPE(node) == NET_TRI0_TYPE || + TREE_TYPE(node) == NET_SUPPLY0_TYPE || + TREE_TYPE(node) == NET_SUPPLY1_TYPE) { + add_cont_assign_list(make_net_source(node)); + } + } + + /* If this is an array, build a new node with array bounds */ + if (hibounds) { /* implies both hi and lo are non-null */ + node = build_array(ident, node, hibounds, lobounds); + } + + /* If current_decl of ident is non-NULL, then it is either a port + being declared for the first time (with INPUT, OUTPUT, INOUT), + or it is a redeclaration of a declared port (to qualify the net type, + the size, or to turn it into a REG). */ + + /* If this is a redeclaration of a port, go back to the port list and + make it point to the new DECL node. */ + + decl = IDENT_CURRENT_DECL(ident); + + if (decl) { + /* Case 1, we are at the INPUT, OUTPUT, or INOUT decl; + * search for the port and redeclare as a net with the + * proper width, etc. + */ + if (TREE_CODE(root_port_decl(ident)) == IDENTIFIER_NODE) { + redirect_port(ident, node); + /* Case 2: previously declared as a port, + * this is the explicit declaration (WIRE, REG, etc.) + */ + } else if (TREE_CODE(decl) != BLOCK_DECL && DECL_CONTEXT(decl) == DECL_CONTEXT(node)) { /* 2nd time decl */ + if (REFERENCED_ATTR(decl)) { + error("Redeclared port '%s' has already been referenced", + IDENT(ident), NULL_CHAR); + } + DECL_THREAD(decl) = node; + PORT_REDEFINED_ATTR(decl) = 1; + PORT_INPUT_ATTR(node) = PORT_INPUT_ATTR(decl); + PORT_OUTPUT_ATTR(node) = PORT_OUTPUT_ATTR(decl); + } + } + set_decl(root_port_name(ident), node); + return node; +} + +tree make_param_decl(tree ident, tree spec, tree rval) +{ + tree node = spec; + /* + * if no name associated with declaration, + * use this node, else make a copy + */ + if (DECL_NAME(node) != NULL_TREE) { + node = copy_node(node); + } + DECL_NAME(node) = ident; /* Give it a name */ + set_decl(ident, node); + DECL_PARAM_RVAL(node) = rval; + DECL_PARAM_REDIRECT(node) = NULL_TREE; + TREE_CONSTANT_ATTR(node) = 1; + return node; +} + +/* make a decl for a named BLOCK or task or function */ + +tree make_block_decl(tree ident, tree context, tree block) +{ + tree decl = make_node(BLOCK_DECL); + + if (ident == error_mark_node) { + return ident; + } + DECL_CONTEXT(decl) = context; + DECL_THREAD(decl) = block; + DECL_NAME(decl) = ident; + set_decl(ident, decl); + TREE_CHAIN(decl) = BLOCK_DECL(context); + BLOCK_DECL(context) = decl; + return ident; +} + +/* Used for implied declarations of nets */ + +tree make_default_net(tree ident) +{ + tree spec = make_net_spec(default_net_type, NULL_TREE, NULL_TREE); + tree decl = make_decl(ident, spec, NULL_TREE, NULL_TREE); + + BLOCK_DECL(current_scope) = chainon(decl, BLOCK_DECL(current_scope)); + REFERENCED_ATTR(decl) = 1; + return decl; +} + +/* Make a TMP_DECL node for statements that use intermediate values */ + +static tree tmp_decl_free = NULL; + +tree make_tmp_decl(tree lval) +{ + tree tmp; + if (tmp_decl_free) { + tmp = tmp_decl_free; + tmp_decl_free = DECL_THREAD(tmp_decl_free); + DECL_THREAD(tmp) = NULL; + } else { + tmp = make_node(TMP_DECL); + } + TREE_CHAIN(tmp) = lval; + pass3_decl(tmp); + return tmp; +} + +void free_tmp_decl(tree tmp) +{ + free(DECL_STORAGE(tmp)); + DECL_THREAD(tmp) = tmp_decl_free; + tmp_decl_free = tmp; +} + +tree root_port_decl(tree node) +{ + switch (TREE_CODE(node)) { + case PART_REF: + return PART_DECL(node); + case BIT_REF: + return BIT_REF_DECL(node); + case IDENTIFIER_NODE: + return IDENT_CURRENT_DECL(node); + } + return node; +} + +tree root_port_name(tree node) +{ + switch (TREE_CODE(node)) { + case PART_REF: + return PART_NAME(node); + case BIT_REF: + return BIT_REF_NAME(node); + case IDENTIFIER_NODE: + return node; + } + return node; +} + +/************************************************************** + * + * init_decl + * - initialize global and static variables in decl.c + * + ************************************************************** + */ + +void init_decl() +{ + tmp_decl_free = NULL; + integer_zero_node = NULL_TREE; + integer_one_node = NULL_TREE; + bit_zero_node = NULL_TREE; + bit_one_node = NULL_TREE; + error_mark_node = NULL_TREE; +} diff --git a/src/decl.h b/src/decl.h new file mode 100644 index 0000000..293a645 --- /dev/null +++ b/src/decl.h @@ -0,0 +1,49 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* DECL.H - Decl and Check routine prototypes */ + +#ifndef DECL_H +#define DECL_H + +extern tree integer_zero_node; +extern tree integer_one_node; +extern tree current_scope; + +void set_decl(tree, tree); +tree make_net_spec(enum tree_type, tree, tree); +tree make_reg_spec(tree); +tree make_integer_spec(tree); +tree make_real_spec(tree); +tree make_time_spec(tree); +tree make_event_spec(void); +tree make_decl(tree, tree, tree, tree); +tree make_param_spec(tree); +tree make_param_decl(tree, tree, tree); +tree make_block_decl(tree, tree, tree); +tree make_default_net(tree); +void init_decl(void); +tree root_port_decl(tree); +tree root_port_name(tree); +void redirect_port(tree ident, tree node); +tree make_tmp_decl(tree lval); +void free_tmp_decl(tree tmp); + + +#endif // DECL_H diff --git a/src/defaultveriuser.cc b/src/defaultveriuser.cc new file mode 100644 index 0000000..7b81c3e --- /dev/null +++ b/src/defaultveriuser.cc @@ -0,0 +1,60 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* VERIUSER.C - PLI user routine hooks */ + +/* Filename: veriuser.c */ +#define VERIUSER_C + +#if HAVE_CONFIG_H +# include +#endif +#include "veriuser.h" +#include "acc_user.h" + +extern "C" { + int lxt_recordvars( int data, int reason ); + int lxt_recordon( int data, int reason ); + int lxt_recordoff( int data, int reason ); + int lxt_recordclose( int data, int reason ); + int lxt_recordfile( int data, int reason ); + int lxt_recordsetup( int data, int reason ); +} + +char *veriuser_version_str = "" +#ifdef HAVE_LXT + "lxt support compiled in\n\n" +#endif +; + int (*endofcompile_routines[]) () = { + /*** my_eoc_routine, ***/ + 0 /*** final entry must be 0 ***/ +}; + +s_tfcell veriusertfs[] = { +#ifdef HAVE_LXT + { usertask, 0, lxt_recordvars, 0, lxt_recordvars, lxt_recordvars, "$lxt_recordvars" }, + { usertask, 0, lxt_recordon, 0, lxt_recordon, lxt_recordon, "$lxt_recordon" }, + { usertask, 0, lxt_recordoff, 0, lxt_recordoff, lxt_recordoff, "$lxt_recordoff" }, + { usertask, 0, lxt_recordclose, 0, lxt_recordclose, lxt_recordclose, "$lxt_recordclose" }, + { usertask, 0, lxt_recordfile, 0, lxt_recordfile, lxt_recordfile, "$lxt_recordfile" }, + { usertask, 0, lxt_recordsetup, 0, lxt_recordsetup, lxt_recordsetup, "$lxt_recordsetup" }, +#endif + {0} +}; diff --git a/src/dumpvar.cc b/src/dumpvar.cc new file mode 100644 index 0000000..3f596fd --- /dev/null +++ b/src/dumpvar.cc @@ -0,0 +1,477 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* DUMPVAR.C - Value change dump file routines ($dumpvars, etc.) */ + +#include +#include +#include "glue.h" +#include "vtypes.h" +#include "tree.h" +#include "schedule.h" +#include "print.h" +#include "dumpvar.h" +#include "veriwell.h" +#include "timescal.h" + +struct Dump dumpvar; +static FILE *dumpfile; + + +static void dumpvars_scope(tree scope); +static char *dumpvars_xlate(int index); +static void dumpvars_printscope(tree scope); +static void dumpvars_printscopes(tree scope, int level); +static void dumpvars_printvar(Marker * marker, Marker * prev); +static int dumpvars_inside_scopes(tree scope, int scan_only); +static int dumpvars_printvars(tree scope, int level); +static void dumpvars_time(void); +static void dumpvars_print_val(tree decl, int index); +static void dumpvars_dump_all(void); + + + +/* Build a VCD marker on a qualified decl node */ + +void dumpvars_mark(tree node) +{ + struct Marker_info marker_info; + + marker_info.first = dumpvar.markers_first; + marker_info.last = dumpvar.markers_last; + marker_info.delay = NULL; + marker_info.current_scb = readylist; + marker_info.flags = M_VCD; + BuildMarker(node, &marker_info); + dumpvar.markers_first = marker_info.first; + dumpvar.markers_last = marker_info.last; +} + +/* Mark all of the dump-able vars in a scope */ + +static void dumpvars_scope(tree scope) +{ + tree decl; + tree dummy; + + for (decl = BLOCK_PORTS(scope); decl; decl = TREE_CHAIN(decl)) { + if (!PORT_REDEFINED_ATTR(decl)) { + if (is_var(decl, &dummy)) { + dumpvars_mark(decl); + } + } + } + + for (decl = BLOCK_DECL(scope); decl; decl = TREE_CHAIN(decl)) { + if (is_var(decl, &dummy)) { + dumpvars_mark(decl); + } + } +} + +/* recursively traverse hierarchy to "level" levels and marks all the decls + in each scope */ + +void dumpvars_scope_down(tree scope, int level) +{ + tree s; + + dumpvars_scope(scope); + /* Do tasks, functions, and named block w/out regard for level */ + for (s = BLOCK_DOWN(scope); s; s = TREE_CHAIN(s)) { + if (*tree_code_type[TREE_CODE(s)] == 'b') { + if (TREE_CODE(s) != MODULE_BLOCK) { + dumpvars_scope_down(s, level); + } + } + } + + if (!--level) { + return; + } + + /* Go down to instantiated blocks */ + for (s = BLOCK_DOWN(scope); s; s = TREE_CHAIN(s)) { + if (*tree_code_type[TREE_CODE(s)] == 'b') { + if (TREE_CODE(s) == MODULE_BLOCK) { + dumpvars_scope_down(s, level); + } + } + } +} + + +void dumpvars_all(void) +{ + tree s; + + for (s = top_level; s; s = TREE_CHAIN(s)) { + dumpvars_scope_down(s, 4000); + } +} + +void dumpvars_enable(void) +{ + Marker *marker; + + dumpvar.enabled = 1; + for (marker = dumpvar.printed; marker; marker = marker->link) { + thread_marker(marker); + } +} + +void dumpvars_disable(void) +{ + Marker *marker; + + dumpvar.enabled = 0; + for (marker = dumpvar.printed; marker; marker = marker->link) { + REMOVE_LIST(marker); + } +} + +/* translate the index into ascii characters from the legal char set + (33-126) */ + +#define XLATE_START 33 +#define XLATE_END 126 + +static char *dumpvars_xlate(int index) +{ + int num_ascii = XLATE_END - XLATE_START + 1; + int i = 0; + int accum = index; + int offset; + static char buffer[5]; + + do { + offset = accum % num_ascii; + buffer[i++] = offset + XLATE_START; + accum /= num_ascii; + } + while (accum > 0); + buffer[i] = '\0'; + return buffer; +} + +/* Print a $scope line */ + +static void dumpvars_printscope(tree scope) +{ + enum tree_code code = TREE_CODE(scope); + + fprintf(dumpfile, "\n$scope "); + switch (code) { + case MODULE_BLOCK: + fprintf(dumpfile, "module"); + break; + case NAMED_BLOCK: + fprintf(dumpfile, "begin"); + break; + case TASK_BLOCK: + fprintf(dumpfile, "task"); + break; + case FUNCTION_BLOCK: + fprintf(dumpfile, "function"); + break; + } + fprintf(dumpfile, " %s $end\n", IDENT(BLOCK_NAME(scope))); +} + +/* Print one or more $scope lines. Go up "level" levels + and start from there. */ + +static void dumpvars_printscopes(tree scope, int level) +{ + int i; + int j; + tree s; + + for (i = level; i; i--) { + s = scope; + for (j = i; j; j--) { + s = BLOCK_UP(s); + } + dumpvars_printscope(s); + } + dumpvars_printscope(scope); +} + +static void dumpvars_printvar(Marker * marker, Marker * prev) +{ + tree decl = marker->decl; + int index = marker->expr.vcd_id; + enum tree_code code = TREE_CODE(decl); + Marker *tmp; + + fprintf(dumpfile, "$var %-5s %5ld %-4s %s ", + decl_type(decl), TREE_NBITS(decl), dumpvars_xlate(index), + IDENT(DECL_NAME(decl))); + if (code == REG_VECTOR_DECL || code == NET_VECTOR_DECL) { + fprintf(dumpfile, "[%d:%d]", MSB(decl), LSB(decl)); + } + fprintf(dumpfile, " $end\n"); + + /* Thread onto "printed" list */ + tmp = marker->link; + marker->link = dumpvar.printed; + dumpvar.printed = marker; + /* Take off of unprinted list */ + if (prev) { + prev->link = tmp; + } else { + dumpvar.unprinted = tmp; /* head of the list case */ + } +} + +static int dumpvars_inside_scopes(tree scope, int scan_only) +{ + Marker *marker; + Marker *prev; + Marker *next; + tree s; + int printed_something = 0; + int printed_scope = 0; + + for (s = BLOCK_DOWN(scope); s; s = TREE_CHAIN(s)) { + if (TREE_CODE(s) != MODULE_BLOCK) { + if (!scan_only) { + dumpvars_printscope(s); + printed_scope = 1; + } + + prev = NULL; + for (marker = dumpvar.unprinted; marker; marker = next) { + next = marker->link; /* do now,since printvar will change link */ + if (DECL_CONTEXT(marker->decl) == s) { + printed_something = 1; + if (!scan_only) { + dumpvars_printvar(marker, prev); + } + } else { + prev = marker; /* previous marker not printed out */ + } + } + + printed_something |= dumpvars_inside_scopes(s, scan_only); + if (printed_scope) { + fprintf(dumpfile, "$upscope $end\n\n"); + } + } + } + return printed_something; +} + +/* Recursively print the scopes and vars to "level" levels */ + +static int dumpvars_printvars(tree scope, int level) +{ + Marker *marker; + Marker *prev = NULL; + Marker *next; + tree s; + int printed_something = 0; + + for (marker = dumpvar.unprinted; marker; marker = next) { + next = marker->link; /* Do now; printvar will change link */ + if (DECL_CONTEXT(marker->decl) == scope) { + if (!printed_something) { + dumpvars_printscopes(scope, level); + printed_something = 1; + } + dumpvars_printvar(marker, prev); + } else { + prev = marker; + } + } + /* This keeps track of what scopes have been printed */ + if (printed_something) { + level = 0; + } else { + level++; + } + + /* Go down to child modules; do lower scopes later */ + for (s = BLOCK_DOWN(scope); s; s = TREE_CHAIN(s)) { + if (TREE_CODE(s) == MODULE_BLOCK) { + printed_something |= dumpvars_printvars(s, level); + } + } + + /* If something in this module or a lower has been printed (dumped) + then go ahead and print all of the lower scopes, + regardless of whether there is something to be printed */ + + if (printed_something) { + dumpvars_inside_scopes(scope, 0); + } else { + if (dumpvars_inside_scopes(scope, 1)) { + printed_something = 1; + dumpvars_inside_scopes(scope, 0); + } + } + if (printed_something) { + fprintf(dumpfile, "$upscope $end\n\n"); + } + return printed_something; +} + +int dumpvars_header(tree node) +{ + tree scope; + Marker *marker; + int id = 0; + time_t t = time(NULL); + int units; + int prec; /* for timescale for header */ + char timebuf[100]; + + for (marker = dumpvar.unprinted; marker; marker = marker->link) { + marker->expr.vcd_id = id++; + } + dumpvar.total = id; + + dumpfile = shell_fopen(dumpvar.file_name, "w"); + if (!dumpfile) { + runtime_error(node); + warning("Cannot open dump file '%s'; skipping $dumpvars", + dumpvar.file_name, NULL); + return 0; + } + fprintf(dumpfile, "$date\n"); + fprintf(dumpfile, " %s\n", ctime(&t)); + fprintf(dumpfile, "$end\n"); + fprintf(dumpfile, "$version\n"); + fprintf(dumpfile, " %s %s\n", VERIWELL, VERSION); + fprintf(dumpfile, "$end\n"); + + timescale_get(STMT_SCOPE(node), &units, &prec); + fprintf(dumpfile, "$timescale\n %s\n$end\n\n", + timescale_string(prec, timebuf)); + for (scope = top_level; scope; scope = TREE_CHAIN(scope)) { + dumpvars_printvars(scope, 0); + } + fprintf(dumpfile, "$enddefinitions $end\n"); + return 1; +} + +static void dumpvars_time(void) +{ + if (dumpvar.new_time) { + dumpvar.new_time = 0; + fprintf(dumpfile, "#%s\n", time_string(&CurrentTime)); + } +} + +/* Print a single value */ + +static void dumpvars_print_val(tree decl, int index) +{ + if (TREE_NBITS(decl) == 1) { + switch (DECL_STATE(decl)) { + case ZERO: + fprintf(dumpfile, "0"); + break; + case ONE: + fprintf(dumpfile, "1"); + break; + case X: + fprintf(dumpfile, "x"); + break; + case Z: + fprintf(dumpfile, "z"); + break; + } + } else { + fprintf(dumpfile, "b"); + print_binary_file(dumpfile, DECL_STORAGE(decl), TREE_NBITS(decl)); + fprintf(dumpfile, " "); + } + fprintf(dumpfile, "%s", dumpvars_xlate(index)); +} + +/* Print the current values of all dumped vars */ + +static void dumpvars_dump_all(void) +{ + Marker *marker; + + for (marker = dumpvar.printed; marker; marker = marker->link) { + dumpvars_print_val(marker->decl, marker->expr.vcd_id); + fprintf(dumpfile, "\n"); + } +} + +/* Print a variable change; print the time first if needed; + Called from sched.c */ + +void dumpvars_dump(tree decl, int index) +{ + dumpvars_time(); + dumpvars_print_val(decl, index); + fprintf(dumpfile, "\n"); +} + +/* Print first line of dump */ + +void dumpvars_checkpoint(char *which) +{ + dumpvars_time(); + fprintf(dumpfile, "%s\n", which); + dumpvars_dump_all(); + fprintf(dumpfile, "$end\n"); +} + +void dumpvars_x(char *which) +{ + Marker *marker; + + dumpvars_time(); + fprintf(dumpfile, "%s ", which); + + for (marker = dumpvar.printed; marker; marker = marker->link) { + tree decl = marker->decl; + int index = marker->expr.vcd_id; + + if (TREE_NBITS(decl) == 1) { + fprintf(dumpfile, "x"); + } else { + fprintf(dumpfile, "bx"); + } + fprintf(dumpfile, " "); + + fprintf(dumpfile, "%s\n", dumpvars_xlate(index)); + } + fprintf(dumpfile, "$end\n\n"); +} + +/* Flush the dumpfile */ + +void dumpvars_flush() +{ + if (dumpfile) { + fflush(dumpfile); + } +} + +void init_dumpvar(void) +{ + dumpvar.file_name = "veriwell.dmp"; + dumpfile = NULL; +} diff --git a/src/dumpvar.h b/src/dumpvar.h new file mode 100644 index 0000000..59b9b3a --- /dev/null +++ b/src/dumpvar.h @@ -0,0 +1,53 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* DUMPVAR.H - VCD structures and prototypes */ + +#ifndef DUMPVAR_H +#define DUMPVAR_H + + +struct Dump { + Marker *markers_first; + Marker *markers_last; + Marker *unprinted; /* Before printin header, links are here */ + Marker *printed; /* When printed, move to here */ + unsigned disallow_dumpvars:1; /* Too late, dumpvars already processed */ + unsigned first_dumpvars:1; /* First call to $dumpvars */ + unsigned enabled:1; /* Enable/disabled */ + unsigned new_time:1; /* Time changed; print time */ + int total; + char *file_name; +}; + +extern struct Dump dumpvar; + +void dumpvars_all(void); /* Dump all vars in a simulation */ +void dumpvars_scope_down(tree, int); /* Dump all in a scope and down */ +void dumpvars_mark(tree); /* Dump a single qualified var */ +int dumpvars_header(tree); /* Print the VCD header */ +void dumpvars_enable(void); /* Turn on dumpvars */ +void dumpvars_disable(void); /* Turn off dumpvars */ +void dumpvars_checkpoint(char *); /* Print current values of all */ +void dumpvars_x(char *); /* Print Xs for all */ +void dumpvars_flush(void); /* flush dumpfile */ +void dumpvars_dump(tree decl, int index); +void init_dumpvar(void); + +#endif // DUMPVAR_H diff --git a/src/eval.cc b/src/eval.cc new file mode 100644 index 0000000..fc636e4 --- /dev/null +++ b/src/eval.cc @@ -0,0 +1,2337 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* EVAL.C - Interpretively evaluate operands and operators */ + +#include +#include +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "acc_user.h" +#include "pli.h" +#include "schedule.h" +#include "runtime.h" +#include "systask.h" +#include "flags.h" +#include "io.h" +#include "eval.h" +#include "glue.h" +#include "multdiv.h" +#include "store.h" +#include "eval.h" +#include "exec.h" +#include "veriwell.h" + +static int xor_reduce(Bit a, int l); +static void copy_left(nbits_t size, nbits_t multiplier, Group * g); +static void load_fill(Group * g, int ngroups, Bit aval, Bit bval); +static void load_1bit(Group * g, int ngroups, int bit); +static void eval_and_retain_flags(tree * pc); + +/* Array of virtual accumulator registers. "r" is the register at the + top of the stack, that is, the register to be used next. The size + of the register is dynamically set, depending on the operation. */ +Group **R_base; +Group **R; +int current_area = 0; +int current_regs = 0; +nbits_t R_nbits = 0; +ngroups_t R_ngroups = 0; +Bit R_mask; +tree global_shadow; /* Used for eval_nbits */ +double x32; /* This is set to 2^32 */ + +/* Convert a reg type to a double */ +double reg_to_real(Group * g, nbits_t nbits) +{ + double x = 0; + ngroups_t ngroups = bits_to_groups(nbits); + Group *g1 = g + ngroups; + + x = AVAL(g1) & mask_right1[R_nbits & NBITS_MASK]; + for (int i = ngroups; i > 0; i--) { + g1--; + x = ldexp(x, sizeof(Bit) * 8); + x += AVAL(g1); + } + return x; +} + +void real_to_reg(double x, Group * g, ngroups_t ngroups) +{ + x += 0.5; /* round up */ + for (int i = 0; i <= ngroups; i++, g++) { + AVAL(g) = (Bit) fmod(x, x32); + BVAL(g) = 0; + x = ldexp(x, -(sizeof(Bit) * 8)); + } +} + +static int xor_reduce(Bit a, int l) +{ + int result = 0; + + for (int i = 0; i < l; i++) { + if (((a >> i) & 1) == 1) { + result = !result; + } + } + return result; +} + +int part_lref(Group * g1, Group * g2, struct part_info *info) +{ + Bit lshift = PART_SHIFT(info); + Bit lmask1 = PART_LMASK1(info); + Bit aval; + Bit bval; + ngroups_t ngroups = PART_NGROUPS(info); + ngroups_t i; + int changed = 0; + + if (!ngroups) { + if (PART_ALIGNED(info)) { + /* case 1: reference within one group without crossing a boundary */ + aval = AVAL(g1); + bval = BVAL(g1); + AVAL(g1) = ((AVAL(g2) << lshift) & ~lmask1) | (aval & lmask1); + BVAL(g1) = ((BVAL(g2) << lshift) & ~lmask1) | (bval & lmask1); + changed = aval != AVAL(g1) || bval != BVAL(g1); + } else { + /* case 2: reference within one group on stack, + * but crosses boundary in dest + */ + Bit lmask2 = PART_LMASK2(info); + Bit rshift = sizeof(Bit) * 8 - lshift; + + aval = AVAL(g1); + bval = BVAL(g1); + AVAL(g1) = (AVAL(g2) << lshift) | (aval & lmask1); + BVAL(g1) = (BVAL(g2) << lshift) | (bval & lmask1); + changed = aval != AVAL(g1) || bval != BVAL(g1); + g1++; + /* if lshift is 0, then rshift is 32 which is an undefined + shift count for most compilers */ + if (lshift) { + aval = AVAL(g1); + bval = BVAL(g1); + AVAL(g1) = + ((AVAL(g2) >> rshift) & ~lmask2) | (aval & lmask2); + BVAL(g1) = + ((BVAL(g2) >> rshift) & ~lmask2) | (bval & lmask2); + changed = changed || aval != AVAL(g1) || bval != BVAL(g1); + } + } + } else { + /* case 3 & 4: reference more than one group */ + Bit rshift = sizeof(Bit) * 8 - lshift; + Bit lmask2 = PART_LMASK2(info); + aval = AVAL(g1); + bval = BVAL(g1); + for (i = 0; i < ngroups; i++) { + AVAL(g1) = ((AVAL(g2) << lshift) & ~lmask1) | (aval & lmask1); + BVAL(g1) = ((BVAL(g2) << lshift) & ~lmask1) | (bval & lmask1); + changed = changed || aval != AVAL(g1) || bval != BVAL(g1); + g1++; + aval = AVAL(g1); + bval = BVAL(g1); + if (lshift) { + AVAL(g1) = + ((AVAL(g2) >> rshift) & lmask1) | (aval & ~lmask1); + BVAL(g1) = + ((BVAL(g2) >> rshift) & lmask1) | (bval & ~lmask1); + } + aval = AVAL(g1); + bval = BVAL(g1); + g2++; + } + + if (lmask2 || !lshift) { /* make sure that there is more stuff to copy */ + if (PART_ALIGNED(info)) { + AVAL(g1) = + ((AVAL(g2) << lshift) & ~lmask2) | (aval & lmask2); + BVAL(g1) = + ((BVAL(g2) << lshift) & ~lmask2) | (bval & lmask2); + changed = changed || aval != AVAL(g1) || bval != BVAL(g1); + } else { + AVAL(g1) = (AVAL(g2) << lshift) | (aval & lmask1); + BVAL(g1) = (BVAL(g2) << lshift) | (bval & lmask1); + changed = changed || aval != AVAL(g1) || bval != BVAL(g1); + g1++; + aval = AVAL(g1); + bval = BVAL(g1); + AVAL(g1) = (AVAL(g2) >> rshift) | (aval & lmask2); + BVAL(g1) = (BVAL(g2) >> rshift) | (bval & lmask2); + changed = changed || aval != AVAL(g1) || bval != BVAL(g1); + } + } + } + return changed; +} + +static void copy_left(nbits_t size, nbits_t multiplier, Group * g) +{ + ngroups_t i; + ngroups_t ngroups = bits_to_groups(size); + ngroups_t shift_groups; + nbits_t shift_bits; + Group *g1; + Group *g2; + Bit mask; + + shift_bits = size * (multiplier - 1); + shift_groups = bits_to_groups(shift_bits + 1); + shift_bits %= BITS_IN_GROUP; + if (shift_groups <= 0) { + shift_groups = 0; + } + + if (shift_bits + size > BITS_IN_GROUP) { + ngroups++; + } + + g1 = g + ngroups + shift_groups; /* msb of dest */ + g2 = g1 - shift_groups; /* msb of source */ + mask = mask_right1[size & NBITS_MASK]; + + if (shift_groups <= R_ngroups) { + AVAL(g1) |= ((AVAL(g2) & mask) << shift_bits); // | AVAL (g1); + BVAL(g1) |= ((BVAL(g2) & mask) << shift_bits); // | BVAL (g1); + for (i = 0; i < ngroups; i++) { + g2--; + AVAL(g1) |= AVAL(g2) >> (BITS_IN_GROUP - shift_bits); + BVAL(g1) |= BVAL(g2) >> (BITS_IN_GROUP - shift_bits); + g1--; + AVAL(g1) |= (AVAL(g2) << shift_bits); // | tmp; + BVAL(g1) |= (BVAL(g2) << shift_bits); // | tmp2b; + } + g1--; + } +} + +/* Return 0 if result is zero, else return 1 */ +/* TREE_NBITS has the size of the current subexpression, that is, it + is the size of the accumulator. This is not to be confused with the + size of a constant being loaded wiich may have to be zero filled to + the size of the accumulator. Note that the size of a constant will + never be larger than the size of the accumulator since the size of the + accumulator is determined at parse time to be the max of the sizes of + the subexpression. Operators that are context-determined (arithmetic) + don't change the accumulator size; its size is set at the beginning + of an expression (when constants, decls, or refs are loaded) and on self- + determined operators (conditionals and reductions). */ + +/* fill the datum with all of one value (0, 1, X, Z) */ + +static void load_fill(Group * g, int ngroups, Bit aval, Bit bval) +{ + int i; + + AVAL(g) = aval; + BVAL(g) = bval; + for (i = 1; i <= ngroups; i++) { + g++; + AVAL(g) = aval; + BVAL(g) = bval; + } +} + +static void load_1bit(Group * g, int ngroups, int bit) +{ + int i; + Bit aval; + Bit bval; + + switch (bit) { + case (0): + aval = 0; + bval = 0; + break; + case (1): + aval = 1; + bval = 0; + break; + case ('x'): + aval = 1; + bval = 1; + break; + case ('z'): + aval = 0; + bval = 1; + break; + } + AVAL(g) = aval; + BVAL(g) = bval; + for (i = 1; i <= ngroups; i++) { + g++; + AVAL(g) = 0; + BVAL(g) = 0; + } +} + +ngroups_t part_rref(Group * g1, Group * g2, struct part_info *info) +{ + Bit mask1 = ~PART_LMASK1(info); + Bit mask2 = ~PART_LMASK2(info); + int rshift = PART_SHIFT(info); + Bit rmask = PART_RMASK(info); + ngroups_t ngroups = PART_NGROUPS(info); + ngroups_t i; + + if (!rshift) { /* Aligned */ + if (R_ngroups) { + for (i = 0; i < ngroups; i++, g1++, g2++) { + AVAL(g1) = AVAL(g2); + BVAL(g1) = BVAL(g2); + } + } + AVAL(g1) = AVAL(g2) & rmask; //mask1;//rmask; + BVAL(g1) = BVAL(g2) & rmask; //mask1;//rmask; + } else { /* there is an offset */ + /* Unaligned, but can be moved with one copy, i.e. no boundary cross */ + if (!ngroups && PART_ALIGNED(info)) { + AVAL(g1) = ((AVAL(g2) /*& mask1 */ ) >> rshift) & rmask; + BVAL(g1) = ((BVAL(g2) /*& mask1 */ ) >> rshift) & rmask; + /* worst case: unaligned and crosses boundary */ + } else { + int lshift = sizeof(Bit) * 8 - rshift; + /* it takes two copies to move one unaligned group. Do the + copies in pairs so that each pair will form one aligned + group on the stack. Note that we may copy too much, but this + will be masked. */ + for (i = 0; i <= ngroups; i++) { + AVAL(g1) = AVAL(g2) >> rshift; + BVAL(g1) = BVAL(g2) >> rshift; + g2++; + /* if rshift is 0, then lshift is 32 which is undefined */ + if (rshift) { + AVAL(g1) |= AVAL(g2) << lshift; + BVAL(g1) |= BVAL(g2) << lshift; + } else { + AVAL(g1) = AVAL(g2); + BVAL(g1) = BVAL(g2); + } + g1++; + } + + /* Did we copy too much? If so mask off the stuff we don't want */ + if (PART_ALIGNED(info)) { + g1--; + AVAL(g1) &= rmask; + BVAL(g1) &= rmask; + /* we have to make one more copy to the stack */ + } else { + AVAL(g1) = (AVAL(g2) >> rshift) /* & mask2 */ ; + BVAL(g1) = (BVAL(g2) >> rshift) /* & mask2 */ ; + } + } /* else (crosses boundary) */ + } /* else (offset) */ + return PART_NEXT(info); +} + +int in_cond = 0; +int is_integer = 0; +int is_real = 0; + +Group *eval_(tree * pc, nbits_t * nbits) +{ + eval(pc); + *nbits = R_nbits; + return *--R; +} + +/* eval a single decl node */ + +void eval_1(tree decl) +{ + tree pc[2]; + + pc[0] = decl; + pc[1] = NULL_TREE; + eval(pc); +} + +static void eval_and_retain_flags(tree * pc) +{ + int saved_integer_flag = is_integer; + int saved_real_flag = is_real; + + eval(pc); + is_integer = saved_integer_flag; + is_real = saved_real_flag; +} + +void eval(tree * pc) +{ + tree t; + tree t1; + tree t2; + enum tree_code code; + enum logical_value cond; + enum logical_value cond1; + int tmpint; + Group *g; + Group *g1; + Group *g2; + ngroups_t i; + ngroups_t ngroups; + ngroups_t shift_groups; + nbits_t shift_bits; + nbits_t nbits; + Bit tmp1; + Bit tmp2; + + /* Test if this should use integer operations. Note that eval can be + called recursively from the conditional operator (?:), so the + integer flag must be preserved [pathological case: (1 ? -12/3 : 1'b1) + is NOT an integer, so the -12/3 must be evaluated as unsigned]. */ + if (!in_cond) { + is_integer = TREE_INTEGER_ATTR(*pc); + is_real = TREE_REAL_ATTR(*pc); + } + if (!pc) { + printf_error_V("NULL pc in EVAL, aborting.\n"); + shell_abort(); + } + + while ((t = *pc) != 0) { + code = TREE_CODE(t); + switch (code) { + +/***************************************************************************/ +/* Value loading */ +/***************************************************************************/ + + case INTEGER_DECL: + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & (nbits_t) NBITS_MASK]; + g1 = *R; + g2 = DECL_STORAGE(t); + AVAL(g1) = AVAL(g2); + BVAL(g1) = BVAL(g2); + if (R_ngroups > 0) { + for (i = 1; i <= R_ngroups; i++) { + g1++; + g2++; + AVAL(g1) = 0; + BVAL(g1) = 0; + } + } + *++R = g1 + 1; + break; + + case REG_VECTOR_DECL: + case NET_VECTOR_DECL: + case TMP_DECL: + case TIME_DECL: + case PARAM_DECL: + case SPECPARAM_DECL: + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + g1 = *R; + g2 = DECL_STORAGE(t); + AVAL(g1) = AVAL(g2); + BVAL(g1) = BVAL(g2); + if (R_ngroups > 0) { + for (i = 1; i <= R_ngroups; i++) { + g1++; + g2++; + AVAL(g1) = AVAL(g2); + BVAL(g1) = BVAL(g2); + } + } + *++R = g1 + 1; + break; + + case EVENT_DECL: + g1 = *R; + AVAL(g1) = 1; /* Stuff "true" for evaluation purposes (ignored) */ + BVAL(g1) = 0; + *++R = g1 + 1; + break; + + case REG_SCALAR_DECL: + case NET_SCALAR_DECL: + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + g1 = *R; + g2 = DECL_STORAGE(t); + AVAL(g1) = AVAL(g2); + BVAL(g1) = BVAL(g2); + if (R_ngroups > 0) { + for (i = 1; i <= R_ngroups; i++) { + g1++; + g2++; + AVAL(g1) = 0; + BVAL(g1) = 0; + } + } + *++R = g1 + 1; + break; + + case REAL_DECL: + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & (nbits_t) NBITS_MASK]; + g1 = *R; + g2 = DECL_STORAGE(t); + REAL_(g1) = REAL_(g2); + *++R = g1 + 1; + break; + + case SHADOW_REF: /* This works for vect and scalared types */ + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + t = TREE_CHAIN(t); /* point to original decl */ + g1 = *R; + if (TREE_CODE(t) == EVENT_DECL) { + AVAL(g1) = 1; /* true */ + BVAL(g1) = 0; + for (i = 1; i <= R_ngroups; i++) { + g1++; + AVAL(g1) = 0; + BVAL(g1) = 0; + } + *++R = g1 + 1; + break; + } + + g2 = DECL_STORAGE(t); + nbits = TREE_NBITS(t); + ngroups = bits_to_groups(nbits); + + /* Load low full groups */ + for (i = 0; i < ngroups; i++, g1++, g2++) { + AVAL(g1) = AVAL(g2); + BVAL(g1) = BVAL(g2); + } + /* Load highest, possibly partial, group */ + AVAL(g1) = AVAL(g2) & mask_right1[nbits & NBITS_MASK]; + BVAL(g1) = BVAL(g2) & mask_right1[nbits & NBITS_MASK]; + + /* Fill remainder with 0's if necessary, since decl could be + smaller than stack size */ + for (i++; i <= R_ngroups; i++) { + g1++; + AVAL(g1) = 0; + BVAL(g1) = 0; + } + *++R = g1 + 1; + break; + + case ARRAY_REF: + /* evaluate the index (guarranteed to be >= 32 bits) */ + eval_and_retain_flags(BIT_EXPR_CODE(t)); + cond = ZERO; + g1 = *--R; + if (BVAL(g1) & R_mask) { + cond = X; + } + { + tree decl = ARRAY_REF_DECL(t); + ngroups_t array_hi = ARRAY_HI(decl); + ngroups_t array_lo = ARRAY_LO(decl); + ngroups_t ngroups = 1 + bits_to_groups(TREE_NBITS(decl)); + Bit aval = AVAL(g1) & R_mask; + ngroups_t offset; + + if (VECTOR_DIRECTION_ATTR(decl)) { + if (aval < array_lo || aval > array_hi) { + cond = X; + } else { + offset = (aval - array_lo) * ngroups; + } + } else { + if (aval < array_hi || aval > array_lo) { + cond = X; + } else { + offset = (aval - array_hi) * ngroups; + } + } + + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + + g1 = *R; + if (cond != X) { + g2 = DECL_STORAGE(decl) + offset; + } + + ngroups = bits_to_groups(TREE_NBITS(decl)); + if (cond != X) { + AVAL(g1) = AVAL(g2); + BVAL(g1) = BVAL(g2); + } else { + AVAL(g1) = (Bit) - 1; + BVAL(g1) = (Bit) - 1; + } + for (i = 1; i <= ngroups; i++) { + g1++; + g2++; + if (cond != X) { + AVAL(g1) = AVAL(g2); + BVAL(g1) = BVAL(g2); + } else { + AVAL(g1) = (Bit) - 1; + BVAL(g1) = (Bit) - 1; + } + } + for (; i <= R_ngroups; i++) { + g1++; + AVAL(g1) = 0; + BVAL(g1) = 0; + } + *++R = g1 + 1; + } + break; + + case BIT_REF: + /* evaluate the index */ + eval_and_retain_flags(BIT_EXPR_CODE(t)); + g2 = DECL_STORAGE(BIT_REF_DECL(t)); + cond = ZERO; + g1 = *--R; + if (BVAL(g1)) { + cond = X; + goto condition_done; + } + { + tree decl = BIT_REF_DECL(t); + nbits_t decl_lsb = LSB(decl); + nbits_t decl_msb = MSB(decl); + Bit aval = AVAL(g1); + nbits_t bit_offset; + ngroups_t group_offset; + + if (VECTOR_DIRECTION_ATTR(decl)) { + if (aval < decl_lsb || aval > decl_msb) { + cond = X; + goto condition_done; + } else { + bit_offset = (aval - decl_lsb) % BITS_IN_GROUP; + group_offset = bits_to_groups(aval - decl_lsb + 1); + } + } else { + if (aval < decl_msb || aval > decl_lsb) { + cond = X; + goto condition_done; + } else { + bit_offset = (decl_lsb - aval) % BITS_IN_GROUP; + group_offset = bits_to_groups(decl_lsb - aval + 1); + } + } + cond = ((AVAL(g2 + group_offset) & + ((Bit) 1 << bit_offset)) != 0) ? ONE : ZERO; + if (BVAL(g2 + group_offset) & ((Bit) 1 << bit_offset)) { + if (cond) { + cond = X; + } else { + cond = Z; + } + } + } + goto condition_done; + + case PART_REF: + { + struct part_info *info = PART_INFO(t); + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + g1 = *R; + g2 = PART_STORAGE(t); + part_rref(g1, g2, info); + + /* Fill high order with zeros */ + for (i = PART_NGROUPS(info) + 1; i <= R_ngroups; i++) { + AVAL(g1 + i) = 0; + BVAL(g1 + 1) = 0; + } + *++R = g1 + 1 + R_ngroups; + break; + } + + case INTEGER_CST: + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + g = *R; + AVAL(g) = (unsigned_32_t) INT_CST_DATA(t); + BVAL(g) = 0; + if (R_ngroups > 0) { + for (i = 1; i <= R_ngroups; i++) { + g++; + AVAL(g) = 0; + BVAL(g) = 0; + } + } + *++R = g + 1; + break; + + case REAL_CST: + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + g = *R; + REAL_(g) = REAL_CST_DATA(t); + *++R = g + 1; + break; + + case BIT_CST: + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + g = *R; + g1 = BIT_CST_GROUP(t); + /* always copy one group */ + AVAL(g) = AVAL(g1); + BVAL(g) = BVAL(g1); + { + ngroups_t j = bits_to_groups(BIT_CST_NBITS(t)); + i = 1; + /* If more than one group to copy, copy them all */ + if (j >= 1) { + for (i = 1; i <= j; i++) { + g++; + g1++; + AVAL(g) = AVAL(g1); + BVAL(g) = BVAL(g1); + } + } + /* If virtual register is larger than constant, zero fill */ + if (R_ngroups > j) { + for (; i <= R_ngroups; i++) { + g++; + AVAL(g) = 0; + BVAL(g) = 0; + } + } + } + *++R = g + 1; + break; + + case CONCAT_REF: + case CONCAT_REP_REF: + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + g1 = *R; + g = *R; + ngroups = 0; + *++R = g2 = g1 + R_ngroups + 1; + for (i = 0; i <= R_ngroups; i++, g1++) { + AVAL(g1) = 0; + BVAL(g1) = 0; + } + g1 = g; + for (t1 = CONCAT_LIST(t); t1; t1 = TREE_CHAIN(t1)) { + eval((tree *) TREE_PURPOSE(TREE_VALUE(t1))); + R--; + part_lref(g1, g2, (struct part_info *) + TREE_VALUE(TREE_VALUE(t1))); + g1 += PART_NEXT((struct part_info *) + TREE_VALUE(TREE_VALUE(t1))); + } + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + if (code == CONCAT_REP_REF) { + ngroups = bits_to_groups(CONCAT_NBITS(t)); + g1 = g + ngroups + 1; + for (i = ngroups + 1; i <= R_ngroups; i++, g1++) { + AVAL(g1) = BVAL(g1) = 0; + } + for (i = CONCAT_COUNT(t); i > 1; i--) { + copy_left(CONCAT_NBITS(t), i, g); + } + } + break; + + case FUNCTION_REF: + { + Group **R_save; + Group **R_base_save; + nbits_t R_nbits_save; + ngroups_t R_ngroups_save; + Bit R_mask_save; + + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + + t2 = FUNCT_INPUT(FUNC_REF_FUNC(t)); + for (t1 = FUNC_REF_INASSIGN(t); t1; + t1 = TREE_CHAIN(t1), t2 = TREE_CHAIN(t2)) { + eval((tree *) TREE_PURPOSE(t1)); + store(TREE_PURPOSE(t2), FUNC_REF_FUNC(t)); + } + R_save = R; + R_base_save = R_base; + R_nbits_save = R_nbits; + R_ngroups_save = R_ngroups; + R_mask_save = R_mask; + R_base = (union group **) xmalloc + (TREE_LABEL(FUNC_REF_FUNC(t)) * + sizeof(union group **)); + R = R_base; + *R = (union group *) + xmalloc(FUNCT_AREA(FUNC_REF_FUNC(t)) + * sizeof(Group)); + if (!R || !*R) { + printf_error_V("Out of memory at function call (%s)\n", + FUNC_REF_NAME(t)); + shell_abort(); + } + exec_(t); + free(*R_base); + free(R); + R = R_save; + R_base = R_base_save; + R_nbits = R_nbits_save; + R_ngroups = R_ngroups_save; + R_mask = R_mask_save; + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + eval_nbits(FUNCT_DECL(FUNC_REF_FUNC(t)), R_nbits); + } + break; + + case SYSFUNCTION_REF: + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + exec_sysfunc(t, R_nbits); + break; + + +/***************************************************************************/ +/* Bitwise operators: ~ & | ^ ~^ */ +/***************************************************************************/ + + case BIT_NOT_EXPR: + g1 = *--R; + AVAL(g1) = ~AVAL(g1) | BVAL(g1); /* ~X,~Z -> X */ + for (i = 1; i <= R_ngroups; i++) { + g1++; + AVAL(g1) = ~AVAL(g1) | BVAL(g1); /* ~X,~Z -> X */ + } + R++; + break; + + case BIT_AND_EXPR: + g2 = *--R; + g1 = *--R; + if (!BVAL(g1) && !BVAL(g2)) { + AVAL(g1) &= AVAL(g2); + } else { + tmp1 = AVAL(g1) | BVAL(g1); + tmp2 = AVAL(g2) | BVAL(g2); + AVAL(g1) = tmp1 & tmp2; /* if aval is 1, could be 1 or X */ + BVAL(g1) = AVAL(g1) & (BVAL(g1) | BVAL(g2)); + } + for (i = 1; i <= R_ngroups; i++) { + g1++; + g2++; + if (!BVAL(g1) && !BVAL(g2)) { + AVAL(g1) &= AVAL(g2); + } else { + tmp1 = AVAL(g1) | BVAL(g1); + tmp2 = AVAL(g2) | BVAL(g2); + AVAL(g1) = tmp1 & tmp2; /* if aval is 1, could be 1 or X */ + BVAL(g1) = AVAL(g1) & (BVAL(g1) | BVAL(g2)); + } + } + R++; + break; + + case BIT_OR_EXPR: + g2 = *--R; + g1 = *--R; + if (!BVAL(g1) && !BVAL(g2)) { + AVAL(g1) |= AVAL(g2); + } else { /* 1|z->x, 0|anything->0 */ + /* All must be zero */ + tmp1 = AVAL(g1); + AVAL(g1) |= AVAL(g2) | BVAL(g1) | BVAL(g2); + BVAL(g1) = (~tmp1 & BVAL(g2)) + | (~AVAL(g2) & BVAL(g1)) | (BVAL(g1) & BVAL(g2)); + } + for (i = 1; i <= R_ngroups; i++) { + g1++; + g2++; + if (!BVAL(g1) && !BVAL(g2)) { + AVAL(g1) |= AVAL(g2); + } else { + tmp1 = AVAL(g1); + AVAL(g1) |= AVAL(g2) | BVAL(g1) | BVAL(g2); + BVAL(g1) = (~tmp1 & BVAL(g2)) + | (~AVAL(g2) & BVAL(g1)) | (BVAL(g1) & BVAL(g2)); + } + } + R++; + break; + + case BIT_XOR_EXPR: + g2 = *--R; + g1 = *--R; + if (!BVAL(g1) && !BVAL(g2)) { + AVAL(g1) ^= AVAL(g2); + } else { + /* Z or Z XORed with anything is X */ + BVAL(g1) = BVAL(g1) | BVAL(g2); + AVAL(g1) = (AVAL(g1) ^ AVAL(g2)) | BVAL(g1); + } + for (i = 1; i <= R_ngroups; i++) { + g1++; + g2++; + if (!BVAL(g1) && !BVAL(g2)) { + AVAL(g1) ^= AVAL(g2); + } else { + /* Z or Z XORed with anything is X */ + BVAL(g1) = BVAL(g1) | BVAL(g2); + AVAL(g1) = (AVAL(g1) ^ AVAL(g2)) | BVAL(g1); + } + } + R++; + break; + + case BIT_XNOR_EXPR: + g2 = *--R; + g1 = *--R; + if (!BVAL(g1) && !BVAL(g2)) { + AVAL(g1) ^= ~AVAL(g2); + } else { + /* Z or Z XORed with anything is X */ + BVAL(g1) = BVAL(g1) | BVAL(g2); + AVAL(g1) = ~(AVAL(g1) ^ AVAL(g2)) | BVAL(g1); + } + for (i = 1; i <= R_ngroups; i++) { + g1++; + g2++; + if (!BVAL(g1) && !BVAL(g2)) { + AVAL(g1) ^= ~AVAL(g2); + } else { + /* Z or Z XORed with anything is X */ + BVAL(g1) = BVAL(g1) | BVAL(g2); + AVAL(g1) = ~(AVAL(g1) ^ AVAL(g2)) | BVAL(g1); + } + } + R++; + break; + +/***************************************************************************/ +/* Event operators: ANYEDGE, POSEDGE, NEGEDGE */ +/***************************************************************************/ + + case ANYEDGE_EXPR: + --R; + cond = ONE; + goto condition_done; + + case POSEDGE_EXPR: + --R; + cond = (enum logical_value) ((AVAL(*R) & 1) | + ((BVAL(*R) & 1) << 1)); + cond1 = + (enum logical_value) (unsigned long) TREE_OPERAND(t, 1); + tmpint = cond; + TREE_OPERAND(t, 1) = (tree) tmpint; + + if ((cond == ONE || cond1 == ZERO) && cond1 != cond) { + cond = ONE; + } else { + cond = ZERO; + } + goto condition_done; + + case NEGEDGE_EXPR: + --R; + cond = (enum logical_value) ((AVAL(*R) & 1) | + ((BVAL(*R) & 1) << 1)); + cond1 = + (enum logical_value) (unsigned long) TREE_OPERAND(t, 1); + tmpint = cond; + TREE_OPERAND(t, 1) = (tree) tmpint; + if ((cond == ZERO || cond1 == ONE) && cond1 != cond) { + cond = ONE; + } else { + cond = ZERO; + } + goto condition_done; + +/***************************************************************************/ +/* Reduction operators: & ~& | ~| ^ ~^ */ +/***************************************************************************/ + + case AND_REDUCE_EXPR: + g1 = *--R; + cond = ONE; + for (i = 0; i < R_ngroups; i++, g1++) { + /* if there are any zeros, we are done */ + if (~AVAL(g1) & ~BVAL(g1)) { + cond = ZERO; + break; + /* (X or Z) and 1 -> X */ + } else if (BVAL(g1)) { + cond = X; + } + } + /* last group (most significant) need to be masked */ + if (~AVAL(g1) & ~BVAL(g1) & R_mask) { + cond = ZERO; + /* (X or Z) and 1 -> X */ + } else if (BVAL(g1) & R_mask) { + cond = X; + } + goto condition_done; + + case NAND_REDUCE_EXPR: + g1 = *--R; + cond = ZERO; + for (i = 0; i < R_ngroups; i++, g1++) { + /* if there are any zeros, we are done */ + if (~AVAL(g1) & ~BVAL(g1)) { + cond = ONE; + break; + /* (X or Z) and 1 -> X */ + } else if (BVAL(g1)) { + cond = X; + } + } + /* last group (most significant) need to be masked */ + if (~AVAL(g1) & ~BVAL(g1) & R_mask) { + cond = ONE; + /* (X or Z) and 1 -> X */ + } else if (BVAL(g1) & R_mask) { + cond = X; + } + goto condition_done; + + case OR_REDUCE_EXPR: + g1 = *--R; + cond = ZERO; + for (i = 0; i < R_ngroups; i++, g1++) { + /* if there are any ones, we are done */ + if (AVAL(g1) & ~BVAL(g1)) { + cond = ONE; + break; + /* (X or Z) and 1 -> X */ + } else if (BVAL(g1)) { + cond = X; + } + } + /* last group (most significant) need to be masked */ + if (AVAL(g1) & ~BVAL(g1) & R_mask) { + cond = ONE; + /* (X or Z) and 1 -> X */ + } else if (BVAL(g1) & R_mask) { + cond = X; + } + goto condition_done; + + case NOR_REDUCE_EXPR: + g1 = *--R; + cond = ONE; + for (i = 0; i < R_ngroups; i++, g1++) { + /* if there are any ones, we are done */ + if (AVAL(g1) & ~BVAL(g1)) { + cond = ZERO; + break; + /* (X or Z) and 1 -> X */ + } else if (BVAL(g1)) { + cond = X; + } + } + /* last group (most significant) need to be masked */ + if (AVAL(g1) & ~BVAL(g1) & R_mask) { + cond = ZERO; + /* (X or Z) and 1 -> X */ + } else if (BVAL(g1) & R_mask) { + cond = X; + } + goto condition_done; + + case TRUTH_NOT_EXPR: + DETERMINE_TRUE_COND(g1); + if (cond == ONE) { + cond = ZERO; + } else if (cond == ZERO) { + cond = ONE; + } + goto condition_done; + + case XOR_REDUCE_EXPR: + cond = ZERO; + goto xor_common; + + case XNOR_REDUCE_EXPR: + cond = ONE; + xor_common: + g1 = *--R; + for (i = 0; i < R_ngroups; i++, g1++) { + if (BVAL(g1)) { + cond = X; + break; + } else if (xor_reduce(AVAL(g1), BITS_IN_GROUP)) { + if (cond == ZERO) { + cond = ONE; + } else { + cond = ZERO; + } + } + } + /* last group (most significant) need to be masked */ + if (cond != X) { + if (BVAL(g1) & R_mask) { + cond = X; + } else if (xor_reduce(AVAL(g1) & R_mask, + (R_nbits - 1) % BITS_IN_GROUP + 1)) { + if (cond == ZERO) { + cond = ONE; + } else { + cond = ZERO; + } + } + } + goto condition_done; + +/***************************************************************************/ +/* Logical operators: ! && || */ +/***************************************************************************/ + +/* case TRUTH_NOT_EXPR: (see NOR_REDUCE_EXPR) */ + case TRUTH_ORIF_EXPR: + DETERMINE_TRUE_COND(g1); + /* if left operand is one, then the right + operand is not evaluated */ + if (cond != ONE) { + cond1 = cond; + TEST(TRUTH_EXPR_CODE(t), g2); + if (cond == ZERO) { + /* if right operand is zero, pass the left op */ + cond = cond1; + } + } + goto condition_done; + + case TRUTH_ANDIF_EXPR: + DETERMINE_TRUE_COND(g1); + /* if left operand is zero, then the right + operand is not evaluated */ + if (cond != ZERO) { + cond1 = cond; + TEST(TRUTH_EXPR_CODE(t), g2); + if (cond == ONE) { + /* if right operand is one, pass the left op */ + cond = cond1; + } + } + goto condition_done; + +/***************************************************************************/ +/* Equality operators: == != === !== */ +/***************************************************************************/ + + case EQ_EXPR: + if (is_real) { + g2 = *--R; + g1 = *--R; + AVAL(g1) = (REAL_(g1) == REAL_(g2)); + BVAL(g1) = 0; + R++; + break; + } + g2 = *--R; + g1 = *--R; + + cond = ONE; + for (i = 0; i < R_ngroups; i++, g1++, g2++) { + if (BVAL(g1) || BVAL(g2)) { + cond = X; + } else if (AVAL(g1) != AVAL(g2)) { + cond = ZERO; + break; + } + } + /* last group (most significant) need to be masked */ + if (cond == ONE) { + if ((BVAL(g1) | BVAL(g2)) & R_mask) { + cond = X; + } else if ((AVAL(g1) ^ AVAL(g2)) & R_mask) { + cond = ZERO; + } + } + goto condition_done; + + case NE_EXPR: + if (is_real) { + g2 = *--R; + g1 = *--R; + AVAL(g1) = (REAL_(g1) != REAL_(g2)); + BVAL(g1) = 0; + R++; + break; + } + { + /* + * x's do not automatically result + * in a x result if non-x value prove + * inequality + */ + int hasX = FALSE; + g2 = *--R; + g1 = *--R; + + cond = ZERO; + for (i = 0; i < R_ngroups; i++, g1++, g2++) { + if (BVAL(g1) || BVAL(g2)) { + hasX = 1; + } + if ((AVAL(g1) & ~BVAL(g1)) != (AVAL(g2) & ~BVAL(g2))) { + cond = ONE; + break; + } + } + /* last group (most significant) need to be masked */ + if (cond == ZERO) { + if ((BVAL(g1) | BVAL(g2)) & R_mask) { + hasX = X; + } else if (((AVAL(g1) & ~BVAL(g1)) ^ + (AVAL(g2) & ~BVAL(g2))) & R_mask) { + cond = ONE; + } + } + if (cond == ZERO && hasX) { + cond = X; + } + + goto condition_done; + } + + case EQ_CASE_EXPR: + g2 = *--R; + g1 = *--R; + cond = ONE; + for (i = 0; i < R_ngroups; i++, g1++, g2++) { + if ((AVAL(g1) != AVAL(g2)) || (BVAL(g1) != BVAL(g2))) { + cond = ZERO; + break; + } + } + /* last group (most significant) need to be masked */ + if (cond == ONE) { + if (((AVAL(g1) ^ AVAL(g2)) | + (BVAL(g1) ^ BVAL(g2))) & R_mask) { + cond = ZERO; + } + } + goto condition_done; + + case NE_CASE_EXPR: + g2 = *--R; + g1 = *--R; + cond = ZERO; + for (i = 0; i < R_ngroups; i++, g1++, g2++) { + if ((AVAL(g1) != AVAL(g2)) || (BVAL(g1) != BVAL(g2))) { + cond = ONE; + break; + } + } + /* last group (most significant) need to be masked */ + if (cond == ZERO) { + if (((AVAL(g1) ^ AVAL(g2)) | + (BVAL(g1) ^ BVAL(g2))) & R_mask) { + cond = ONE; + } + } + goto condition_done; + +/***************************************************************************/ +/* Relational operators: < > <= >= */ +/***************************************************************************/ + + case LT_EXPR: + if (is_integer) { + g2 = *--R; + g1 = *--R; + if (BVAL(g1) || BVAL(g2)) { + AVAL(g1) = (Bit) - 1; + BVAL(g1) = (Bit) - 1; + } else { + AVAL(g1) = (signed_32_t) AVAL(g1) < + (signed_32_t) AVAL(g2); + BVAL(g1) = 0; + } + R++; + break; + } else if (is_real) { + g2 = *--R; + g1 = *--R; + AVAL(g1) = (REAL_(g1) < REAL_(g2)); + BVAL(g1) = 0; + R++; + break; + } + + /* evaluate from left-to-right */ + g2 = (*R--) - 1; + g1 = (*R--) - 1; + /* first group (most significant) need to be masked */ + if ((BVAL(g1) | BVAL(g2)) & R_mask) { + cond = X; + goto condition_done; + } else if ((tmp1 = (AVAL(g1) & R_mask)) + > (tmp2 = AVAL(g2) & R_mask)) { + cond = ZERO; + goto condition_done; + } else if (tmp1 < tmp2) { + cond = ONE; + goto condition_done; + } + + /* keep doing if equal */ + for (i = 1, cond = ZERO; i <= R_ngroups; i++) { + g1--; + g2--; + if (BVAL(g1) || BVAL(g2)) { + cond = X; + break; + } else if ((tmp1 = AVAL(g1)) > (tmp2 = AVAL(g2))) { + cond = ZERO; + break; + } else if (tmp1 < tmp2) { + cond = ONE; + break; + } + } + goto condition_done; + + case LE_EXPR: + if (is_integer) { + g2 = *--R; + g1 = *--R; + if (BVAL(g1) || BVAL(g2)) { + AVAL(g1) = (Bit) - 1; + BVAL(g1) = (Bit) - 1; + } else { + AVAL(g1) = (signed_32_t) AVAL(g1) <= + (signed_32_t) AVAL(g2); + BVAL(g1) = 0; + } + R++; + break; + } else if (is_real) { + g2 = *--R; + g1 = *--R; + AVAL(g1) = (REAL_(g1) <= REAL_(g2)); + BVAL(g1) = 0; + R++; + break; + } + + /* evaluate from left-to-right */ + g2 = (*R--) - 1; + g1 = (*R--) - 1; + /* first group (most significant) need to be masked */ + if ((BVAL(g1) | BVAL(g2)) & R_mask) { + cond = X; + goto condition_done; + } else if ((tmp1 = (AVAL(g1) & R_mask)) + > (tmp2 = AVAL(g2) & R_mask)) { + cond = ZERO; + goto condition_done; + } else if (tmp1 < tmp2) { + cond = ONE; + goto condition_done; + } + + /* keep doing if equal */ + for (i = 1, cond = ONE; i <= R_ngroups; i++) { + g1--; + g2--; + if (BVAL(g1) || BVAL(g2)) { + cond = X; + break; + } else if ((tmp1 = AVAL(g1)) > (tmp2 = AVAL(g2))) { + cond = ZERO; + break; + } else if (tmp1 < tmp2) { + cond = ONE; + break; + } + } + goto condition_done; + + case GT_EXPR: + if (is_integer) { + g2 = *--R; + g1 = *--R; + if (BVAL(g1) || BVAL(g2)) { + AVAL(g1) = (Bit) - 1; + BVAL(g1) = (Bit) - 1; + } else { + AVAL(g1) = (signed_32_t) AVAL(g1) > + (signed_32_t) AVAL(g2); + BVAL(g1) = 0; + } + R++; + break; + } else if (is_real) { + g2 = *--R; + g1 = *--R; + AVAL(g1) = (REAL_(g1) > REAL_(g2)); + BVAL(g1) = 0; + R++; + break; + } + + /* evaluate from left-to-right */ + g2 = (*R--) - 1; + g1 = (*R--) - 1; + /* first group (most significant) need to be masked */ + if ((BVAL(g1) | BVAL(g2)) & R_mask) { + cond = X; + goto condition_done; + } else if ((tmp1 = (AVAL(g1) & R_mask)) + < (tmp2 = AVAL(g2) & R_mask)) { + cond = ZERO; + goto condition_done; + } else if (tmp1 > tmp2) { + cond = ONE; + goto condition_done; + } + + /* keep doing if equal */ + for (i = 1, cond = ZERO; i <= R_ngroups; i++) { + g1--; + g2--; + if (BVAL(g1) || BVAL(g2)) { + cond = X; + break; + } else if ((tmp1 = AVAL(g1)) < (tmp2 = AVAL(g2))) { + cond = ZERO; + break; + } else if (tmp1 > tmp2) { + cond = ONE; + break; + } + } + goto condition_done; + + case GE_EXPR: + if (is_integer) { + g2 = *--R; + g1 = *--R; + if (BVAL(g1) || BVAL(g2)) { + AVAL(g1) = (Bit) - 1; + BVAL(g1) = (Bit) - 1; + } else { + AVAL(g1) = (signed_32_t) AVAL(g1) >= + (signed_32_t) AVAL(g2); + BVAL(g1) = 0; + } + R++; + break; + } else if (is_real) { + g2 = *--R; + g1 = *--R; + AVAL(g1) = (REAL_(g1) >= REAL_(g2)); + BVAL(g1) = 0; + R++; + break; + } + + /* evaluate from left-to-right */ + g2 = (*R--) - 1; + g1 = (*R--) - 1; + /* first group (most significant) need to be masked */ + if ((BVAL(g1) | BVAL(g2)) & R_mask) { + cond = X; + goto condition_done; + } else if ((tmp1 = (AVAL(g1) & R_mask)) + < (tmp2 = AVAL(g2) & R_mask)) { + cond = ZERO; + goto condition_done; + } else if (tmp1 > tmp2) { + cond = ONE; + goto condition_done; + } + + /* keep doing if equal */ + for (i = 1, cond = ONE; i <= R_ngroups; i++) { + g1--; + g2--; + if (BVAL(g1) || BVAL(g2)) { + cond = X; + break; + } else if ((tmp1 = AVAL(g1)) < (tmp2 = AVAL(g2))) { + cond = ZERO; + break; + } else if (tmp1 > tmp2) { + cond = ONE; + break; + } + } + goto condition_done; + + + condition_done: + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + g1 = *R; + if (is_real) { + REAL_(g1) = (cond == ONE); + } else { + AVAL(g1) = (cond == ZERO || cond == Z) ? 0 : 1; + BVAL(g1) = (cond == X || cond == Z) ? 1 : 0; + } + if (R_ngroups > 0) { + for (i = 1; i <= R_ngroups; i++) { + g1++; + AVAL(g1) = 0; + BVAL(g1) = 0; + } + } + *++R = g1 + 1; + break; + +/***************************************************************************/ +/* Arithmetic operators: + - * / % */ +/***************************************************************************/ + + case PLUS_EXPR: + g2 = *--R; + g1 = *--R; + { + register unsigned int carry; + if (is_real) { + REAL_(g1) += REAL_(g2); + R++; + break; + } + cond = ZERO; + carry = 0; + + for (i = 0; i < R_ngroups; i++, g1++, g2++) { + AVAL(g1) += carry; + carry = !AVAL(g1) && carry; /* if wrap around to 0 */ + carry |= AVAL(g1) > ~AVAL(g2); + AVAL(g1) += AVAL(g2); + /* If there are any Xs of Zs, make the result unknown */ + if (BVAL(g1) | BVAL(g2)) { + cond = X; + } + } + + /* Don't need to prop caary on last group */ + AVAL(g1) += AVAL(g2) + carry; + if ((BVAL(g1) | BVAL(g2)) & R_mask) { + cond = X; + } + + if (cond == X) { + load_fill(*R, R_ngroups, (Bit) - 1, (Bit) - 1); + } + } + R++; + break; + + case MINUS_EXPR: + g2 = *--R; + g1 = *--R; + { + register unsigned int carry; + + if (is_real) { + REAL_(g1) -= REAL_(g2); + R++; + break; + } + cond = ZERO; + carry = 1; + + for (i = 0; i < R_ngroups; i++, g1++, g2++) { + AVAL(g1) += carry; + carry = !AVAL(g1) && carry; /* if wrap around to 0 */ + carry |= AVAL(g1) > AVAL(g2); + AVAL(g1) += ~AVAL(g2); + /* If there are any Xs of Zs, make the result unknown */ + if (BVAL(g1) | BVAL(g2)) { + cond = X; + } + } + + /* Don't need to prop caary on last group */ + AVAL(g1) += ~AVAL(g2) + carry; + if ((BVAL(g1) | BVAL(g2)) & R_mask) { + cond = X; + } + if (cond == X) { + load_fill(*R, R_ngroups, (Bit) - 1, (Bit) - 1); + } + } + R++; + break; + + +#define HIGH16(ptr) (((struct split_32 *)&(ptr))->high) +#define LOW16(ptr) (((struct split_32 *)&(ptr))->low) + + case MULT_EXPR: + g2 = *--R; + g1 = *--R; + + + if (!R_ngroups) { + if (is_real) { + REAL_(g1) *= REAL_(g2); + R++; + break; + } + + if (BVAL(g1) || BVAL(g2)) { + AVAL(g1) = (Bit) - 1; + BVAL(g1) = (Bit) - 1; + } else { + AVAL(g1) *= AVAL(g2); + } + R++; + break; + } + + cond = ZERO; + for (i = 0; i <= R_ngroups; i++) { + /* If there are any Xs of Zs, make the result unknown */ + if (BVAL(g1 + i) | BVAL(g2 + i)) { + cond = X; + } + } + if (cond == X) { + load_fill(*R, R_ngroups, (Bit) - 1, (Bit) - 1); + } else { + GroupMult(g1, g1, g2, R_ngroups + 1); + } + R++; + break; + + case DIV_EXPR: + { + int zeroDivisor = 0; + g2 = *--R; + g1 = *--R; + /* + * check for zero divisor + */ + if (!is_real) { + zeroDivisor = 1; + for (i = 0; i <= R_ngroups; i++) { + if (AVAL(g2 + i)) { + zeroDivisor = 0; + } + } + } + + cond = ZERO; + for (i = 0; i <= R_ngroups; i++) { + /* If there are any Xs of Zs, make the result unknown */ + if (BVAL(g1 + i) | BVAL(g2 + i)) { + cond = X; + } + } + + if (!is_real && zeroDivisor) { + load_fill(*R, R_ngroups, (Bit) - 1, (Bit) - 1); + } else if (is_integer) { + AVAL(g1) = (signed) AVAL(g1) / (signed) AVAL(g2); + } else if (is_real) { + REAL_(g1) /= REAL_(g2); + } else if (!R_ngroups) { + AVAL(g1) /= AVAL(g2); + } else { + GroupDiv(g1, g1, g1, g2, R_ngroups + 1, 0); + } + + if (cond == X && !is_real) { + load_fill(*R, R_ngroups, (Bit) - 1, (Bit) - 1); + } + R++; + } + break; + + case MOD_EXPR: + { + int zeroDivisor = 0; + g2 = *--R; + g1 = *--R; + /* + * check for zero divisor + */ + if (!is_real) { + zeroDivisor = 1; + for (i = 0; i <= R_ngroups; i++) { + if (AVAL(g2 + i)) { + zeroDivisor = 0; + } + } + } + + cond = ZERO; + for (i = 0; i <= R_ngroups; i++) { + /* If there are any Xs of Zs, make the result unknown */ + if (BVAL(g1 + i) | BVAL(g2 + i)) { + cond = X; + } + } + + if (!is_real && zeroDivisor) { + load_fill(*R, R_ngroups, (Bit) - 1, (Bit) - 1); + } else if (is_integer) { + AVAL(g1) = (signed) AVAL(g1) % (signed) AVAL(g2); + } else if (!R_ngroups) { + AVAL(g1) %= AVAL(g2); + } else { + GroupDiv(g1, g1, g1, g2, R_ngroups + 1, 1); + } + if (cond == X && !is_real) { + load_fill(*R, R_ngroups, (Bit) - 1, (Bit) - 1); + } + R++; + } + break; + +/***************************************************************************/ +/* Unary Arithmetic operators: - */ +/***************************************************************************/ + + case NEGATE_EXPR: + g1 = *--R; + if (is_real) { + REAL_(g1) = -REAL_(g1); + R++; + break; + } + if (BVAL(g1)) { + goto fill_x; + } + if (!R_ngroups) { + AVAL(g1) = (~AVAL(g1) + 1) & R_mask; + } else { + tmp1 = AVAL(g1) = ~AVAL(g1) + 1; + for (i = 1, g1++; i < R_ngroups; i++, g1++) { + if (BVAL(g1)) { + goto fill_x; + } + tmp1 = AVAL(g1) = ~AVAL(g1) + (tmp1 == 0); + } + tmp1 = AVAL(g1) = (~AVAL(g1) + (tmp1 == 0)) & R_mask; + } + R++; + break; + +/***************************************************************************/ +/* Unary real-to-integer conversion */ +/***************************************************************************/ + + case INT_CONV_EXPR: + g1 = *--R; + real_to_reg(REAL_(g1), g1, R_ngroups); + is_real = 0; + R++; + break; + +/***************************************************************************/ +/* Unary integer-to-real conversion */ +/***************************************************************************/ + + case REAL_CONV_EXPR: + g1 = *--R; + REAL_(g1) = reg_to_real(g1, R_nbits); + is_real = 1; + is_integer = 0; + R++; + break; + +/***************************************************************************/ +/* Shift operators: << >> */ +/***************************************************************************/ + + case LSHIFT_EXPR: + /* evaluate from left-to-right */ + g = *--R; /* shift count */ + g1 = (*R--) - 1; /* high end of stuff to be shifted */ + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + shift_bits = AVAL(g); + if (shift_bits < 0) { + shift_bits = -shift_bits; + goto right_shift_instead; + } + left_shift_instead: + shift_groups = bits_to_groups(shift_bits + 1); + shift_bits %= BITS_IN_GROUP; + if (shift_groups <= 0) { + shift_groups = 0; + } + + /* make sure shift count is ok */ + if (BVAL(g)) { + goto fill_x; + } + g2 = g1 - shift_groups; + + if (shift_groups <= R_ngroups) { + AVAL(g1) = (AVAL(g2) << shift_bits); // | tmp2; + BVAL(g1) = (BVAL(g2) << shift_bits); // | tmp2b; + for (i = 0; i < R_ngroups - shift_groups; i++) { + g2--; + if (shift_bits) { + AVAL(g1) |= + AVAL(g2) >> (BITS_IN_GROUP - shift_bits); + BVAL(g1) |= + BVAL(g2) >> (BITS_IN_GROUP - shift_bits); + } + g1--; + AVAL(g1) = (AVAL(g2) << shift_bits); // | tmp2; + BVAL(g1) = (BVAL(g2) << shift_bits); // | tmp2b; + + } + g1--; + } + for (i = 0; i < shift_groups; i++, g1--) { + AVAL(g1) = 0; + BVAL(g1) = 0; + tmp2 = 0; + } + R++; + break; + + case RSHIFT_EXPR: + /* evaluate from right-to-left */ + g = *--R; /* shift count */ + g1 = *--R; /* stuff to be shifted */ + R_nbits = TREE_NBITS(t); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + shift_bits = AVAL(g); + if (shift_bits < 0) { + shift_bits = -shift_bits; + goto left_shift_instead; + } + right_shift_instead: + shift_groups = bits_to_groups(shift_bits + 1); + shift_bits %= BITS_IN_GROUP; + if (shift_groups <= 0) { + shift_groups = 0; + } + + /* make sure shift count is ok */ + if (BVAL(g)) { + goto fill_x; + } + g2 = g1 + shift_groups; + for (i = 0; i < R_ngroups - shift_groups; i++, g1++, g2++) { + if (shift_bits) { + AVAL(g1) = (AVAL(g2) >> shift_bits) | + (AVAL(g2 + 1) << (BITS_IN_GROUP - shift_bits)); + BVAL(g1) = (BVAL(g2) >> shift_bits) | + (BVAL(g2 + 1) << (BITS_IN_GROUP - shift_bits)); + } else { + AVAL(g1) = AVAL(g2); + BVAL(g1) = BVAL(g2); + } + } + AVAL(g1) = (AVAL(g2) & R_mask) >> shift_bits; + BVAL(g1) = (BVAL(g2) & R_mask) >> shift_bits; + for (i = 0; i < shift_groups; i++) { + g1++; + AVAL(g1) = 0; + BVAL(g1) = 0; + tmp2 = 0; + } + R++; + break; + + fill_x: + tmp1 = (Bit) - 1; + tmp2 = (Bit) - 1; + g = *R; + for (i = 0; i <= R_ngroups; i++, g++) { + AVAL(g) = tmp1; + BVAL(g) = tmp2; + } + R++; + break; + +/***************************************************************************/ +/* Conditional operator: ?: */ +/***************************************************************************/ + + case COND_EXPR: + eval(COND_EXPR_CODE(t)); + g1 = *--R; + cond = ZERO; + for (i = 0; i < R_ngroups; i++, g1++) { + if (BVAL(g1)) { + cond = X; + goto cond_continue; + } else if (AVAL(g1)) { + cond = ONE; + goto cond_continue; + } + } + + if (BVAL(g1) & R_mask) { + cond = X; + /* R_mask is set by 1st call to eval */ + } else if (AVAL(g1) & R_mask) { + cond = ONE; + } + cond_continue: + in_cond = ONE; /* hack to preserve integer bit */ + if (cond == ONE) { + eval(COND_TRUE_CODE(t)); + } else if (cond == ZERO) { + eval(COND_FALSE_CODE(t)); + } else { + eval(COND_TRUE_CODE(t)); + eval(COND_FALSE_CODE(t)); + g2 = *--R; + g1 = *(R - 1); + for (i = 0; i <= R_ngroups; i++, g1++, g2++) { + tmp1 = AVAL(g1); + AVAL(g1) |= AVAL(g2) | BVAL(g1) | BVAL(g2); + BVAL(g1) |= BVAL(g2) | (tmp1 ^ AVAL(g2)); + } + } + in_cond = 0; + break; + + default: + printf_error_V("Unimplemented expression: %s\n", + tree_code_name[TREE_CODE(t)]); + shell_abort(); + break; + + } /* switch */ + pc++; + } /* while */ + return; +} + + +delay_t eval_delay(tree delay_node, enum logical_value state) +{ + delay_t delay; + + if (!delay_node) { + return 0; + } + + /* TREE_LABEL has the number of delays given: 1, 2 or 3 */ + if (TREE_LABEL(delay_node) == 1) { + eval((tree *) TREE_OPERAND(delay_node, 3)); + ASSERT(R_ngroups == 0 || AVAL(*(R - 1) + 1) == 0); + delay = AVAL(*--R); + /* Other cases assume two or tree delays given */ + } else if (state == ONE) { + eval((tree *) TREE_OPERAND(delay_node, 3)); + ASSERT(R_ngroups == 0 || AVAL(*(R - 1) + 1) == 0); + delay = AVAL(*--R); + } else if (state == ZERO) { + eval((tree *) TREE_OPERAND(delay_node, 4)); + ASSERT(R_ngroups == 0 || AVAL(*(R - 1) + 1) == 0); + delay = AVAL(*--R); + } else if (state == Z) + if (TREE_LABEL(delay_node) == 3) { + eval((tree *) TREE_OPERAND(delay_node, 5)); + ASSERT(R_ngroups == 0 || AVAL(*(R - 1) + 1) == 0); + delay = AVAL(*--R); + } else { /* 2 values given, get the min */ + eval((tree *) TREE_OPERAND(delay_node, 3)); + ASSERT(R_ngroups == 0 || AVAL(*(R - 1) + 1) == 0); + delay = AVAL(*--R); + eval((tree *) TREE_OPERAND(delay_node, 4)); + ASSERT(R_ngroups == 0 || AVAL(*(R - 1) + 1) == 0); + if (AVAL(*--R) < delay) { + delay = AVAL(*R); + } + if (BVAL(*R)) { + return 0; + } + /* if X, find MIN of delays */ + } else { + eval((tree *) TREE_OPERAND(delay_node, 3)); + ASSERT(R_ngroups == 0 || AVAL(*(R - 1) + 1) == 0); + delay = AVAL(*--R); + if (BVAL(*R)) { + return 0; + } + eval((tree *) TREE_OPERAND(delay_node, 4)); + ASSERT(R_ngroups == 0 || AVAL(*(R - 1) + 1) == 0); + if (AVAL(*--R) < delay) { + delay = AVAL(*R); + } + if (BVAL(*R)) { + return 0; + } + if (TREE_LABEL(delay_node) == 3) { + eval((tree *) TREE_OPERAND(delay_node, 5)); + ASSERT(R_ngroups == 0 || AVAL(*(R - 1) + 1) == 0); + if (AVAL(*--R) < delay) { + delay = AVAL(*R); + } + if (BVAL(*R)) { + return 0; + } + } + } + if (BVAL(*R)) { + return 0; + } + return delay; +} + +/* Evaluate nets; if exclude_inout is set, don't use the inout port + (if there is one) in the evaluation. This prevents a lockup + situation in which a net that has drivers on both sides of + an inout port will lock to X since that X is "driving" both sides + of the port. */ +/* exclude_tree is used to exclude a node from the net calculation for + bi-directional gates */ + + +void do_net_eval(tree node, int exclude_inout, tree exclude_tree) +{ + tree t; + ngroups_t i; + Group *g1; + Group *g2; + Bit z1; + Bit z2; + Bit aval1; + Bit aval2; + Bit bval1; + Bit bval2; + enum tree_type type = (enum tree_type) TREE_TYPE(node); + + R_nbits = TREE_NBITS(node); + R_ngroups = bits_to_groups(R_nbits); + R_mask = mask_right1[R_nbits & NBITS_MASK]; + g1 = *R; + /* First, initialize net to Z */ + for (i = 0; i <= R_ngroups; i++, g1++) { + AVAL(g1) = 0; + BVAL(g1) = (unsigned int) -1; + } + + switch (type) { + /* Z combined with anything is the anything, 1 combined with 0 is X */ + case NET_WIRE_TYPE: + case NET_TRI_TYPE: + for (t = NET_SOURCE(node); t; t = NET_SOURCE(t)) { + if (exclude_tree == t) { + continue; + } + if (exclude_inout) { + if (PORT_OUTPUT_ATTR(t) || PORT_COLLAPSED_ATTR(t)) { + continue; + } + } + g1 = *R; + g2 = DECL_STORAGE(t); + for (i = 0; i <= R_ngroups; i++, g1++, g2++) { + aval1 = AVAL(g1); + aval2 = AVAL(g2); + bval1 = BVAL(g1); + bval2 = BVAL(g2); + z1 = ~aval1 & bval1; /* where the Z's are */ + z2 = ~aval2 & bval2; + BVAL(g1) = ~((z1 & ~bval2) | (z2 & ~bval1) | + (~bval1 & ~bval2 & ~(aval1 ^ aval2))); + AVAL(g1) = aval1 | aval2; + } + } + break; + + /* These are the same as WIRE/TRI, exept replace Z by 0/1 after eval */ + case NET_TRI0_TYPE: + case NET_TRI1_TYPE: + /* Don't eval last source; it's there for initialization only */ + for (t = NET_SOURCE(node); NET_SOURCE(t); t = NET_SOURCE(t)) { + if (exclude_tree == t) { + continue; + + } + if (exclude_inout) { + if (PORT_OUTPUT_ATTR(t) || PORT_COLLAPSED_ATTR(t)) { + continue; + } + } + g1 = *R; + g2 = DECL_STORAGE(t); + for (i = 0; i <= R_ngroups; i++, g1++, g2++) { + aval1 = AVAL(g1); + aval2 = AVAL(g2); + bval1 = BVAL(g1); + bval2 = BVAL(g2); + z1 = ~aval1 & bval1; /* where the Z's are */ + z2 = ~aval2 & bval2; + BVAL(g1) = ~((z1 & ~bval2) | (z2 & ~bval1) | + (~bval1 & ~bval2 & ~(aval1 ^ aval2))); + AVAL(g1) = aval1 | aval2; + } + } + + /* Now, replace all Zs by 0 (for TRI0) or 1 (for TRI1) */ + if (type == NET_TRI0_TYPE) { + g1 = *R; + for (i = 0; i <= R_ngroups; i++, g1++) { + BVAL(g1) = AVAL(g1) & BVAL(g1); /* stay set only if X */ + } + } else { + g1 = *R; + for (i = 0; i <= R_ngroups; i++, g1++) { + aval1 = AVAL(g1); + bval1 = BVAL(g1); + BVAL(g1) = aval1 & bval1; + AVAL(g1) = aval1 | bval1; + } + } + break; + + case NET_SUPPLY1_TYPE: + g1 = *R; + AVAL(g1) = 1; + BVAL(g1) = 0; + for (i = 1, g1++; i <= R_ngroups; i++, g1++) { + AVAL(g1) = 0; + BVAL(g1) = 0; + } + break; + + + case NET_SUPPLY0_TYPE: + g1 = *R; + AVAL(g1) = 0; + BVAL(g1) = 0; + for (i = 1, g1++; i <= R_ngroups; i++, g1++) { + AVAL(g1) = 0; + BVAL(g1) = 0; + } + break; + + /* 1 combined with 0 yields 0, Z combined with anything is still anything */ + case NET_WAND_TYPE: + case NET_TRIAND_TYPE: + for (t = NET_SOURCE(node); t; t = NET_SOURCE(t)) { + if (exclude_tree == t) { + continue; + } + + if (exclude_inout) { + if (PORT_OUTPUT_ATTR(t) || PORT_COLLAPSED_ATTR(t)) { + continue; + } + } + g1 = *R; + g2 = DECL_STORAGE(t); + for (i = 0; i <= R_ngroups; i++, g1++, g2++) { + aval1 = AVAL(g1); + aval2 = AVAL(g2); + bval1 = BVAL(g1); + bval2 = BVAL(g2); + AVAL(g1) = + (aval1 & aval2) | (aval1 & bval2) | (aval2 & bval1); + BVAL(g1) = (bval1 & bval2) | (aval1 & bval1 & aval2) + | (aval2 & bval2 & aval1); + } + } + break; + + /* 1 combined with 0 yields 1, Z combined with anything is still anything */ + case NET_WOR_TYPE: + case NET_TRIOR_TYPE: + for (t = NET_SOURCE(node); t; t = NET_SOURCE(t)) { + if (exclude_tree == t) { + continue; + } + if (exclude_inout) { + if (PORT_OUTPUT_ATTR(t) || PORT_COLLAPSED_ATTR(t)) { + continue; + } + } + g1 = *R; + g2 = DECL_STORAGE(t); + for (i = 0; i <= R_ngroups; i++, g1++, g2++) { + aval1 = AVAL(g1); + aval2 = AVAL(g2); + bval1 = BVAL(g1); + bval2 = BVAL(g2); + BVAL(g1) = (bval1 & bval2) | (aval1 & bval1) & + (~aval2 & ~bval2) | (~aval1 & ~bval1 & aval2 & bval2); + AVAL(g1) = aval1 | aval2; + } + } + break; + + default: + fatal("Eval of unknown net type", NULL); + } /* end switch (type) */ + *++R = g1; // + 1; +} + +/* Allocate virtual registers */ + +int R_alloc(int number, int area) +{ + number++; /* account for the zeroth register */ + number++; /* account for the zeroth register */ + number++; /* account for the zeroth register */ + number++; /* account for the zeroth register */ + if (number > current_regs) { + if (current_regs == 0) { + R_base = (union group **) xmalloc + (number * sizeof(union group **)); + } else { + R_base = (union group **) xrealloc + ((char*)R, number * sizeof(union group **)); + } + current_regs = number; + } + if (!R_base) { + return 0; + } + R = R_base; + area++; + area++; + area++; + area++; + if (area > current_area) { + if (current_area == 0) { + *R = (union group *) xmalloc(area * sizeof(Group)); + } else { + *R = (union group *) xrealloc((char*)*R, area * sizeof(Group)); + } + current_area = area; + } + if (!*R) { + return 0; + } + return 1; +} + +/* Evaluate a decl node but use a different number of nbits. Do this + by using a shadow_decl and setting the nbits. This is used for function + and sysfunction return values. Note that REAL and INTEGER attr bits + are valid in the passed-in decl. +*/ + +void eval_nbits(tree decl, nbits_t nbits) +{ + if (!global_shadow) { + global_shadow = make_node(SHADOW_REF); + } + TREE_NBITS(global_shadow) = nbits; + TREE_CHAIN(global_shadow) = decl; + TREE_REAL_ATTR(global_shadow) = TREE_REAL_ATTR(decl); + TREE_INTEGER_ATTR(global_shadow) = TREE_INTEGER_ATTR(decl); + eval_1(global_shadow); +} + +nbits_t eval_range(tree * inst, char *ident) +{ + Group *g; + nbits_t val; + + eval(inst); + + g = *--R; + if (BVAL(g)) { + error("Index in '%s' resloves to 'z' or 'x'", ident, NULL_CHAR); + } else { + val = AVAL(g); + } + return val; +} + +/* Evaluate the expression and return the low 32 bits */ + +Bit eval_const(tree * inst) +{ + Group *g; + Bit const_; + + eval(inst); + + g = *--R; + if (BVAL(g)) { + const_ = 0; + } else { + const_ = AVAL(g); + } + return const_; +} + +/* Evaluate an expression; return an integer non-zero if the top + of stack is non-zero. Then pop the stack. */ + +enum logical_value test(tree * expr) +{ + enum logical_value cond; + ngroups_t i; + Group *g; + + eval(expr); + DETERMINE_TRUE_COND(g); + return cond; +} + +/*********************************************************************** + * + * init_eval + * - initializes all global and static variables for eval.c + * + *********************************************************************** + */ + +void init_eval() +{ + R_nbits = 0; + R_ngroups = 0; + in_cond = 0; + is_integer = 0; + is_real = 0; + current_area = 0; + current_regs = 0; + x32 = ldexp((double) 1, 32); + memset(&R_base, 0, sizeof(R_base)); + memset(&R, 0, sizeof(R)); + memset(&R_mask, 0, sizeof(R_mask)); + global_shadow = NULL_TREE; +} diff --git a/src/eval.h b/src/eval.h new file mode 100644 index 0000000..6252c40 --- /dev/null +++ b/src/eval.h @@ -0,0 +1,79 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* EVAL.H - Macros and prototypes for Eval */ + +#ifndef EVAL_H +#define EVAL_H + +// public methods + +/* This macro determines if the value point to by G is 0, 1, or X/Z */ +/* (THIS MACRO ALSO APPEARS IN EXEC.C) */ + +#define DETERMINE_TRUE_COND(G) \ + {G = *--R; \ + cond = ZERO; \ + for (i = 0; i < R_ngroups; i++, (G)++) { \ + if (BVAL (G)) { \ + cond = X; \ + G = *R + R_ngroups; \ + break; \ + } \ + else if (AVAL (G)) \ + cond = ONE; \ + } \ + if (BVAL (G) & R_mask) \ + cond = X; \ + else if (AVAL (G) & R_mask) \ + cond = ONE;} + +#define SET_STATE(G) \ + { \ + if (DECL_STATE (lval) != X) { \ + if (BVAL (G) & AVAL (G)) \ + SET_DECL_STATE (lval, X); \ + else if (DECL_STATE (lval) != Z) { \ + if (BVAL (G)) \ + SET_DECL_STATE (lval, Z); \ + else if (AVAL (G)) \ + SET_DECL_STATE (lval, ONE); \ + } \ + } \ + } + +#define TEST(EXPR, G) eval (EXPR); DETERMINE_TRUE_COND (G) + +int part_lref(Group * g1, Group * g2, struct part_info *info); +ngroups_t part_rref(Group * g1, Group * g2, struct part_info *info); +Group *eval_(tree * pc, nbits_t * nbits); +void eval_1(tree decl); +void eval(tree * pc); +delay_t eval_delay(tree delay_node, enum logical_value state); +void do_net_eval(tree node, int exclude_inout, tree exclude_tree); +int R_alloc(int number, int area); +nbits_t eval_range(tree * inst, char *ident); +Bit eval_const(tree * inst); +void eval_nbits(tree, nbits_t); +enum logical_value test(tree * expr); +void init_eval(); +double reg_to_real(Group * g, nbits_t nbits); +void real_to_reg(double x, Group * g, ngroups_t ngroups); + +#endif // EVAL_H diff --git a/src/exec.cc b/src/exec.cc new file mode 100644 index 0000000..6310fb1 --- /dev/null +++ b/src/exec.cc @@ -0,0 +1,1467 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + + + + +#include +#include +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "schedule.h" +#include "runtime.h" +#include "flags.h" +#include "io.h" +#include "macro.h" +#include "glue.h" +#include "strobe.h" +#include "store.h" +#include "exec.h" +#include "print.h" +#include "eval.h" +#include "decl.h" +#include "specify.h" +#include "veriuser.h" +#include "acc_user.h" +#include "pli.h" +#include "systask.h" +#include "veriwell.h" +#include "lex.h" +#include "pass3.h" +#include "trace.h" + +#ifdef HAVE_LIBREADLINE +# if defined(HAVE_READLINE_READLINE_H) +# include +# elif defined(HAVE_READLINE_H) +# include +# else /* !defined(HAVE_READLINE_H) */ +extern char *readline (); +# endif /* !defined(HAVE_READLINE_H) */ +char *cmdline = NULL; +#else /* !defined(HAVE_READLINE_READLINE_H) */ + /* no readline */ +extern "C" char* readline(char*); +#endif /* HAVE_LIBREADLINE */ + +#ifdef HAVE_READLINE_HISTORY +# if defined(HAVE_READLINE_HISTORY_H) +# include +# elif defined(HAVE_HISTORY_H) +# include +# else /* !defined(HAVE_HISTORY_H) */ +# endif /* defined(HAVE_READLINE_HISTORY_H) */ + /* no history */ +#else /* !HAVE_READLINE_HISTORY */ +#endif /* HAVE_READLINE_HISTORY */ + + + +#define NULL_GROUP (Group *) NULL + +#define TRACE(CURRENT, NEXT, G, SKIP, VAL) \ +{ \ + if( lcbCount != 0 && !normal_flag ) { \ + handleLcb( CURRENT ); \ + } \ + if (!normal_flag) { \ + pc = go_interactive (CURRENT, NEXT, G, SKIP, VAL); \ + } else { \ + if ((NEXT) != NULL_TREE) { \ + pc = NEXT; \ + } \ + } \ +} + + +extern int in_simulation; + +int exit_flag = 0; +int in_disable; /* set while processing the disable statement */ + +extern SCB *readylist; + +static unsigned char brk_check = 0; + + +void Group2Time(int ngroup, Group * g, struct Time64 *t) +{ + int i; + // convert X/Z -> 0 + for (i = 0; i < ngroup + 1; ++i) { + if (BVAL(g + i)) { + t->timeh = 0; + t->timel = 0; + return; + } + } + t->timel = AVAL(g); + if (ngroup > 0) { + t->timeh = AVAL(g + 1); + } else { + t->timeh = 0; + } +} + +void set_simulation_time(time64 * newtime_p) +{ + ASSIGNTIME64(&CurrentTime, newtime_p); + if (trace_flag || single_trace_flag) { + printf_V("SIMULATION TIME IS "); + print_time(&CurrentTime); + printf_V("\n"); + } +} + +struct context_member *free_context; + +struct context_member *make_context(void) +{ + struct context_member *new_t; + + if (free_context) { + new_t = free_context; + REMOVE_LIST(new_t); + return new_t; + } else { + return (struct context_member *) xmalloc + (sizeof(struct context_member)); + } +} + +void enter_context(SCB * scb, tree scope, tree pc) +{ + struct context_member *tmp; + struct context_member *new_context; + + if (!scope) { /* If scb is build w/out context, don't bother */ + return; + } + new_context = make_context(); + ADD_LIST(BLOCK_CONTEXT_LIST(scope), new_context); + new_context->shadow = scb->context; + scb->context = new_context; + new_context->scb = scb; + new_context->scope = scope; + new_context->pc = pc; +} + + +tree exit_context(SCB * scb) +{ + struct context_member *tmp; + struct context_member *context = scb->context; + + scb->context = context->shadow; + REMOVE_LIST(context); + ADD_LIST(free_context, context); + return context->pc; +} + + +/* Starting with the innermost context, unwind until past the given + context. Return the outermost PC. */ + +tree unwind_context(struct context_member * context) +{ + while (context->scb->context != context) { + exit_context(context->scb); + free_context->pc = NULL; + } + return exit_context(context->scb); +} + +void disable_context(struct context_member *context) +{ + SCB *scb; + SCB *tmp; + tree next_pc; + tree current_pc; + int me; + + /* First, get the SCB. */ + scb = context->scb; + current_pc = scb->pc; + me = readylist == scb; + + /* The context being disabled is in one of the following states: waiting + for a time or event, the beginning of a fork, or at the head of the + readylist (me). Do the right thing for each case. */ + + if (me) { + next_pc = unwind_context(context); + } else { + switch (TREE_CODE(current_pc)) { + case EVENT_STMT: + event_undo(STMT_EVENT_MARKER(current_pc)); + next_pc = unwind_context(context); + break; + + case WAIT_STMT: + event_undo(STMT_WAIT_MARKER(current_pc)); + next_pc = unwind_context(context); + break; + + case ASSIGN_DELAY_STMT: + case DELAY_STMT: + next_pc = unwind_context(context); + break; + + case JOIN_STMT: + case JOIN_NAMED_STMT: + while (context->next) { + disable_context(context->next); + } + next_pc = context->pc; + break; + + /* If the disable came from within a named fork, let join handle it */ + case FORK_NAMED_STMT: + next_pc = STMT_BODY(current_pc); /* points to join */ + break; + } + } + + ASSIGNTIME64(&(scb->time), &CurrentTime); + + scb->mode = RUN; + + if (!next_pc) /* must be a fork member */ + if (me) { + /* + * I am one of the fork members and if I kill the SCB, then ... + * ... I have to put the fork's SCB at the front of the ready list + */ + SCB *fork_scb = scb->fork; + ASSERT(fork_scb); + ASSERT(fork_scb->fork_count > 0); + FreeSCB(scb); + REMOVE_LIST_SCB(fork_scb); + ADD_LIST_SCB(READY_LIST, &readylist, fork_scb); + readylist->mode = WAIT; + } else { + FreeSCB(scb); + } + + else { + int save_normal_flag; + // ??? mdh - not sure why this matters but it does + int onReadyList = (scb->list == READY_LIST); + + in_disable = 1; + REMOVE_LIST_SCB(scb); + ADD_LIST_SCB(READY_LIST, &readylist, scb); + scb->pc = next_pc; + save_normal_flag = normal_flag; + normal_flag = 0; + + exec_(scb->pc); + + in_disable = 0; + normal_flag = save_normal_flag; + +/* Put the disabled process next of the readylist. + In some cases, after exec-ing, the scb could have been taken off + the ready list. If so, don't bother putting at the end. + Eg: disabling a named begin inside a fork-join -- this will + exec the join stmt which calls dump_current_process. + Also, if I am disabling myself, then there could be only + my SCB on the readylist, so don't bother moving it */ + + if (!me && onReadyList && scb->list == READY_LIST + && readylist->next) { + SCB *last; + REMOVE_LIST_SCB(scb); + last = LAST_SCB(READY_LIST); + if (last) { + ADD_LIST_SCB(READY_LIST, &last->next, scb); + } else { + ADD_LIST_SCB(READY_LIST, &readylist, scb); + } + } + } +} + +/* process deassign statement; find matching assignment and unthread + the markers. Return pc of ASSIGN or FORCE if something was actually + released. Note that the deassign will not happen under certain + circumstances. Specifically, if it was requested by a assign or deassign + but was generated by a force, it will not happen. */ + +tree deassign(tree lval_arg, enum tree_code code) +{ + Marker *marker; + tree pc; + tree lval; + + /* if lval is hierarchical, it will be a "shadow" lval". Point to the real + lval. */ + lval = the_lval(lval_arg); + + for (marker = DECL_EVENT_CHAIN(lval); marker; marker = marker->next) { + /* marker must be for continuous assignment, then it must point to + procedual cont assignment, then lvals must match */ + if (marker->flags & M_CONT && + (TREE_CODE(marker->expr.tree) == ASSIGN_PROC_STMT || + TREE_CODE(marker->expr.tree) == FORCE_STMT) && + the_lval(STMT_ASSIGN_LVAL(marker->expr.tree)) == lval) { + pc = marker->expr.tree; + if (TREE_CODE(pc) == FORCE_STMT && + (code == ASSIGN_PROC_STMT || code == DEASSIGN_STMT)) { + return NULL_TREE; + } + event_undo(STMT_ASSIGN_EVENT_LIST(pc)); + return pc; + } + } + return NULL_TREE; +} + +int first_time_exec = 1; + +tree exec_(tree pc) +{ + Group *g1, *g2; + enum logical_value cond; + ngroups_t i; + int found; + enum tree_code code; + tree t, t1, new_pc, old_pc; + tree scope; // for fork + + if (!is_interactive && first_time_exec && in_simulation) { + first_time_exec = 0; + if (s_flag) { + single_step_flag = 1; + /* enter command line mode w/no trace */ + pc = go_interactive(NULL_TREE, pc, NULL_GROUP, 0, 0); + } + } else { + if (in_disable) { + pc = go_interactive(NULL_TREE, pc, NULL_GROUP, 1, 0); + } + } + + for (;;) { + + +// if (!brk_check++) /* interrupt the process every so often to */ +// ftell (stdout); /* guarentee that a break will be detected */ + + code = TREE_CODE(pc); + + switch (code) { + case BEGIN_STMT: + TRACE(pc, STMT_BODY(pc), NULL_GROUP, 0, 0); + break; + + case BEGIN_NAMED_STMT: + enter_context(readylist, STMT_BLOCK(pc), TREE_CHAIN(pc)); + TRACE(pc, STMT_BODY(pc), NULL_GROUP, 0, 0); + break; + + case END_NAMED_STMT: + exit_context(readylist); + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 0) break; + + case FORK_NAMED_STMT: + /* Point to PAST Join in case of disable */ + scope = STMT_BLOCK(pc); + enter_context(readylist, STMT_BLOCK(pc), + TREE_CHAIN(TREE_CHAIN(pc))); + goto fork_common; + case FORK_STMT: + scope = STMT_SCOPE(pc); + enter_context(readylist, STMT_SCOPE(pc), + TREE_CHAIN(TREE_CHAIN(pc))); + fork_common: + { + SCB *fork = readylist; + SCB *scb; + SCB *tmp; + SCB *where = readylist; + + fork->fork_count = 0; + for (t = STMT_BODY(pc); t; t = TREE_CHAIN(t)) { + /* SCBs are built dynamically instead of at compile time. This + is because in tasks, more than one process could enter an + SCB at one time. */ + /* we will use the SCB's make_context to point to the innermost + scope, which may be the named fork scope */ + tree saved_scope = current_scope; + current_scope = scope; + scb = BuildSCB(TREE_PURPOSE(t), NOLIST); + current_scope = saved_scope; + /* Each member has its own context. This way, disable + will work because there is a binding between the + fork and all its branches */ + REMOVE_LIST_SCB(scb); + /* thread in order */ + ADD_LIST_SCB(READY_LIST, &where->next, scb); + fork->fork_count++; /* Keep count of concurrent stmts */ + scb->fork = fork; /* point back to "main" SCB */ + where = scb; + } + } + readylist->pc = TREE_CHAIN(pc); + readylist->mode = WAIT; + new_pc = dispatch_pc(EVENT_LIST); + readylist->pc = NULL; /* Don't trigger event stmt */ + TRACE(pc, new_pc, NULL_GROUP, 0, 0); + break; + + case JOIN_STMT: + case JOIN_NAMED_STMT: + /* If this is the last fork member, get fork control back on the + ready list and go. Note that exit_context frees up + context_member but subsequent code assumes the pointers + are valid (freed context_members go on a free list and + are not freed in memory). */ + /* Get here if FORK is disabled */ + if (readylist->mode == WAIT) { + readylist->mode = RUN; + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 0); + } else { + /* One of the members exited; get rid of it */ + SCB *fork_scb = readylist->fork; + tree scope = readylist->context->scope; + ASSERT(fork_scb); + ASSERT(fork_scb->fork_count > 0); + fork_scb->fork_count--; + /* if all branches are finished, then scope will point to the + fork context; if there are some to finish, then scope + will point to all the contexts still to run */ + if (fork_scb->fork_count == 0) { + SCB *tmp; + /* put mother fork next on ready lest */ + REMOVE_LIST_SCB(fork_scb); + ADD_LIST_SCB(READY_LIST, &readylist->next, fork_scb); + readylist->next->mode = RUN; + exit_context(readylist); // for the last branch + exit_context(readylist->next); // for the fork + pc = dump_current_process(); + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 1, 0); + } else { + exit_context(readylist); + new_pc = dump_current_process(); + TRACE(pc, new_pc, NULL_GROUP, 0, 0); + } + } + break; + + case ALWAYS_BLOCK: + INITIALIZED_ATTR(pc) = 1; /* make trace consistant w/XL */ + case INITIAL_BLOCK: + TRACE(pc, STMT_BODY(pc), NULL_GROUP, 0, 0); + break; + + case IF_STMT: + if (test(STMT_COND_CODE(pc)) == ONE) { + TRACE(pc, STMT_THEN(pc), NULL_GROUP, 0, 0); + } else if (STMT_ELSE(pc)) { + TRACE(pc, STMT_ELSE(pc), NULL_GROUP, 1, 0); + } else { + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 1, 0); + } + break; + + case ASSIGN_STMT: + eval(STMT_ASSIGN_RVAL_CODE(pc)); + TRACE(pc, pc, *(R - 1), 1, 1); + store(STMT_ASSIGN_LVAL(pc), pc); + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 0); + break; + + case ASSIGN_PROC_STMT: + case FORCE_STMT: + broadcast_tf(reason_force); + /* Make sure we start over */ + t = deassign(STMT_ASSIGN_LVAL(pc), code); + /* save pc of assign that we are overriding */ + if (code == FORCE_STMT) { + if (t && TREE_CODE(t) == ASSIGN_PROC_STMT) { + STMT_ASSIGN_TMP(pc) = t; + } else { + STMT_ASSIGN_TMP(pc) = NULL_TREE; + } + } + thread_all_markers(STMT_ASSIGN_EVENT_LIST(pc)); + eval(STMT_ASSIGN_RVAL_CODE(pc)); + TRACE(pc, pc, *(R - 1), 1, 1); + store(STMT_ASSIGN_LVAL(pc), pc); + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 0); + break; + + case DEASSIGN_STMT: + case RELEASE_STMT: + broadcast_tf(reason_release); + t = deassign(the_lval(STMT_BODY(pc)), code); + /* If was we are releasing still has an ASSIGN on it, + reactivate the assign */ + if (t && code == RELEASE_STMT && STMT_ASSIGN_TMP(t)) { + thread_all_markers(STMT_ASSIGN_EVENT_LIST + (STMT_ASSIGN_TMP(t))); + do_net_assignment(STMT_ASSIGN_TMP(t)); + /* if net, reevaluate */ + } else if (is_all_net(the_lval(STMT_BODY(pc)))) { + /* if part or bit */ + t1 = root_port_decl(the_lval(STMT_BODY(pc))); + do_net_eval(t1, 0, NULL_TREE); /* evaluate it */ + store(t1, pc); /* and store it */ + } + + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 0) break; + + case ASSIGN_CONT_STMT: + if (CMPTIME64(&CurrentTime, &(readylist->time))) { + set_simulation_time(&(readylist->time)); + } + eval(STMT_ASSIGN_RVAL_CODE(pc)); + TRACE(pc, pc, *(R - 1), 1, 1); + store(STMT_ASSIGN_LVAL(pc), pc); + if (NET_ASSIGN_ATTR(STMT_ASSIGN_LVAL(pc)) && + !PORT_COLLAPSED_ATTR(TREE_CHAIN(STMT_ASSIGN_LVAL(pc)))) { + tree net = TREE_CHAIN(STMT_ASSIGN_LVAL(pc)); + do_net_eval(net, 0, NULL_TREE); + TRACE(net, net, *(R - 1), 1, 1); + store(net, net); + } + new_pc = suspend_current_process(); + TRACE(pc, new_pc, *R, 0, 0); + break; + + case NET_SCALAR_DECL: + case NET_VECTOR_DECL: + DEBUGPRINT("Doing net exec\n"); + if (CMPTIME64(&CurrentTime, &(readylist->time))) { + set_simulation_time(&(readylist->time)); + } + do_net_eval(pc, 0, NULL_TREE); + TRACE(pc, pc, *(R - 1), 1, 1); + store(pc, pc); + /* Calculate output port seperately and only if connected */ + if ((PORT_OUTPUT_ATTR(pc) || + PORT_COLLAPSED_ATTR(pc)) && DECL_THREAD(pc)) { + do_net_eval(pc, 1, NULL_TREE); + store(DECL_THREAD(pc), pc); + } + if (!readylist) { + fatal("Caught it!", NULL_CHAR); + } + new_pc = suspend_current_process(); + TRACE(pc, new_pc, NULL_GROUP, 0, 0); + break; + + case FOR_STMT: + eval(STMT_ASSIGN_RVAL_CODE(STMT_FOR_ASSIGN(pc))); + TRACE(pc, pc, *(R - 1), 0, 1); + store(STMT_ASSIGN_LVAL(STMT_FOR_ASSIGN(pc)), pc); + eval(STMT_FOR_COND_CODE(pc)); + DETERMINE_TRUE_COND(g1); + if (cond == ONE) { + TRACE(pc, STMT_BODY(pc), NULL_GROUP, 1, 0); + } else { + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 0); + } + break; + + case WHILE_STMT: + if (test(STMT_WHILE_COND_CODE(pc)) == ONE) { + TRACE(pc, STMT_BODY(pc), NULL_GROUP, 0, 0); + } else { + TRACE(pc, TREE_CHAIN(pc), (Group *) TREE_CHAIN(pc), 1, 0); + } + break; + + case REPEAT_INIT_STMT: + eval(STMT_REPEAT_EXPR_CODE(pc)); + AVAL(STMT_REPEAT_VAR(pc)) = AVAL(*--R); + BVAL(STMT_REPEAT_VAR(pc)) = BVAL(*R); + + t = pc; + if (BVAL(STMT_REPEAT_VAR(pc))) { + AVAL(STMT_REPEAT_VAR(pc)) = (unsigned int) -1; + BVAL(STMT_REPEAT_VAR(pc)) = (unsigned int) -1; + pc = TREE_CHAIN(pc); + } else if (AVAL(STMT_REPEAT_VAR(pc))) { + pc = STMT_BODY(pc); + } else { + pc = TREE_CHAIN(pc); + } + TRACE(t, pc, STMT_REPEAT_VAR(t), 1, 0); + break; + + case REPEAT_STMT: + t = pc; + if (BVAL(STMT_REPEAT_VAR(pc))) { + AVAL(STMT_REPEAT_VAR(pc)) = (unsigned int) -1; + BVAL(STMT_REPEAT_VAR(pc)) = (unsigned int) -1; + pc = TREE_CHAIN(pc); + } else if (--AVAL(STMT_REPEAT_VAR(pc))) { + pc = STMT_BODY(pc); + } else { + pc = TREE_CHAIN(pc); + } + TRACE(t, pc, STMT_REPEAT_VAR(t), 1, 0); + break; + + case CASE_STMT: + case CASEZ_STMT: + case CASEX_STMT: + /* evaluate the case expression and leave on stack. Eval + choices until match. If no match, go to default, if there + is one. */ + eval(STMT_CASE_EXPR_CODE(pc)); + if (!INTERRUPT_FLAG_ATTR(pc)) { + old_pc = pc; + TRACE(pc, pc, *(R - 1), 0, 0); + if (pc != old_pc) { /* A new statement has been entered... */ + --R; /* unwind the stack... */ + /* abd remember that this happened. */ + INTERRUPT_FLAG_ATTR(old_pc) = 1; + break; + } + } else { + INTERRUPT_FLAG_ATTR(pc) = 0; + } + found = 0; + for (t = STMT_CASE_LIST(pc); !found && t; t = TREE_CHAIN(t)) { + for (t1 = TREE_EXPR(t); !found && t1; t1 = TREE_CHAIN(t1)) { + eval(TREE_EXPR_CODE(t1)); + found = 1; + g2 = *--R; + g1 = *(R - 1); + if (code == CASE_STMT) { + for (i = 0; i < R_ngroups; i++, g1++, g2++) { + if ((AVAL(g1) != AVAL(g2)) + || (BVAL(g1) != BVAL(g2))) { + found = 0; + break; + } + } + + found = found && !(((AVAL(g1) ^ AVAL(g2)) & R_mask) /* all zeros if equal */ + ||((BVAL(g1) ^ BVAL(g2)) & + R_mask)); + } else if (code == CASEZ_STMT) { + Bit aval1; + Bit bval1; + Bit aval2; + Bit bval2; + for (i = 0; i < R_ngroups; i++, g1++, g2++) { + aval1 = AVAL(g1); + bval1 = BVAL(g1); + aval2 = AVAL(g2); + bval2 = BVAL(g2); + /* All ones if equal (Z is don't care) */ + if (((aval1 ^ aval2) | (bval1 ^ bval2)) + & (~bval1 | aval1) & (~bval2 | aval2)) { + found = 0; + break; + } + } + + aval1 = AVAL(g1); + bval1 = BVAL(g1); + aval2 = AVAL(g2); + bval2 = BVAL(g2); + /* If equal, then all zeros. Zs force zeros. */ + found = found + && !(((aval1 ^ aval2) | (bval1 ^ bval2)) + & (~bval1 | aval1) & (~bval2 | aval2) + & R_mask); + } else if (code == CASEX_STMT) { + Bit aval1; + Bit bval1; + Bit aval2; + Bit bval2; + for (i = 0; i < R_ngroups; i++, g1++, g2++) { + aval1 = AVAL(g1); + bval1 = BVAL(g1); + aval2 = AVAL(g2); + bval2 = BVAL(g2); + /* All zeros if equal (Z and X are don't care) */ + if (((aval1 ^ aval2) | (bval1 ^ bval2)) + & ~bval1 & ~bval2) { + found = 0; + break; + } + } + + aval1 = AVAL(g1); + bval1 = BVAL(g1); + aval2 = AVAL(g2); + bval2 = BVAL(g2); + found = found + && !(((aval1 ^ aval2) | (bval1 ^ bval2)) + & ~bval1 & ~bval2 & R_mask); + } else { + fatal("Bad CASE Exec", NULL_CHAR); + } + + if (found) { + pc = TREE_STMT(t); + } + } + } + if (!found) { + if (STMT_CASE_DEFAULT(pc)) { + pc = STMT_CASE_DEFAULT(pc); + } else { + pc = TREE_CHAIN(pc); + } + } + R--; + break; + + case ASSIGN_DELAY_STMT: + if (readylist->mode == RUN) { + eval(STMT_ASSIGN_RVAL_CODE(pc)); + store(STMT_ASSIGN_TMP(pc), pc); + eval(STMT_DELAY_EXPR_CODE(STMT_ASSIGN_DELAY(pc))); + struct Time64 t; + Group2Time(R_ngroups, *--R, &t); + new_pc = WaitOnTime64(&t, pc); + TRACE(pc, pc, *R, 1, 1); + TRACE(pc, new_pc, NULL_GROUP, 0, 1); + } else { + readylist->mode = RUN; + if (CMPTIME64(&CurrentTime, &(readylist->time))) { + set_simulation_time(&(readylist->time)); + } + eval(STMT_ASSIGN_TMPCODE(pc)); + TRACE(pc, pc, *(R - 1), 1, 0); + store(STMT_ASSIGN_LVAL(pc), pc); + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 0); + } + break; + + case ASSIGN_NONBLK_DELAY_STMT: + if (readylist->mode == RUN) { + SCB *scb; + scb = BuildSCB(pc, NOLIST); + enter_context(scb, readylist->context->scope, NULL_TREE); + /* each execution of nonblocking + delay requires new temp var */ + scb->here.decl = make_tmp_decl(STMT_ASSIGN_LVAL(pc)); + STMT_ASSIGN_TMP(pc) = (tree) scb; /* save for trace */ + eval(STMT_ASSIGN_RVAL_CODE(pc)); + store(scb->here.decl, pc); + store_computeOnly = 1; + store_scb = scb; + store(STMT_ASSIGN_LVAL(pc), pc); + store_computeOnly = 0; + if (STMT_ASSIGN_DELAY(pc)) { + eval(STMT_DELAY_EXPR_CODE(STMT_ASSIGN_DELAY(pc))); + struct Time64 t; + Group2Time(R_ngroups, *--R, &t); + ScheduleDelta64(&t, scb, 0); + } else { + Schedule((delay_t) 0, scb, 0); + } + scb->pc = pc; + TRACE(pc, pc, *R, 1, 1); + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 1); + } else { + readylist->mode = RUN; + if (CMPTIME64(&CurrentTime, &(readylist->time)) != 0) { + set_simulation_time(&(readylist->time)); + } + eval_1(readylist->here.decl); + TRACE(pc, pc, *(R - 1), 1, 0); + store_useCached = 1; + store(STMT_ASSIGN_LVAL(pc), pc); + store_useCached = 0; + free_tmp_decl(readylist->here.decl); + exit_context(readylist); + new_pc = dump_current_process(); + TRACE(pc, new_pc, NULL_GROUP, 0, 0); + } + break; + + case PATH_OUTPUT: + if (CMPTIME64(&CurrentTime, &(readylist->time)) != 0) { + set_simulation_time(&(readylist->time)); + } + propagate_specify_path(pc); + new_pc = suspend_current_process(); + TRACE(pc, new_pc, NULL_GROUP, 0, 0); + break; + + case DELAY_STMT: + if (readylist->mode == RUN) { + eval(STMT_DELAY_EXPR_CODE(pc)); + struct Time64 t; + Group2Time(R_ngroups, *--R, &t); + new_pc = WaitOnTime64(&t, pc); + TRACE(pc, new_pc, *R, 0, 1); + } else { + readylist->mode = RUN; + if (CMPTIME64(&CurrentTime, &(readylist->time)) != 0) { + set_simulation_time(&(readylist->time)); + } + TRACE(pc, STMT_BODY(pc), NULL_GROUP, 1, 0); + } + break; + + case WAIT_STMT: + if (test(STMT_WAIT_EXPR_CODE(pc)) == ONE) { + readylist->mode = RUN; + TRACE(pc, STMT_BODY(pc), NULL_GROUP, 1, 0); + } else { + new_pc = WaitOnEventAll(STMT_WAIT_MARKER(pc), pc); + TRACE(pc, new_pc, NULL_GROUP, 0, 0); + /* Make it so WAIT_STMT will be reexecuted when notified */ + } + break; + + case ASSIGN_EVENT_STMT: + if (readylist->mode == RUN) { + eval(STMT_ASSIGN_RVAL_CODE(pc)); + store(STMT_ASSIGN_TMP(pc), pc); + /* Set the state from which to detect edge */ + for (t = STMT_EVENT_EXPR_LIST(STMT_ASSIGN_EVENT(pc)); t; + t = TREE_CHAIN(t)) { + if (TREE_EXPR_CODE(t)) { + eval(TREE_EXPR_CODE(t)); + --R; + } + } + new_pc = WaitOnEventAll(STMT_EVENT_MARKER + (STMT_ASSIGN_EVENT(pc)), pc); + TRACE(pc, pc, *R, 1, 1); + TRACE(pc, new_pc, NULL_GROUP, 0, 1); + } else { + readylist->mode = RUN; + eval(STMT_ASSIGN_TMPCODE(pc)); + TRACE(pc, pc, *(R - 1), 1, 0); + store(STMT_ASSIGN_LVAL(pc), pc); + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 0); + } + break; + + case ASSIGN_NONBLK_EVENT_STMT: + if (readylist->mode == RUN) { + eval(STMT_ASSIGN_RVAL_CODE(pc)); + store(STMT_ASSIGN_TMP(pc), pc); + /* Set the state from which to detect edge */ + for (t = STMT_EVENT_EXPR_LIST(STMT_ASSIGN_EVENT(pc)); t; + t = TREE_CHAIN(t)) { + if (TREE_EXPR_CODE(t)) { + eval(TREE_EXPR_CODE(t)); + --R; + } + } + + WaitOnEventOther(STMT_ASSIGN_SCB(pc), + STMT_EVENT_MARKER(STMT_ASSIGN_EVENT(pc)), + pc); + TRACE(pc, pc, *R, 1, 1); + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 1); + } else { + readylist->mode = RUN; + eval(STMT_ASSIGN_TMPCODE(pc)); + TRACE(pc, pc, *(R - 1), 1, 0); + store(STMT_ASSIGN_LVAL(pc), pc); + new_pc = dispatch_pc(EVENT_LIST); + TRACE(pc, new_pc, NULL_GROUP, 0, 0); + } + break; + + case EVENT_STMT: + if (readylist->mode == RUN) { + /* Set the state from which to detect edge */ + for (t = STMT_EVENT_EXPR_LIST(pc); t; t = TREE_CHAIN(t)) { + if (TREE_EXPR_CODE(t)) { + eval(TREE_EXPR_CODE(t)); + --R; + } + } + new_pc = WaitOnEventAll(STMT_EVENT_MARKER(pc), pc); + TRACE(pc, new_pc, NULL_GROUP, 0, 0); + } else { + readylist->mode = RUN; + TRACE(pc, STMT_BODY(pc), NULL_GROUP, 1, 0); + } + break; + + case ARROW_STMT: + if (DECL_EVENT_CHAIN(STMT_ARROW_EVENT(pc))) { + NotifyEvent(DECL_EVENT_CHAIN(STMT_ARROW_EVENT(pc)), + ZERO, (int) 0); + } + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 0); + break; + + case FOREVER_STMT: + TRACE(pc, STMT_BODY(pc), NULL_GROUP, 0, 0); + break; + + case TASK_STMT: + if (!free_context || free_context->pc != pc) { + t1 = TASK_INPUT(STMT_TASK_TASK(pc)); + for (t = STMT_TASK_INASSIGN(pc); t; + t = TREE_CHAIN(t), t1 = TREE_CHAIN(t1)) { + eval((tree *) TREE_PURPOSE(t)); + store(TREE_PURPOSE(t1), STMT_TASK_TASK(pc)); + } + enter_context(readylist, STMT_TASK_TASK(pc), pc); + TRACE(pc, BLOCK_BODY(STMT_TASK_TASK(pc)), NULL_GROUP, 0, + 0); + } else { + /* Get here on DISABLE */ + free_context->pc = NULL; + pc = TREE_CHAIN(pc); + } + break; + + case TASK_BLOCK: + new_pc = exit_context(readylist); + free_context->pc = NULL; + t1 = TASK_OUTPUT(STMT_TASK_TASK(new_pc)); + for (t = STMT_TASK_OUTASSIGN(new_pc); t; + t = TREE_CHAIN(t), t1 = TREE_CHAIN(t1)) { + eval((tree *) TREE_PURPOSE(t1)); + store(TREE_PURPOSE(t), new_pc); + } + TRACE(pc, TREE_CHAIN(new_pc), NULL_GROUP, 0, 0); + break; + + case SYSTASK_STMT: + TRACE(pc, pc, NULL_GROUP, 1, 0); + exec_systask(pc); + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 0); + break; + + case FUNCTION_REF: + TRACE(pc, BLOCK_BODY(FUNC_REF_FUNC(pc)), NULL_GROUP, 0, 0); + break; + + case FUNCTION_BLOCK: + TRACE(pc, pc, NULL_GROUP, 0, 0); + return pc; + + case DISABLE_STMT: + broadcast_tf(reason_disable); + { + tree scope = STMT_DISABLE_SCOPE(pc); + TRACE(pc, pc, NULL_GROUP, 1, 0); + readylist->pc = TREE_CHAIN(pc); + while (BLOCK_CONTEXT_LIST(scope)) { + disable_context(BLOCK_CONTEXT_LIST(scope)); + } + } + TRACE(pc, readylist->pc, NULL_GROUP, 0, 0); + break; + + case DUMMY_RETURN_STMT: + return pc; + + case NULL_STMT: + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 0); + break; + + case LOOPBACK_STMT: + pc = STMT_BODY(pc); + break; + + case DUMP_STMT: /* removes INITIAL blocks and interactive stmts */ + pc = dump_current_process(); + break; + + case FINISH_STMT: + print_info(); + finish(); + + case END_STMT: + TRACE(pc, TREE_CHAIN(pc), NULL_GROUP, 0, 0); + break; + + case PLI_DELAY: + { + struct SCB *scb; + tree task; + + if (CMPTIME64(&CurrentTime, &(readylist->time))) { + set_simulation_time(&(readylist->time)); + } + scb = readylist; + if (PLI_DELAY_LVAL(pc) == NULL) { + scb->pc = PLI_DELAY_NEXT(pc); + task = PLI_DELAY_NODE(pc); + systaskDoDelay(pc); + freePliDelayNode(pc); + if (scb->pc == NULL) { + switch (TREE_CODE(task)) { + case SYSTASK_STMT: + FUNC_REF_DELAYSCB(task) = NULL; + break; + case SYSFUNCTION_REF: + STMT_SYSTASK_DELAYSCB(task) = NULL; + break; + } + pc = dump_current_process(); + } else { + scb->time = PLI_DELAY_TIME(scb->pc); + pc = dispatch_pc(TIME_LIST); + } + } else { + freePliDelayNode(pc); + *R++ = PLI_DELAY_STORAGE(pc); + store(PLI_DELAY_LVAL(pc), pc); + pc = dump_current_process(); + } + } + break; + + case 0: + printf_error_V("Attempt to execute NULL instruction!\n"); + abort(); + break; + + default: + printf_error_V("Unimplemented instruction: %s\n", + tree_code_name[TREE_CODE(pc)]); + abort(); + break; + + } /* switch */ + } /* while */ +} + +/* Used by continuous assignments from the scheduler. PC points to + a assign_cont_stmt node. If there is a delay in the sourced net, + put its SCB onto the time list. */ + +void do_net_assignment(tree pc) +{ + tree net; + + eval(STMT_ASSIGN_RVAL_CODE(pc)); + if (in_simulation && (trace_flag || single_trace_flag)) { + printf_V("** Triggering Continuous Assignment:\n"); + trace_stmt(pc, *(R - 1), 1, 0); + } + store(STMT_ASSIGN_LVAL(pc), pc); + + /* If continuous assignment is actually a net assignment (wire foo = bar;) + then go ahead and evaluate it now. This is here for compatibility; + presumably, XL does this naturally. */ + + if (NET_ASSIGN_ATTR(STMT_ASSIGN_LVAL(pc)) && + !PORT_COLLAPSED_ATTR(TREE_CHAIN(STMT_ASSIGN_LVAL(pc)))) { + net = TREE_CHAIN(STMT_ASSIGN_LVAL(pc)); + do_net_eval(net, 0, NULL_TREE); + TRACE(net, net, *(R - 1), 1, 1); + store(net, net); + } +} + +int in_initial = 0; + +/* Called by verilog.c to initialize nets before execution */ +void initialize_cont_assignments() +{ + tree t, pc; + int i = 0; + + in_initial = 1; + for (t = nreverse(continuous_assignments); t; t = TREE_CHAIN(t), i++) { + pc = TREE_PURPOSE(t); + if (TREE_CODE(pc) == NET_SCALAR_DECL + || TREE_CODE(pc) == NET_VECTOR_DECL) { + ScheduleNet(DECL_EVENT_CHAIN(pc), ZERO); + continue; + } + eval(STMT_ASSIGN_RVAL_CODE(pc)); + store(STMT_ASSIGN_LVAL(pc), pc); + if (NET_ASSIGN_ATTR(STMT_ASSIGN_LVAL(pc))) { + tree net = TREE_CHAIN(STMT_ASSIGN_LVAL(pc)); + do_net_eval(net, 0, NULL_TREE); + TRACE(net, net, *(R - 1), 1, 1); + store(net, net); + } + } + in_initial = 0; +} + +/* During net initialization, sched will call this */ +void net_exec(tree pc) +{ + DEBUGPRINT("Doing net exec\n"); + do_net_eval(pc, 0, NULL_TREE); + TRACE(pc, pc, *(R - 1), 1, 0); + store(pc, pc); + if ((PORT_OUTPUT_ATTR(pc) || PORT_COLLAPSED_ATTR(pc)) + && DECL_THREAD(pc)) { + do_net_eval(pc, 1, NULL_TREE); + store(DECL_THREAD(pc), pc); + } +} + +void exec_history() +{ + sorry("Command history not supported in this version"); +} + +void exec_remove_history() +{ + sorry("Command history not supported in this version"); +} + +int new_cmd_level = 1; +int cmd_level; +int prompt_flag = 1; +static int save_char = 0; + +tree +go_interactive(tree current_pc, tree next_pc, Group * g, int skip, int val) +{ + int c; + int ignore_cr = 0; + int fail; + extern tree interactive_statement; + extern int errorcount; /* from verilog.c */ + int tmp_error; + extern tree dummy_return; /* def'd in pass3.c; used for disable stmt */ + extern clock_t clock_pause; /* def'd in verilog.c */ + clock_t clk_pause; /* pause timer during interaction */ + + if ((trace_flag || single_trace_flag) && current_pc) { + switch (TREE_CODE(current_pc)) { + case SYSTASK_STMT: + case DISABLE_STMT: + case ASSIGN_STMT: + case ASSIGN_DELAY_STMT: + case ASSIGN_EVENT_STMT: + case ASSIGN_NONBLK_DELAY_STMT: + case ASSIGN_NONBLK_EVENT_STMT: + case ASSIGN_CONT_STMT: + case ASSIGN_PROC_STMT: + case FORCE_STMT: + case NET_VECTOR_DECL: + case NET_SCALAR_DECL: + case JOIN_STMT: + case JOIN_NAMED_STMT: + if (skip) { + trace_stmt(current_pc, g, skip, val); + return next_pc; + } + break; + default: + trace_stmt(current_pc, g, skip, val); + } + } + + if (!single_step_flag && !break_flag && !in_disable) { + /* Don't go interactive */ + return next_pc; + } + + /* Certain statements should stop after, not before */ + if (current_pc) { + switch (TREE_CODE(current_pc)) { + case SYSTASK_STMT: + case DISABLE_STMT: + case ASSIGN_STMT: + case ASSIGN_DELAY_STMT: + case ASSIGN_EVENT_STMT: + case ASSIGN_NONBLK_DELAY_STMT: + case ASSIGN_NONBLK_EVENT_STMT: + case ASSIGN_CONT_STMT: + case ASSIGN_PROC_STMT: + case FORCE_STMT: + case NET_VECTOR_DECL: + case NET_SCALAR_DECL: + if (skip) { + return next_pc; + } + break; + } + + + switch (TREE_CODE(next_pc)) { + case FOR_STMT: + if (STMT_SURROGATE_ATTR(next_pc) || val) { + return next_pc; + } + break; + case END_STMT: + case END_NAMED_STMT: + case JOIN_STMT: + case JOIN_NAMED_STMT: + case REPEAT_STMT: + case TASK_BLOCK: + case FUNCTION_BLOCK: + return next_pc; + case ALWAYS_BLOCK: + if (INITIALIZED_ATTR(next_pc)) { + return next_pc; + } + } + } + + if (break_flag) { /* we got here on a break, now exit */ + printf_V("Interrupt at time "); + print_time(&CurrentTime); + printf_V("\n"); + fin = File::Stdin(); + } + + if (in_disable) { + readylist->pc = next_pc; + return dummy_return; + } + + break_flag = 0; + normal_flag = !trace_flag; + single_step_flag = 0; + single_trace_flag = 0; + + cmd_level = new_cmd_level; + + for (;;) { + int endOfInput = 0; + clk_pause = clock(); /* start counting time away from simulation */ + if (prompt_flag) { + flush_files(); /* make sure that log and waves file are flushed */ + char prompt[256]; + snprintf(prompt, sizeof(prompt), "C%i> ", cmd_level); + char *line; + if (fin == NULL || fin == File::Stdin()) { + line = readline(prompt); +#ifdef HAVE_READLINE_HISTORY + if (line && line[0]) { + add_history(line); + } +#endif // HAVE_READLINE_HISTORY + } else { + char buffer[1024]; + if (fin->fgets(buffer, sizeof(buffer))) { + if (buffer[strlen(buffer) - 1] == '\n') { + buffer[strlen(buffer) - 1] = 0; + } else { + printf_error_V("lines in input file must be" + " less than %d characters\n", + sizeof(buffer)); + } + line = strdup(buffer); + } else { + line = 0; + } + } + if (line) { + printf_V_log("%s", prompt); + printf_V_key("%s\n", line); + push_stream(fin, 2); + fin = new File(line, strlen(line), 1); + } else { + endOfInput = 1; + } + } + + /* if there are no characters in the buffer, this is where + we'll wait for user input. Some compilers add the + '\n' at the end of the line. We'll watch for that + and strip it out. */ + + if (endOfInput) { + c = EOF; + } else { + do { + c = fin->fgetc(); + } + while (c == ' ' || c == '\t'); + } + + clock_pause += clock() - clk_pause; + + /* get here either at end of macro (if a macro was + entered at the command line), or end of input + file (-i or $input). */ + + if (c == EOF) { + File *savefin = fin; + fin = pop_stream(); /* This was either an input file or macro */ + if (!fin) { /* if Ctl-D is pressed under Unix, EOF is */ + print_info(); /* is returned from getc so fin is NULL */ + finish(); + } + prompt_flag = 1; + continue; + } + + /* Normal case: print what was in the I/O buffer to the log file */ + + if (c == '\n') { + prompt_flag = 1; + continue; + } else { + prompt_flag = 0; + } + + switch (c) { + case ',': + single_trace_flag = 1; + + case ';': + normal_flag = 0; + single_step_flag = 1; + + case '.': + is_interactive = 0; + return next_pc; + + case ':': + printf_V("Current position: line %d\n", + STMT_SOURCE_LINE(current_pc)); + break; + + case '-': + break; + + case ' ': + break; + + /* ^D: exit immediately */ + case (4): + print_info(); + finish(); + + /* Command history */ + case ('0'): + case ('1'): + case ('2'): + case ('3'): + case ('4'): + case ('5'): + case ('6'): + case ('7'): + case ('8'): + case ('9'): + exec_history(); + break; + + case '!': + { + char cmd[128]; + int i; + + fin->fgets(cmd, 128); + if (cmd[0] == '\n') { + strcpy(cmd, getenv("COMSPEC")); + if (cmd == NULL) { + strcpy(cmd, "command"); + } + printf("Type EXIT to return to VeriWell...\n"); + } + i = system(cmd); + if (i) { + perror("Command error\n"); + } + } + prompt_flag = 1; + break; + + default: + fin->fungetc(c); + is_interactive = 1; + reinit_lex(); + tmp_error = errorcount; + fail = prog_parse(); + if (!fail && tmp_error == errorcount) { + extern struct Marker_info marker_info; + marker_info.current_scb->pc = interactive_statement; + ASSIGNTIME64(&(marker_info.current_scb->time), + &CurrentTime); + tmp_error = errorcount; + new_cmd_level = cmd_level + 1; + pass3_interactive((tree) interactive_statement); + if (tmp_error == errorcount) { + stack_allocate(); + interject_readylist(marker_info.current_scb, next_pc); + /* for next time */ + marker_info.current_scb = BuildSCB(NULL_TREE, NOLIST); + single_step_flag = 1; + normal_flag = 0; + return interactive_statement; + } + } + prompt_flag = 1; + } + } +} + +/*********************************************************************** + * + * handle_gate + * - gate is ready to execute + * + *********************************************************************** + */ +void handle_gate(tree gate) +{ + tree pc; /* dummy for TRACE macro */ + + ASSERT(gate != NULL_TREE); + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + + + if (GATE_PATH_OUTPUT(gate) != NULL_TREE) { + if (handle_specify_path(gate)) { + return; + } + } + TRACE(gate, gate, 0, 0, 0); + (*GATE_PROPAGATE_ROUTINE(gate)) (gate); +} + +void print_prompt() +{ + printf_V("> "); +} + +void init_interactive() +{ + extern struct Marker_info marker_info; + marker_info.current_scb = BuildSCB(NULL_TREE, NOLIST); +} + +/***************************************************************** + * + * init_exec + * - initialize all global and static variables for exec.c + * + ***************************************************************** + */ + +void init_exec() +{ + exit_flag = 0; + brk_check = 0; + first_time_exec = 1; + in_initial = 0; + new_cmd_level = 1; + prompt_flag = 1; + save_char = 0; + in_disable = 0; + free_context = NULL; +} diff --git a/src/exec.h b/src/exec.h new file mode 100644 index 0000000..48425d0 --- /dev/null +++ b/src/exec.h @@ -0,0 +1,45 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* EXEC.H - Macros and prototypes for Exec */ + +#ifndef EXEC_H +#define EXEC_H + +void print_prompt(void); +tree exec_(tree pc); +void set_simulation_time(time64 * newtime_p); +struct context_member *make_context(void); +void enter_context(struct SCB *scb, tree scope, tree pc); +tree exit_context(struct SCB *scb); +tree unwind_context(struct context_member *context); +void disable_context(struct context_member *context); +tree deassign(tree lval, enum tree_code code); +void do_net_assignment(tree pc); +void initialize_cont_assignments(void); +void net_exec(tree pc); +void exec_history(); +void exec_remove_history(); +tree go_interactive(tree current_pc, tree next_pc, Group * g, + int skip, int val); +void handle_gate(tree gate); +void init_interactive(void); +void init_exec(void); + +#endif // EXEC_H diff --git a/src/flags.cc b/src/flags.cc new file mode 100644 index 0000000..d75fd96 --- /dev/null +++ b/src/flags.cc @@ -0,0 +1,118 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* FLAGS.C - Global storage for command line options */ + +#include "vtypes.h" +#include "tree.h" +#include "flags.h" + +/* For internal debugging: */ +int program = 0; /* displays program */ +int debug = 0; /* turns on internal trace */ +#if VDEBUG != 0 +int vdebug = 0; +#endif + +/* if 0, parse only */ +int simulate = 1; + +/* Read more command line options from file */ +int f_flag = 0; + +/* Enter interactive mode before running */ +int s_flag = 0; + +/* Read commands from file */ +int i_flag = 0; + +/* Set log file */ +int l_flag = 0; + +/* Set key file */ +int k_flag = 0; + +/* Set library search path */ +int y_flag = 0; + +/* Set to enable synopsys 2.0 conformance warnings */ +int synopsys_flag = 0; + +/* Suppress warnings */ +int inhibit_warnings = 0; + +/* Enter trace mode upon entry. Also used when $settrace is enabled. */ +int trace_flag = 0; + +/* Turn on variable debugging (default on) */ +int var_debug_flag = 1; + +/* Runtime state bits */ +/* (trace_flag is in both flags.h and runtime.h) */ +/* This is set if not trace nor single-step */ +int normal_flag = 1; + +/* set after ctl-c is pressed */ +int break_flag = 0; + +/* Set for either of the single-step commands: comma and semicolon */ +int single_step_flag = 0; + +/* set if comma (single-step with trace) */ +int single_trace_flag = 0; + +/* Capture all the user-defined plus args in a TREE_LIST */ +union tree_node *plusargs = 0; + +/* Print memory during pass 2 */ +int MemTrace; + +/*************************************************************** + * + * init_flags + * - initialize all global and static variables in flags.c + * + *************************************************************** + */ + +void init_flags() +{ + program = 0; + debug = 0; +#if VDEBUG != 0 + vdebug = 0; +#endif + y_flag = 0; + simulate = 1; + f_flag = 0; + s_flag = 0; + i_flag = 0; + l_flag = 0; + k_flag = 0; + synopsys_flag = 0; + inhibit_warnings = 0; + trace_flag = 0; + var_debug_flag = 1; + normal_flag = 1; + break_flag = 0; + single_step_flag = 0; + single_trace_flag = 0; + plusargs = 0; + MemTrace = 0; +} diff --git a/src/flags.h b/src/flags.h new file mode 100644 index 0000000..dec64f7 --- /dev/null +++ b/src/flags.h @@ -0,0 +1,53 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* FLAGS.H - Global access to command line options */ + +#ifndef FLAGS_H +#define FLAGS_H + +extern int program; +extern int debug; +#if VDEBUG != 0 +extern int vdebug; +#endif +extern int y_flag; +extern int simulate; +extern int f_flag; +extern int s_flag; +extern int i_flag; +extern int l_flag; +extern int k_flag; +extern int y_flag; +extern int trace_flag; +extern int synopsys_flag; +extern int var_debug_flag; +extern int inhibit_warnings; +extern int MemTrace; + +extern enum delay_type delay_type; +extern enum tree_type default_net_type; + +/* all the user-defined plusargs in a TREE_LIST */ +extern tree plusargs; + +void init_flags(void); + + +#endif // FLAGS_H diff --git a/src/gates.cc b/src/gates.cc new file mode 100644 index 0000000..818c0b7 --- /dev/null +++ b/src/gates.cc @@ -0,0 +1,3150 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/*************************************************************************** + * + * gates.c + * - gate building and execution code + * + * Things not implemented: + * 1) bit selects on pullup,pulldown, tran, rtran gates + * 2) pullup, pulldown, tran, and rtran need strengths to work + * 3) trireg not supported + ************************************************************************** + */ + +#include "glue.h" +#include +#include "vtypes.h" +#include "tree.h" +#include "schedule.h" +#include "runtime.h" +#include "gates.h" +#include "specify.h" +#include "udp.h" +#include "store.h" +#include "pass3.h" +#include "veriwell.h" +#include "eval.h" +#include "scope.h" +#include "nsched.h" + + + +void and_exec(struct Marker *marker); +void nand_exec(struct Marker *marker); +void or_exec(struct Marker *marker); +void nor_exec(struct Marker *marker); +void xor_exec(struct Marker *marker); +void xnor_exec(struct Marker *marker); +void buf_exec(struct Marker *marker); +void not_exec(struct Marker *marker); +void bufif0_exec(struct Marker *marker); +void bufif1_exec(struct Marker *marker); +void notif0_exec(struct Marker *marker); +void notif1_exec(struct Marker *marker); +void nmos_exec(struct Marker *marker); +void pmos_exec(struct Marker *marker); +void rnmos_exec(struct Marker *marker); +void rpmos_exec(struct Marker *marker); +void cmos_exec(struct Marker *marker); +void rcmos_exec(struct Marker *marker); +void tranif0_exec(struct Marker *marker); +void rtranif0_exec(struct Marker *marker); +void tranif1_exec(struct Marker *marker); +void rtranif1_exec(struct Marker *marker); +void tran_exec(struct Marker *marker); +void rtran_exec(struct Marker *marker); +void pull_exec(struct Marker *marker); + + + +/************************************************************************ + * + * build_gate_instance + * - create and initialize a gate structure + * + ************************************************************************ + */ +tree +build_gate_instance(enum tree_type type, char *filename, lineno_t lineno, + tree ident, tree arg_list, tree delay, tree udp_def) +{ + tree node; + int i; + tree t; + tree last; + int numberOfArgs; + int numberOfOutputs; + + + node = make_node(GATE_INSTANCE); + TREE_TYPE(node) = type; + GATE_FILE(node) = filename; + GATE_LINE(node) = lineno; + if (ident == NULL_TREE) { + GATE_NAME(node) = NULL; + } else { + GATE_NAME(node) = IDENT(ident); + } + GATE_DELAY(node) = delay; + + GATE_OUTPUT(node) = X; + GATE_FIRED_INPUTS(node) = 0; + GATE_PATH_OUTPUT(node) = NULL_TREE; + + numberOfArgs = list_length(arg_list); + switch ((int) type) { + case GATE_UDP_TYPE: + ASSERT(udp_def != NULL_TREE); + ASSERT(TREE_CODE(udp_def) == MODULE_BLOCK); + ASSERT(UDP_ATTR(udp_def)); + GATE_UDP_DEF(node) = udp_def; + if (list_length(UDP_PORT_LIST(udp_def)) != list_length(arg_list)) { + error("Incorrect number of arguments specified for primitive", + NULL, NULL); + return (error_mark_node); + } + numberOfOutputs = 1; + break; + case GATE_AND_TYPE: + case GATE_NAND_TYPE: + case GATE_OR_TYPE: + case GATE_NOR_TYPE: + case GATE_XOR_TYPE: + case GATE_XNOR_TYPE: + if (numberOfArgs < 2) { + error("Not enough arguments specified for primitive", NULL, + NULL); + return (error_mark_node); + } else if (numberOfArgs > 64) { + error("Too many arguments specified for primitive", NULL, + NULL); + return (error_mark_node); + } + numberOfOutputs = 1; + break; + case GATE_BUFIF0_TYPE: + case GATE_BUFIF1_TYPE: + case GATE_NOTIF0_TYPE: + case GATE_NOTIF1_TYPE: + case GATE_NMOS_TYPE: + case GATE_PMOS_TYPE: + case GATE_RNMOS_TYPE: + case GATE_RPMOS_TYPE: + if (numberOfArgs < 3) { + error("Not enough arguments specified for primitive", NULL, + NULL); + return (error_mark_node); + } else if (numberOfArgs > 3) { + error("To many arguments specified for primitive", NULL, NULL); + return (error_mark_node); + } + numberOfOutputs = 1; + break; + case GATE_BUF_TYPE: + case GATE_NOT_TYPE: + if (numberOfArgs < 2) { + error("Not enough arguments specified for primitive", NULL, + NULL); + return (error_mark_node); + } else if (numberOfArgs > 9) { + error("To many arguments specified for primitive", NULL, NULL); + return (error_mark_node); + } + numberOfOutputs = numberOfArgs - 1; + break; + case GATE_CMOS_TYPE: + case GATE_RCMOS_TYPE: + if (numberOfArgs < 4) { + error("Not enough arguments specified for primitive", NULL, + NULL); + return (error_mark_node); + } else if (numberOfArgs > 4) { + error("To many arguments specified for primitive", NULL, NULL); + return (error_mark_node); + } + numberOfOutputs = 1; + break; + case GATE_PULLUP_TYPE: + case GATE_PULLDN_TYPE: + if (numberOfArgs < 1) { + error("Not enough arguments specified for primitive", NULL, + NULL); + return (error_mark_node); + } else if (numberOfArgs > 1) { + error("To many arguments specified for primitive", NULL, NULL); + return (error_mark_node); + } + numberOfOutputs = 1; + break; + case GATE_TRAN_TYPE: + case GATE_RTRAN_TYPE: + if (numberOfArgs < 2) { + error("Not enough arguments specified for primitive", NULL, + NULL); + return (error_mark_node); + } else if (numberOfArgs > 2) { + error("To many arguments specified for primitive", NULL, NULL); + return (error_mark_node); + } + numberOfOutputs = 2; + t = arg_list; + arg_list = tree_cons(TREE_PURPOSE(t), NULL_TREE, arg_list); + t = TREE_CHAIN(t); + arg_list = tree_cons(TREE_PURPOSE(t), NULL_TREE, arg_list); + break; + case GATE_TRANIF0_TYPE: + case GATE_TRANIF1_TYPE: + case GATE_RTRANIF0_TYPE: + case GATE_RTRANIF1_TYPE: + if (numberOfArgs < 3) { + error("Not enough arguments specified for primitive", NULL, + NULL); + return (error_mark_node); + } else if (numberOfArgs > 3) { + error("To many arguments specified for primitive", NULL, NULL); + return (error_mark_node); + } + numberOfOutputs = 2; + t = arg_list; + arg_list = tree_cons(TREE_PURPOSE(t), NULL_TREE, arg_list); + t = TREE_CHAIN(t); + arg_list = tree_cons(TREE_PURPOSE(t), NULL_TREE, arg_list); + break; + default: + ASSERT(FALSE); + } + + last = NULL_TREE; + for (t = arg_list, i = numberOfOutputs; i; i--, t = TREE_CHAIN(t)) { + TREE_EXPR(t) = check_lval_port(TREE_EXPR(t)); + GATE_TERMINAL_GATE(t) = node; + switch (TREE_CODE(TREE_EXPR(t))) { + case NET_SCALAR_DECL: + NET_ASSIGNMENT(TREE_EXPR(t)) = t; + break; + case BIT_REF: + NET_ASSIGNMENT(BIT_REF_DECL(TREE_EXPR(t))) = t; + break; + } + + last = t; + } + ASSERT(last != NULL_TREE); + TREE_CHAIN(last) = NULL_TREE; + + GATE_OUTPUT_LIST(node) = arg_list; + GATE_INPUT_LIST(node) = t; + GATE_INPUTS(node) = list_length(GATE_INPUT_LIST(node)); + GATE_SCOPE(node) = current_scope; + + for (t = GATE_INPUT_LIST(node); t; t = TREE_CHAIN(t)) { + GATE_TERMINAL_GATE(t) = node; + } + return node; +} + + + +/************************************************************************ + * + * initializeGates + * - propagate gate outputs at initialization + * + ************************************************************************ + */ +void initialize_gates(void) +{ + tree gate; + enum logical_value was_output; + + + for (gate = PeekGate(); gate; gate = PeekGate()) { + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + RemoveGate(gate); + was_output = GATE_OUTPUT(gate); + GATE_OUTPUT(gate) = X; + (*GATE_PROPAGATE_ROUTINE(gate)) (gate); + GATE_OUTPUT(gate) = was_output; + if (was_output != X) { + handle_gate(gate); + } + } +} + +/************************************************************************ + * + * gate_check_delay + * - validate gate delays + * + ************************************************************************ + */ + +void gate_check_delay(tree gate, unsigned int max_delays) +{ + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + ASSERT(max_delays >= 0); + + if (!GATE_DELAY(gate)) { + return; + } + if (!max_delays) { + error("Delays are not allowed in this type of primitive", NULL, + NULL); + } + + if (TREE_LABEL(GATE_DELAY(gate)) > max_delays) { + error("Too many delays specified for this type of primitive", + NULL, NULL); + } + pass3_delay(GATE_DELAY(gate)); +} + +/************************************************************************ + * + * gate_ok_input + * - validate gate input + * + ************************************************************************ + */ + +int gate_ok_input(tree port) +{ + ASSERT(port != NULL_TREE); + + /* Any port is an ok input */ + return TRUE; +} + + +/************************************************************************ + * + * gate_ok_output + * - validate gate output + * + ************************************************************************ + */ + + +int gate_ok_output(tree port) +{ + ASSERT(port != NULL_TREE); + + /* Gate outputs must be a net and one bit */ + + if (is_all_net(port)) { + if (TREE_NBITS(port) != 1 && TREE_CODE(port) != BIT_REF) { + error("Primitive output must be scalar", NULL, NULL); + return (FALSE); + } + return TRUE; + } + error("Primitive output must be a net", NULL, NULL); + return FALSE; +} + +/************************************************************************ + * + * gate_check_ports + * - validate gate ports + * + ************************************************************************ + */ + +void gate_check_ports(tree gate, enum gate_style style) +{ + tree port; + tree inputPortList = NULL; + tree outputPortList = NULL; + tree t; + int port_count = 0; + int terminalNumber = 0; + extern struct Marker_info marker_info; /* in pass3.c */ + struct Marker *marker = NULL, *mark; + int first; + + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + inputPortList = GATE_INPUT_LIST(gate); + outputPortList = GATE_OUTPUT_LIST(gate); + ASSERT(outputPortList); + runtime_error(gate); + + for (t = outputPortList; t; t = TREE_CHAIN(t)) { + port = TREE_EXPR(t); + ASSERT(port != NULL_TREE); + gate_ok_output(port); + TREE_EXPR_CODE(t) = pass3_expr(port); + GATE_TERMINAL_GATE(t) = gate; + PORT_OUTPUT_ATTR(t) = 1; + if (style == PRIM_TRAN) { + PORT_INPUT_ATTR(t) = 1; + } + GATE_TERMINAL_NUMBER(t) = terminalNumber++; + } + + for (t = GATE_INPUT_LIST(gate); t; t = TREE_CHAIN(t)) { + GATE_TERMINAL_GATE(t) = gate; + if (style != PRIM_TRAN) { + PORT_INPUT_ATTR(t) = 1; + } + GATE_TERMINAL_NUMBER(t) = terminalNumber++; + port = TREE_EXPR(t); + // this is for pli only + PORT_INPUT_ATTR(t) = 1; + if (gate_ok_input(port)) { + extern struct Marker_info marker_info; + SCB *save_scb = marker_info.current_scb; + marker_info.current_scb = (SCB *) gate; + /* Scan port and generate markers; + make sure makers point back to ports */ + marker = NULL; + GATE_INPUT_NUMBER(t) = port_count; + TREE_EXPR_CODE(t) = pass3_expr_marker(port, + &marker, + (enum + marker_flags) (M_PRIM + + M_FIXED), + NULL_TREE, NULL_TREE); + SET_GATE_IN(t, X); + marker_info.current_scb = save_scb; + + /* This is a circular list, so make sure we only go + around once; constants have no markers */ + for (mark = marker, first = 1; + mark && (mark != marker || first == 1); + mark = mark->link, first = 0) { + mark->expr.arg = t; + /* if single var, no expr, then this can be fast */ + if (port == mark->decl + && TREE_CODE(port) == NET_SCALAR_DECL) { + mark->flags = + (enum marker_flags) (M_PRIM_FAST | mark->flags); + } + } + } + port_count++; + } + GATE_INPUTS(gate) = port_count; +} + +/************************************************************************ + * + * pass3_gate + * - link and initialize gate + * + ************************************************************************ + */ + +void pass3_gate(tree gate) +{ + Group *g; + tree t, arg; + nbits_t nbits; /* Used only for _eval call */ + + switch (TREE_TYPE(gate)) { + case GATE_UDP_TYPE: + GATE_ROUTINE(gate) = &udp_exec; + gate_check_delay(gate, 2); + gate_check_ports(gate, PRIM_LOGIC); + ASSERT(GATE_UDP_DEF(gate) != NULL_TREE); + ASSERT(TREE_CODE(GATE_UDP_DEF(gate)) == MODULE_BLOCK); + ASSERT(UDP_ATTR(GATE_UDP_DEF(gate))); + t = UDP_INITIAL_VALUE(GATE_UDP_DEF(gate)); + if (t && TREE_CODE(t) == INTEGER_CST) { + ASSERT((INT_CST_DATA(t) & ~1) == 0); + GATE_OUTPUT(gate) = (enum logical_value) (INT_CST_DATA(t) & 1); + } else if (t && TREE_CODE(t) == BIT_CST) { + g = BIT_CST_GROUP(t); + GATE_OUTPUT(gate) = VAL_TO_STATE(g); + } else if (t == NULL_TREE) { + GATE_OUTPUT(gate) = X; + } else { + ASSERT(FALSE); + } + GATE_PROPAGATE_ROUTINE(gate) = &propagate_unigate_output; + { + int i; + int count; + int state; + + state = 0; + if (UDP_REG_NAME(GATE_UDP_DEF(gate)) != NULL_TREE) { + switch (GATE_OUTPUT(gate)) { + case ZERO: + state = int_power(3, GATE_INPUTS(gate)) * 0; + break; + case ONE: + state = int_power(3, GATE_INPUTS(gate)) * 1; + break; + case X: + case Z: + state = int_power(3, GATE_INPUTS(gate)) * 2; + break; + } + } + + /* Evaluate each argument for inital condition; + there may be a constant in + one or more of the inputs, so don't assume X. */ + stack_allocate(); /* Let eval_ work */ + for (arg = GATE_INPUT_LIST(gate); arg; arg = TREE_CHAIN(arg)) { + g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + switch (VAL_TO_STATE(g)) { + case ZERO: + break; + case ONE: + state += int_power(3, GATE_INPUT_NUMBER(arg)) * 1; + break; + case X: + case Z: + state += int_power(3, GATE_INPUT_NUMBER(arg)) * 2; + break; + } + } + GATE_STATE(gate) = state; + } + break; + + case GATE_AND_TYPE: + GATE_ROUTINE(gate) = &and_exec; + goto logic_common; + + case GATE_NAND_TYPE: + GATE_ROUTINE(gate) = &nand_exec; + goto logic_common; + + case GATE_OR_TYPE: + GATE_ROUTINE(gate) = &or_exec; + goto logic_common; + + case GATE_NOR_TYPE: + GATE_ROUTINE(gate) = &nor_exec; + goto logic_common; + + case GATE_XOR_TYPE: + GATE_ROUTINE(gate) = &xor_exec; + goto logic_common; + + case GATE_XNOR_TYPE: + GATE_ROUTINE(gate) = &xnor_exec; + goto logic_common; + + + logic_common: + gate_check_delay(gate, 2); + gate_check_ports(gate, PRIM_LOGIC); + GATE_X(gate) = GATE_INPUTS(gate); + GATE_FIRED_INPUTS(gate) = 0; + GATE_PROPAGATE_ROUTINE(gate) = &propagate_unigate_output; + break; + + case GATE_BUF_TYPE: + GATE_ROUTINE(gate) = &buf_exec; + goto buf_common; + + case GATE_NOT_TYPE: + GATE_ROUTINE(gate) = ¬_exec; + goto buf_common; + + buf_common: + gate_check_delay(gate, 2); + gate_check_ports(gate, PRIM_BUF); + GATE_PROPAGATE_ROUTINE(gate) = &propagate_unigate_output; + break; + + case GATE_BUFIF0_TYPE: + GATE_ROUTINE(gate) = &bufif0_exec; + goto tri_common; + + case GATE_BUFIF1_TYPE: + GATE_ROUTINE(gate) = &bufif1_exec; + goto tri_common; + + case GATE_NOTIF0_TYPE: + GATE_ROUTINE(gate) = ¬if0_exec; + goto tri_common; + + case GATE_NOTIF1_TYPE: + GATE_ROUTINE(gate) = ¬if1_exec; + goto tri_common; + + case GATE_NMOS_TYPE: + GATE_ROUTINE(gate) = &nmos_exec; + goto tri_common; + + case GATE_PMOS_TYPE: + GATE_ROUTINE(gate) = &pmos_exec; + goto tri_common; + + case GATE_RNMOS_TYPE: + GATE_ROUTINE(gate) = &rnmos_exec; + goto tri_common; + + case GATE_RPMOS_TYPE: + GATE_ROUTINE(gate) = &rpmos_exec; + goto tri_common; + + tri_common: + gate_check_delay(gate, 3); + gate_check_ports(gate, PRIM_TRI); + GATE_PROPAGATE_ROUTINE(gate) = &propagate_unigate_output; + break; + + case GATE_CMOS_TYPE: + GATE_ROUTINE(gate) = &cmos_exec; + goto cmos_common; + + case GATE_RCMOS_TYPE: + GATE_ROUTINE(gate) = &rcmos_exec; + goto cmos_common; + + cmos_common: + gate_check_delay(gate, 3); + gate_check_ports(gate, PRIM_CMOS); + GATE_PROPAGATE_ROUTINE(gate) = &propagate_unigate_output; + break; + + case GATE_TRAN_TYPE: + GATE_ROUTINE(gate) = &tran_exec; + gate_check_delay(gate, 0); + GATE_CONTROL(gate) = ONE; + goto tran_common; + + case GATE_RTRAN_TYPE: + GATE_ROUTINE(gate) = &rtran_exec; + gate_check_delay(gate, 0); + GATE_CONTROL(gate) = ONE; + goto tran_common; + + case GATE_TRANIF0_TYPE: + gate_check_delay(gate, 2); + GATE_ROUTINE(gate) = &tranif0_exec; + GATE_CONTROL(gate) = ZERO; + goto tran_common; + + case GATE_TRANIF1_TYPE: + gate_check_delay(gate, 2); + GATE_ROUTINE(gate) = &tranif1_exec; + GATE_CONTROL(gate) = ZERO; + goto tran_common; + + case GATE_RTRANIF0_TYPE: + gate_check_delay(gate, 2); + GATE_ROUTINE(gate) = &rtranif0_exec; + GATE_CONTROL(gate) = ZERO; + goto tran_common; + + case GATE_RTRANIF1_TYPE: + gate_check_delay(gate, 2); + GATE_ROUTINE(gate) = &rtranif1_exec; + GATE_CONTROL(gate) = ZERO; + goto tran_common; + + + tran_common: + gate_check_ports(gate, PRIM_TRAN); + GATE_PROPAGATE_ROUTINE(gate) = &propagate_bigate_output; + break; + + case GATE_PULLUP_TYPE: + GATE_INPUTS(gate) = 0; + GATE_ROUTINE(gate) = NULL; + GATE_OUTPUT(gate) = ONE; + goto pull_common; + + case GATE_PULLDN_TYPE: + GATE_INPUTS(gate) = 0; + GATE_ROUTINE(gate) = NULL; + GATE_OUTPUT(gate) = ZERO; + goto pull_common; + + pull_common: + gate_check_delay(gate, 0); + gate_check_ports(gate, PRIM_PULL); + GATE_PROPAGATE_ROUTINE(gate) = propagate_unigate_output; + break; + + default: + ASSERT(FALSE); + } + + + /* build bit ref lval if needed */ + + for (t = GATE_OUTPUT_LIST(gate); t != NULL_TREE; t = TREE_CHAIN(t)) { + ASSERT(TREE_CODE(t) == TREE_LIST); + if (TREE_CODE(TREE_PURPOSE(t)) == BIT_REF) { + pass3_lval(&TREE_PURPOSE(t)); + } + } + + /* propagate the gate output at beginning of simulation */ + + ScheduleGate(gate, 0); +} + +/* Evaluate the gates in the following manner: + 1) Determine the value of the input and whether it changed... + case 1: input is a net; new value is propigated through marker + case 2: input is expression; evaluate expression and determine if + input changed. + 2) Update ONE(ZERO) count and X count + 3) Determine new output + 4) If input has not changed or output has not changed, exit. +*/ + +/*********************************************************************** + * + * and_exec + * - execution routine for and gates + * + *********************************************************************** + */ + +void and_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + nbits_t nbits; + ASSERT(marker != NULL); + ASSERT(gate != NULL); + + /* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + + /* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + + /* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. + */ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* update value counts */ + + switch (in_old) { + case X: + case Z: + GATE_X(gate)--; + break; + case ZERO: + GATE_ZEROS(gate)--; + break; + default: + break; + } + + switch (in_new) { + case X: + case Z: + GATE_X(gate)++; + break; + case ZERO: + GATE_ZEROS(gate)++; + break; + default: + break; + } + + if (GATE_ZEROS(gate) == 0) { + if (GATE_X(gate) == 0) { + out_new = ONE; + } else { + out_new = X; + } + } else { + out_new = ZERO; + } + + if (out_new != out_old) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * nand_exec + * - execution routine for nand gates + * + *********************************************************************** + */ + +void nand_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + nbits_t nbits; + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* update value counts */ + + switch (in_old) { + case X: + case Z: + GATE_X(gate)--; + break; + case ZERO: + GATE_ZEROS(gate)--; + break; + default: + break; + } + + switch (in_new) { + case X: + case Z: + GATE_X(gate)++; + break; + case ZERO: + GATE_ZEROS(gate)++; + break; + default: + break; + } + + if (GATE_ZEROS(gate) == 0) { + if (GATE_X(gate) == 0) { + out_new = ZERO; + } else { + out_new = X; + } + } else { + out_new = ONE; + } + + if (out_new != out_old) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * or_exec + * - execution routine for or gates + * + *********************************************************************** + */ + +void or_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* update value counts */ + + switch (in_old) { + case X: + case Z: + GATE_X(gate)--; + break; + case ONE: + GATE_ONES(gate)--; + break; + default: + break; + } + + switch (in_new) { + case X: + case Z: + GATE_X(gate)++; + break; + case ONE: + GATE_ONES(gate)++; + break; + default: + break; + } + + if (GATE_ONES(gate) == 0) { + if (GATE_X(gate) == 0) { + out_new = ZERO; + } else { + out_new = X; + } + } else { + out_new = ONE; + } + + if (out_new != out_old) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * nor_exec + * - execution routine for nor gates + * + *********************************************************************** + */ + +void nor_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* update value counts */ + + switch (in_old) { + case X: + case Z: + GATE_X(gate)--; + break; + case ONE: + GATE_ONES(gate)--; + break; + default: + break; + } + + switch (in_new) { + case X: + case Z: + GATE_X(gate)++; + break; + case ONE: + GATE_ONES(gate)++; + break; + default: + break; + } + + if (GATE_ONES(gate) == 0) { + if (GATE_X(gate) == 0) { + out_new = ONE; + } else { + out_new = X; + } + } else { + out_new = ZERO; + } + + if (out_new != out_old) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * xor_exec + * - execution routine for xor gates + * + *********************************************************************** + */ + +void xor_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* update value counts */ + + switch (in_old) { + case X: + case Z: + GATE_X(gate)--; + break; + case ONE: + GATE_ONES(gate)--; + break; + default: + break; + } + + switch (in_new) { + case X: + case Z: + GATE_X(gate)++; + break; + case ONE: + GATE_ONES(gate)++; + break; + default: + break; + } + + if (GATE_X(gate) == 0) { + if (GATE_ONES(gate) & 1) { + out_new = ONE; + } else { + out_new = ZERO; + } + } else { + out_new = X; + } + + if (out_new != out_old) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * xnor_exec + * - execution routine for xnor gates + * + *********************************************************************** + */ + +void xnor_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* update value counts */ + + switch (in_old) { + case X: + case Z: + GATE_X(gate)--; + break; + case ONE: + GATE_ONES(gate)--; + break; + default: + break; + } + + switch (in_new) { + case X: + case Z: + GATE_X(gate)++; + break; + case ONE: + GATE_ONES(gate)++; + break; + default: + break; + } + + if (GATE_X(gate) == 0) { + if (GATE_ONES(gate) & 1) { + out_new = ZERO; + } else { + out_new = ONE; + } + } else { + out_new = X; + } + + if (out_new != out_old) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * buf_exec + * - execution routine for buf gates + * + *********************************************************************** + */ + +void buf_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + + switch (in_new) { + case X: + case Z: + out_new = X; + break; + case ZERO: + out_new = ZERO; + break; + case ONE: + out_new = ONE; + break; + default: + break; + } + + + if (out_new != out_old) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * not_exec + * - execution routine for not gates + * + *********************************************************************** + */ + +void not_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + + switch (in_new) { + case X: + case Z: + out_new = X; + break; + case ZERO: + out_new = ONE; + break; + case ONE: + out_new = ZERO; + break; + default: + break; + } + + + if (out_new != out_old) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * bufif0_exec + * - execution routine for bufif0 gates + * + *********************************************************************** + */ + +void bufif0_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + enum logical_value control_value, input_value; + int strengthChange = FALSE; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* check if this is a control input */ + + if (GATE_INPUT_LIST(gate) == arg) { // data input has changed + input_value = in_new; + ASSERT(TREE_CHAIN(arg) != NULL_TREE); + ASSERT(TREE_CODE(TREE_CHAIN(arg)) == TREE_LIST); + control_value = GATE_IN(TREE_CHAIN(arg)); + + /* this is a kludge until strengths are supported */ + if ((in_new == ONE || in_new == ZERO || in_old == ONE + || in_old == ZERO) + && (control_value == X || control_value == Z)) { + strengthChange = TRUE; + } + } else { // control input has changed + control_value = in_new; + ASSERT(GATE_INPUT_LIST(gate) != NULL_TREE); + ASSERT(TREE_CODE(GATE_INPUT_LIST(gate)) == TREE_LIST); + input_value = GATE_IN(GATE_INPUT_LIST(gate)); + } + + + switch (control_value) { + case X: + case Z: + out_new = X; + break; + case ONE: + out_new = Z; + break; + case ZERO: + if (input_value == Z) { + out_new = X; + } else { + out_new = input_value; + } + break; + default: + ASSERT(FALSE); + } + + if (out_new != out_old || strengthChange) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * bufif1_exec + * - execution routine for bufif1 gates + * + *********************************************************************** + */ + +void bufif1_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + enum logical_value control_value, input_value; + int strengthChange = FALSE; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* check if this is a control input */ + + if (GATE_INPUT_LIST(gate) == arg) { // data input has changed + input_value = in_new; + ASSERT(TREE_CHAIN(arg) != NULL_TREE); + ASSERT(TREE_CODE(TREE_CHAIN(arg)) == TREE_LIST); + control_value = GATE_IN(TREE_CHAIN(arg)); + + /* this is a kludge until strengths are supported */ + if ((in_new == ONE || in_new == ZERO || in_old == ONE + || in_old == ZERO) + && (control_value == X || control_value == Z)) { + strengthChange = TRUE; + } + } else { // control input has changed + control_value = in_new; + ASSERT(GATE_INPUT_LIST(gate) != NULL_TREE); + ASSERT(TREE_CODE(GATE_INPUT_LIST(gate)) == TREE_LIST); + input_value = GATE_IN(GATE_INPUT_LIST(gate)); + } + + + switch (control_value) { + case X: + case Z: + out_new = X; + break; + case ZERO: + out_new = Z; + break; + case ONE: + if (input_value == Z) { + out_new = X; + } else { + out_new = input_value; + } + break; + default: + ASSERT(FALSE); + } + + if (out_new != out_old || strengthChange) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * notif0_exec + * - execution routine for notif0 gates + * + *********************************************************************** + */ + +void notif0_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + enum logical_value control_value, input_value; + int strengthChange = FALSE; + nbits_t nbits; + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* check if this is a control input */ + + if (GATE_INPUT_LIST(gate) == arg) { // data input has changed + input_value = in_new; + ASSERT(TREE_CHAIN(arg) != NULL_TREE); + ASSERT(TREE_CODE(TREE_CHAIN(arg)) == TREE_LIST); + control_value = GATE_IN(TREE_CHAIN(arg)); + + /* this is a kludge until strengths are supported */ + if ((in_new == ONE || in_new == ZERO || in_old == ONE + || in_old == ZERO) + && (control_value == X || control_value == Z)) { + strengthChange = TRUE; + } + } else { // control input has changed + control_value = in_new; + ASSERT(GATE_INPUT_LIST(gate) != NULL_TREE); + ASSERT(TREE_CODE(GATE_INPUT_LIST(gate)) == TREE_LIST); + input_value = GATE_IN(GATE_INPUT_LIST(gate)); + } + + + switch (control_value) { + case X: + case Z: + out_new = X; + break; + case ONE: + out_new = Z; + break; + case ZERO: + switch (input_value) { + case X: + case Z: + out_new = X; + break; + case ONE: + out_new = ZERO; + break; + case ZERO: + out_new = ONE; + break; + default: + ASSERT(FALSE); + } + break; + default: + ASSERT(FALSE); + } + + if (out_new != out_old || strengthChange) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * notif1_exec + * - execution routine for notif1 gates + * + *********************************************************************** + */ + +void notif1_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + enum logical_value control_value, input_value; + int strengthChange = FALSE; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* check if this is a control input */ + + if (GATE_INPUT_LIST(gate) == arg) { // data input has changed + input_value = in_new; + ASSERT(TREE_CHAIN(arg) != NULL_TREE); + ASSERT(TREE_CODE(TREE_CHAIN(arg)) == TREE_LIST); + control_value = GATE_IN(TREE_CHAIN(arg)); + + /* this is a kludge until strengths are supported */ + if ((in_new == ONE || in_new == ZERO || in_old == ONE + || in_old == ZERO) + && (control_value == X || control_value == Z)) { + strengthChange = TRUE; + } + } else { // control input has changed + control_value = in_new; + ASSERT(GATE_INPUT_LIST(gate) != NULL_TREE); + ASSERT(TREE_CODE(GATE_INPUT_LIST(gate)) == TREE_LIST); + input_value = GATE_IN(GATE_INPUT_LIST(gate)); + } + + + switch (control_value) { + case X: + case Z: + out_new = X; + break; + case ZERO: + out_new = Z; + break; + case ONE: + switch (input_value) { + case X: + case Z: + out_new = X; + break; + case ONE: + out_new = ZERO; + break; + case ZERO: + out_new = ONE; + break; + default: + ASSERT(FALSE); + } + break; + default: + ASSERT(FALSE); + } + + if (out_new != out_old || strengthChange) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * pmos_exec + * - execution routine for pmos gates + * + *********************************************************************** + */ + +void pmos_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + enum logical_value control_value, input_value; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* check if this is a control input */ + + if (GATE_INPUT_LIST(gate) == arg) { // data input has changed + input_value = in_new; + ASSERT(TREE_CHAIN(arg) != NULL_TREE); + ASSERT(TREE_CODE(TREE_CHAIN(arg)) == TREE_LIST); + control_value = GATE_IN(TREE_CHAIN(arg)); + } else { // control input has changed + control_value = in_new; + ASSERT(GATE_INPUT_LIST(gate) != NULL_TREE); + ASSERT(TREE_CODE(GATE_INPUT_LIST(gate)) == TREE_LIST); + input_value = GATE_IN(GATE_INPUT_LIST(gate)); + } + + + switch (control_value) { + case X: + case Z: + switch (input_value) { + case X: + case ONE: + case ZERO: + out_new = X; + break; + case Z: + out_new = Z; + break; + default: + ASSERT(FALSE); + } + break; + case ONE: + out_new = Z; + break; + case ZERO: + out_new = input_value; + break; + default: + ASSERT(FALSE); + } + + if (out_new != out_old + || (out_new == X && arg == GATE_INPUT_LIST(gate))) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * nmos_exec + * - execution routine for nmos gates + * + *********************************************************************** + */ + +void nmos_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + enum logical_value control_value, input_value; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* check if this is a control input */ + + if (GATE_INPUT_LIST(gate) == arg) { // data input has changed + input_value = in_new; + ASSERT(TREE_CHAIN(arg) != NULL_TREE); + ASSERT(TREE_CODE(TREE_CHAIN(arg)) == TREE_LIST); + control_value = GATE_IN(TREE_CHAIN(arg)); + } else { // control input has changed + control_value = in_new; + ASSERT(GATE_INPUT_LIST(gate) != NULL_TREE); + ASSERT(TREE_CODE(GATE_INPUT_LIST(gate)) == TREE_LIST); + input_value = GATE_IN(GATE_INPUT_LIST(gate)); + } + + + switch (control_value) { + case X: + case Z: + switch (input_value) { + case X: + case ONE: + case ZERO: + out_new = X; + break; + case Z: + out_new = Z; + break; + default: + ASSERT(FALSE); + } + break; + case ZERO: + out_new = Z; + break; + case ONE: + out_new = input_value; + break; + default: + ASSERT(FALSE); + } + + if (out_new != out_old + || (out_new == X && arg == GATE_INPUT_LIST(gate))) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * rpmos_exec + * - execution routine for rpmos gates + * + *********************************************************************** + */ + +void rpmos_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + enum logical_value control_value, input_value; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* check if this is a control input */ + + if (GATE_INPUT_LIST(gate) == arg) { // data input has changed + input_value = in_new; + ASSERT(TREE_CHAIN(arg) != NULL_TREE); + ASSERT(TREE_CODE(TREE_CHAIN(arg)) == TREE_LIST); + control_value = GATE_IN(TREE_CHAIN(arg)); + } else { // control input has changed + control_value = in_new; + ASSERT(GATE_INPUT_LIST(gate) != NULL_TREE); + ASSERT(TREE_CODE(GATE_INPUT_LIST(gate)) == TREE_LIST); + input_value = GATE_IN(GATE_INPUT_LIST(gate)); + } + + + switch (control_value) { + case X: + case Z: + switch (input_value) { + case X: + case ONE: + case ZERO: + out_new = X; + break; + case Z: + out_new = Z; + break; + default: + ASSERT(FALSE); + } + break; + case ONE: + out_new = Z; + break; + case ZERO: + out_new = input_value; + break; + default: + ASSERT(FALSE); + } + + if (out_new != out_old + || (out_new == X && arg == GATE_INPUT_LIST(gate))) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * rnmos_exec + * - execution routine for rnmos gates + * + *********************************************************************** + */ + +void rnmos_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + enum logical_value control_value, input_value; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* check if this is a control input */ + + if (GATE_INPUT_LIST(gate) == arg) { // data input has changed + input_value = in_new; + ASSERT(TREE_CHAIN(arg) != NULL_TREE); + ASSERT(TREE_CODE(TREE_CHAIN(arg)) == TREE_LIST); + control_value = GATE_IN(TREE_CHAIN(arg)); + } else { // control input has changed + control_value = in_new; + ASSERT(GATE_INPUT_LIST(gate) != NULL_TREE); + ASSERT(TREE_CODE(GATE_INPUT_LIST(gate)) == TREE_LIST); + input_value = GATE_IN(GATE_INPUT_LIST(gate)); + } + + + switch (control_value) { + case X: + case Z: + switch (input_value) { + case X: + case ONE: + case ZERO: + out_new = X; + break; + case Z: + out_new = Z; + break; + default: + ASSERT(FALSE); + } + break; + case ZERO: + out_new = Z; + break; + case ONE: + out_new = input_value; + break; + default: + ASSERT(FALSE); + } + + if (out_new != out_old + || (out_new == X && arg == GATE_INPUT_LIST(gate))) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * cmos_exec + * - execution routine for cmos gates + * + *********************************************************************** + */ + +void cmos_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + tree arg1; + tree arg2; + enum logical_value in_new, in_old, out_new, out_old; + enum logical_value control1_value, control2_value, input_value; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + ASSERT(GATE_INPUT_LIST(gate)); + input_value = GATE_IN(GATE_INPUT_LIST(gate)); + arg1 = TREE_CHAIN(GATE_INPUT_LIST(gate)); + ASSERT(arg1 != NULL_TREE); + ASSERT(TREE_CODE(arg1) == TREE_LIST); + control1_value = GATE_IN(arg1); + arg2 = TREE_CHAIN(arg1); + ASSERT(arg2 != NULL_TREE); + ASSERT(TREE_CODE(arg2) == TREE_LIST); + control2_value = GATE_IN(arg2); + + switch (input_value) { + case X: + if (control1_value == ZERO && control2_value == ONE) { + out_new = Z; + } else { + out_new = X; + } + break; + case ZERO: + if (control1_value != ONE && control2_value != ZERO) { + if (control1_value == ZERO && control2_value == ONE) { + out_new = Z; + } else { + out_new = X; + } + } else { + out_new = ZERO; + } + break; + case ONE: + if (control1_value != ONE && control2_value != ZERO) { + if (control1_value == ZERO && control2_value == ONE) { + out_new = Z; + } else { + out_new = X; + } + } else { + out_new = ONE; + } + break; + case Z: + out_new = Z; + break; + default: + ASSERT(FALSE); + } + + if (out_new != out_old + || (out_new == X && arg == GATE_INPUT_LIST(gate))) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * rcmos_exec + * - execution routine for rcmos gates + * + *********************************************************************** + */ + +void rcmos_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + tree arg1; + tree arg2; + enum logical_value in_new, in_old, out_new, out_old; + enum logical_value control1_value, control2_value, input_value; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* check if this is a control input */ + + ASSERT(GATE_INPUT_LIST(gate)); + input_value = GATE_IN(GATE_INPUT_LIST(gate)); + arg1 = TREE_CHAIN(GATE_INPUT_LIST(gate)); + ASSERT(arg1 != NULL_TREE); + ASSERT(TREE_CODE(arg1) == TREE_LIST); + control1_value = GATE_IN(arg1); + arg2 = TREE_CHAIN(arg1); + ASSERT(arg2 != NULL_TREE); + ASSERT(TREE_CODE(arg2) == TREE_LIST); + control2_value = GATE_IN(arg2); + + switch (input_value) { + case X: + if (control1_value == ZERO && control2_value == ONE) { + out_new = Z; + } else { + out_new = X; + } + break; + case ZERO: + if (control1_value != ONE && control2_value != ZERO) { + if (control1_value == ZERO && control2_value == ONE) { + out_new = Z; + } else { + out_new = X; + } + } else { + out_new = ZERO; + } + break; + case ONE: + if (control1_value != ONE && control2_value != ZERO) { + if (control1_value == ZERO && control2_value == ONE) { + out_new = Z; + } else { + out_new = X; + } + } else { + out_new = ONE; + } + break; + case Z: + out_new = Z; + break; + default: + ASSERT(FALSE); + } + + if (out_new != out_old + || (out_new == X && arg == GATE_INPUT_LIST(gate))) { + delay_t delay; + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * tranif0_exec + * - execution routine for tranif0 gates + * + *********************************************************************** + */ + +void tranif0_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* not a control input, schedule immediately if gate is enabled */ + + if (TREE_CHAIN(arg) != NULL_TREE) { + if (GATE_CONTROL(gate) == ONE) { + ScheduleGate(gate, 0); + } + return; + } + + /* a control input has changed nets must be reevaluated */ + + if (in_new == ZERO) { + GATE_CONTROL(gate) = ONE; + } else { + GATE_CONTROL(gate) = ZERO; + } + + { + delay_t delay; + + // no delay if data input has changed + + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * rtranif0_exec + * - execution routine for rtranif0 gates + * + *********************************************************************** + */ + +void rtranif0_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* not a control input, schedule immediately if gate is enabled */ + + if (TREE_CHAIN(arg) != NULL_TREE) { + if (GATE_CONTROL(gate) == ONE) { + ScheduleGate(gate, 0); + } + return; + } + + /* a control input has changed nets must be reevaluated */ + + if (in_new == ZERO) { + GATE_CONTROL(gate) = ONE; + } else { + GATE_CONTROL(gate) = ZERO; + } + + { + delay_t delay; + + // no delay if data input has changed + + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * tranif1_exec + * - execution routine for tranif1 gates + * + *********************************************************************** + */ + +void tranif1_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* not a control input, schedule immediately if gate is enabled */ + + if (TREE_CHAIN(arg) != NULL_TREE) { + if (GATE_CONTROL(gate) == ONE) { + ScheduleGate(gate, 0); + } + return; + } + + /* a control input has changed nets must be reevaluated */ + + if (in_new == ONE) { + GATE_CONTROL(gate) = ONE; + } else { + GATE_CONTROL(gate) = ZERO; + } + + { + delay_t delay; + + // no delay if data input has changed + + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * rtranif1_exec + * - execution routine for rtranif1 gates + * + *********************************************************************** + */ + +void rtranif1_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* not a control input, schedule immediately if gate is enabled */ + + if (TREE_CHAIN(arg) != NULL_TREE) { + if (GATE_CONTROL(gate) == ONE) { + ScheduleGate(gate, 0); + } + return; + } + + /* a control input has changed nets must be reevaluated */ + + if (in_new == ONE) { + GATE_CONTROL(gate) = ONE; + } else { + GATE_CONTROL(gate) = ZERO; + } + + { + delay_t delay; + + // no delay if data input has changed + + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/*********************************************************************** + * + * tran_exec + * - execution routine for tran gates + * + *********************************************************************** + */ + +void tran_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* always schedule immediately */ + + ScheduleGate(gate, 0); +} + +/*********************************************************************** + * + * rtran_exec + * - execution routine for rtran gates + * + *********************************************************************** + */ + +void rtran_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old; + nbits_t nbits; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + ASSERT(TREE_CODE(arg) == TREE_LIST); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbits); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* always schedule immediately */ + + ScheduleGate(gate, 0); +} + +/*********************************************************************** + * + * handle_gate + * - gate is ready to execute + * + *********************************************************************** + */ +/* MOVE TO EXEC to handle trace +void handle_gate(tree gate) +{ + + + ASSERT( gate!=NULL_TREE ); + ASSERT( TREE_CODE(gate)==GATE_INSTANCE ); + + + if( GATE_PATH_OUTPUT(gate)!=NULL_TREE ) { + if( handle_specify_path(gate) ) { + return; + } + } + (*GATE_PROPAGATE_ROUTINE(gate))( gate ); +} +*/ +/*********************************************************************** + * + * propagate_specify_output + * - pass unidirectional gate output to rest of the world + * + *********************************************************************** + */ + +void propagate_specify_output(tree gate, enum logical_value v) +{ + Group *g1; + tree port; + tree t; + + + ASSERT(gate != NULL_TREE); + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + ASSERT(GATE_OUTPUT_LIST(gate) != NULL_TREE); + + for (t = GATE_OUTPUT_LIST(gate); t; t = TREE_CHAIN(t)) { + ASSERT(TREE_CODE(t) == TREE_LIST); + g1 = *R++; + switch (v) { + case ONE: + AVAL(g1) = 1; + BVAL(g1) = 0; + break; + + case ZERO: + AVAL(g1) = 0; + BVAL(g1) = 0; + break; + + case X: + AVAL(g1) = 1; + BVAL(g1) = 1; + break; + + case Z: + AVAL(g1) = 0; + BVAL(g1) = 1; + break; + + default: + ASSERT(FALSE); + } + + port = TREE_PURPOSE(t); + ASSERT(port != NULL_TREE); +// ASSERT( TREE_CODE(port)==NET_SCALAR_DECL ); + store(port, gate); + } +} + +/*********************************************************************** + * + * propagate_unigate_output + * - pass unidirectional gate output to rest of the world + * + *********************************************************************** + */ + +void propagate_unigate_output(tree gate) +{ + Group *g1; + tree port; + tree t; + enum logical_value v; + + + ASSERT(gate != NULL_TREE); + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + ASSERT(GATE_OUTPUT_LIST(gate) != NULL_TREE); + v = GATE_OUTPUT(gate); + + for (t = GATE_OUTPUT_LIST(gate); t; t = TREE_CHAIN(t)) { + ASSERT(TREE_CODE(t) == TREE_LIST); + g1 = *R++; + switch (v) { + case ONE: + AVAL(g1) = 1; + BVAL(g1) = 0; + break; + + case ZERO: + AVAL(g1) = 0; + BVAL(g1) = 0; + break; + + case X: + AVAL(g1) = 1; + BVAL(g1) = 1; + break; + + case Z: + AVAL(g1) = 0; + BVAL(g1) = 1; + break; + + default: + ASSERT(FALSE); + } + + port = TREE_PURPOSE(t); + ASSERT(port != NULL_TREE); +// ASSERT( TREE_CODE(port)==NET_SCALAR_DECL ); + store(port, gate); + } +} + +/*********************************************************************** + * + * propagate_bigate_output + * - pass bidirectional gate output to rest of the world + * + *********************************************************************** + */ + +void propagate_bigate_output(tree gate) +{ + tree port1_in; + tree port1_out; + tree port2_in; + tree port2_out; + tree t_in; + tree t_out; + Group *g1; + + + ASSERT(gate != NULL_TREE); + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + + t_in = GATE_INPUT_LIST(gate); + t_out = GATE_OUTPUT_LIST(gate); + ASSERT(t_in != NULL_TREE); + ASSERT(t_out != NULL_TREE); + port2_out = TREE_PURPOSE(t_out); + port1_in = TREE_PURPOSE(t_in); + t_in = TREE_CHAIN(t_in); + t_out = TREE_CHAIN(t_out); + ASSERT(t_in != NULL_TREE); + ASSERT(t_out != NULL_TREE); + port1_out = TREE_PURPOSE(t_out); + port2_in = TREE_PURPOSE(t_in); + ASSERT(port1_in != NULL_TREE); + ASSERT(TREE_CODE(port1_in) == NET_SCALAR_DECL); + ASSERT(port2_in != NULL_TREE); + ASSERT(TREE_CODE(port2_in) == NET_SCALAR_DECL); + ASSERT(port1_out != NULL_TREE); + ASSERT(TREE_CODE(port1_out) == NET_SCALAR_DECL); + ASSERT(port2_out != NULL_TREE); + ASSERT(TREE_CODE(port2_out) == NET_SCALAR_DECL); + + if (GATE_CONTROL(gate) == ONE) { + do_net_eval(TREE_CHAIN(port1_out), 0, port1_out); + } else { + g1 = *R++; + AVAL(g1) = 0; + BVAL(g1) = 1; + } + store(port2_out, gate); + + if (GATE_CONTROL(gate) == ONE) { + do_net_eval(TREE_CHAIN(port2_out), 0, port2_out); + } else { + g1 = *R++; + AVAL(g1) = 0; + BVAL(g1) = 1; + } + store(port1_out, gate); +} diff --git a/src/gates.h b/src/gates.h new file mode 100644 index 0000000..191ee14 --- /dev/null +++ b/src/gates.h @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/******************************************************************* + * + * gates.h + * - header file for gates.c + * + * + ******************************************************************* + */ + +#ifndef GATES_H +#define GATES_H + + +#define VAL_TO_STATE(g) ((enum logical_value)(((BVAL (g) & 1) << 1) | (AVAL (g) & 1))) + +enum gate_style { + PRIM_LOGIC = 1, + PRIM_BUF, + PRIM_TRI, + PRIM_CMOS, + PRIM_TRAN, + PRIM_PULL +}; + +tree build_gate_instance(enum tree_type type, char *filename, + lineno_t lineno, tree ident, tree arg_list, + tree delay, tree udp_def); +void initialize_gates(void); +void gate_check_delay(tree gate, unsigned int max_delays); +int gate_ok_input(tree port); +int gate_ok_output(tree port); +tree next_gate_port(tree gate, tree * port_list); +void gate_check_ports(tree gate, enum gate_style style); +void pass3_gate(tree gate); +void handle_gate(tree gate); +void propagate_unigate_output(tree gate); +void propagate_bigate_output(tree gate); +void propagate_specify_output(tree gate, enum logical_value v); +void propagate_pull_output(tree gate); + + +#endif // GATES_H diff --git a/src/glue.cc b/src/glue.cc new file mode 100644 index 0000000..7df5b60 --- /dev/null +++ b/src/glue.cc @@ -0,0 +1,258 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* GLUE.C - Dummy stubs for easy interface into other environments */ + +/****************************************************************************** + Glue.c + + This file contains dummy stubs for the glue routines to interface the shell + to the back end. + + + ******************************************************************************/ + +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "glue.h" +#include +#include +#include +#include "copy.h" +#include "eval.h" +#include "exec.h" +#include "lex.h" +#include "macro.h" +#include "multdiv.h" +#include "acc_user.h" +#include "pli.h" +#include "schedule.h" +#include "pass3.h" +#include "pass2.h" +#include "print.h" +#include "scope.h" +#include "store.h" +#include "strobe.h" +#include "systask.h" +#include "timescal.h" +#include "trace.h" +#include "udp.h" +#include "check.h" +#include "decl.h" +#include "flags.h" +#include "io.h" +#include "parse.h" +#include "dumpvar.h" +#include "verisys.h" +#include "veriwell.h" +#include "nsched.h" +#include "usertask.h" + + + + + +File *File::stdin_ = new File(stdin); +static long totalAllocated; + +typedef struct mem_header_tag { + struct mem_header_tag *next; + struct mem_header_tag *prev; + unsigned long size; + char signature[4]; +} MemHeader, *MemHeaderPtr; + +MemHeader memList; +/****************************************************************************** + shellinit + + This routine will setup the inteface between the shell and the back end. + + + ******************************************************************************/ + +void shellinit() +{ + totalAllocated = 0; + memList.next = &memList; + memList.prev = &memList; +} + +/****************************************************************************** + shell_fopen + + This is the emulation routine for openning a file using the search list. + + + ******************************************************************************/ +FILE *shell_fopen(char *name, char *mode) +{ + return (fopen(name, mode)); +} + +/****************************************************************************** + shell_close + + This is the emulation routine for a file. + + + ******************************************************************************/ +void shell_fclose(FILE * file) +{ +#undef fclose + fclose(file); +} + +/****************************************************************************** + shell_exit + + extended exit handler + + + ******************************************************************************/ +void shell_exit(int reason) +{ + exit(reason); +} + +/****************************************************************************** + shell_abort + + Extended abort handler + + + ******************************************************************************/ +void shell_abort(void) +{ + abort(); +} + +/****************************************************************************** + main + + This routine will be called to start the back end. + + + ******************************************************************************/ + +int main(int argc, char **argv) +{ + // initialize verwell module in case of reentry + + shellinit(); + init_check(); + init_copy(); + init_decl(); + init_flags(); + init_io(); + init_macro_1(); + init_print(); + init_sched(); + init_tree_1(); + init_parse(); + init_eval(); + init_pass3(); + init_exec(); + init_store(); + init_lex_1(); + init_pass2(); + Usertask_Init(argc, argv); + init_systask_1(); + init_verilog(); + init_trace(); + init_multdiv(); + init_dumpvar(); + init_strobe(); + init_scope(); + init_udp(); + init_timescale(); + InitNSched(); + init_verisys(); + init_pli(); + __main_v(argc, argv); +} + + +/****************************************************************************** + shell_process + + This routine is called periodically to give the shell time. + + + ******************************************************************************/ +void shell_process() +{ + ftell(stdin); +} + +/****************************************************************************** + shell_signal + + This routine intervenes in signal handling. + + + ******************************************************************************/ +sig_handler shell_signal(int sig, void (*func) (int)) +{ + return (signal(sig, func)); +} + +int shell_getchar(void) +{ +#undef getchar + return (getchar()); +} + +int shell_vprintf(const char *format, va_list argptr) +{ +#undef vprintf + return (vprintf(format, argptr)); +} + +int shell_vfprintf(FILE * fp, const char *format, va_list argptr) +{ +#undef vfprintf + return (vfprintf(fp, format, argptr)); +} + +void shell_ungetc(int c, FILE * f) +{ +#undef ungetc + ungetc(c, f); +} + +void shell_fflush(FILE * f) +{ +#undef fflush + fflush(f); +} + +int shell_printf(const char *fmt, ...) +{ + va_list args; + int result; + +#undef vprintf + va_start(args, fmt); + result = vprintf(fmt, args); + va_end(args); + return (result); +} diff --git a/src/glue.h b/src/glue.h new file mode 100644 index 0000000..9c90b9a --- /dev/null +++ b/src/glue.h @@ -0,0 +1,171 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/****************************************************************************** + Glue.hpp + + This file contains the headers for glue routines to interface the shell + to the back end. + + + ******************************************************************************/ + +#ifndef GLUE_H +#define GLUE_H + +#include +#include +#include +#include +#include +#include "vtypes.h" + +#ifndef HAVE_VFSCANF +extern "C" int vfscanf( FILE*, char*, ... ); +#endif + +BEGIN_C_DECLS + + typedef void (*sig_handler) (int); + + FILE *shell_fopen(char *name, char *mode); + void shell_abort(void); + void shell_exit(int status); + void shell_process(void); + sig_handler shell_signal(int sig, sig_handler func); + void shell_assert(char *file, int line); + void shell_fclose(FILE * file); + int shell_getchar(void); + int shell_printf(const char *format, ...); + int shell_vprintf(const char *format, va_list argptr); + int shell_vfprintf(FILE * fp, const char *format, va_list argptr); + void shell_ungetc(int c, FILE * f); + void GetProgramPath(char *string); + void SetProgramPath(); + FILE *shell_fopenbuf(char *buffer, int len); + void shell_fflush(FILE * f); + + + +END_C_DECLS + +void error(char *s, char *v, char *v2); +void printf_V_key(char *, ...); +char *xmalloc(unsigned); +/* + * file class + */ +class File { + FILE *f; + int isBuffer; + int len; + char *buffer; + int offset; + int own; + public: + static File *stdin_; + File(FILE * f):f(f), isBuffer(0), buffer(0), len(0), offset(0), own(0) { + } File(char *buffer, int len, int own = 0):f(0), isBuffer(1), + buffer(buffer), len(len), offset(0), + own(own) { + } + static File *fopen(char *name, char *mode) { + FILE* fin = shell_fopen(name, mode); + if( !fin ) { + return NULL; + } + return new File(fin); + } + static File* Stdin() { return stdin_; } + void fclose() { + if (!isBuffer) { + shell_fclose(f); + } else if (own) { + free(buffer); + } + delete this; + } + int isatty() { + return !isBuffer &&::isatty(fileno(f)); + } + static File *fopenbuf(char *buffer, int len) { + return new File(buffer, len); + } + int fgetc() { + int result = EOF; + if (isBuffer) { + if (offset < len) { + result = buffer[offset++]; + } + } else { + result = getc(f); + } + return result; + } + int fscanf(char *format, ...) { + int result; + va_list args; + va_start(args, format); + if (isBuffer) { + /* fscanf not support on in memory buffers */ + error("Internal error", NULL, NULL); + result = 0; + } else { + result = vfscanf(f, format, args); + } + va_end(args); + return result; + } + int fungetc(int c) { + if (isBuffer) { + if (offset != 0 && c != EOF) { + buffer[--offset] = c; + return c; + } else { + return EOF; + } + } else { + return ungetc(c, f); + } + } + char *fgets(char *s, int size) { + if (isBuffer) { + int i; + for (i = 0; i < size - 1; ++i) { + s[i] = fgetc(); + if (s[i] == EOF) { + if (i == 0) { + return NULL; + } else { + break; + } + } else if (s[i] == '\n') { + i++; + break; + } + } + s[i] = 0; + return s; + } else { + return::fgets(s, size, f); + } + } +}; + +#endif // GLUE_H diff --git a/src/io.cc b/src/io.cc new file mode 100644 index 0000000..e9d7ab2 --- /dev/null +++ b/src/io.cc @@ -0,0 +1,304 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* IO.C - Compiler-dependent input/output routines */ + +/* fbufopen "opens" a buffer so that getc will read from it as if it + were a file */ + +#define IO_C + +#include +#include +#include +#include +#include +#include +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "macro.h" +#include "io.h" +#include "glue.h" +#include "lex.h" +#include "veriwell.h" + +File *fin; /* current input file */ +char *input_filename; +char *filename; + +int global_print_override; +char *global_print_buffer; +char *global_print_p; + +FILE *log_file; +FILE *key_file; +char *log_file_name; +char *key_file_name; +int log_enable = 1; +int log_available = 0; +int key_enable = 1; +int key_available = 0; + +LibPath_t *ypathList; +char *ylibext; +char *incdir; + +FILE *file_handles[NHANDLES]; +int file_used[NHANDLES]; +char print_buffer[2000]; + + +void fclose_V(handle_t handle) +{ + int i; + handle_t tmp_handle; + + if (handle & 1) + warning("Cannot close standard output", NULL_CHAR, NULL_CHAR); + + if (handle - 1) { + tmp_handle = handle >> 1; + for (i = 0; i < NHANDLES; i++) + if (tmp_handle >> i & 1) { + fclose(file_handles[i]); + file_used[i] = 0; + } + } +} + +/* Open a file, assign one of 31 bits to the handle of the file */ + +handle_t fopen_V(char *file) +{ + int i; + FILE *f_handle; + + /* find an available handle */ + for (i = 0; i < NHANDLES; i++) + if (!file_used[i]) + break; + if (i >= NHANDLES) { + warning("Exeeded limit on number of open files", NULL_CHAR, + NULL_CHAR); + return 0; + } + f_handle = shell_fopen(file, "w+t"); + if (!f_handle) { + warning("Cannot open file '%s'", file, NULL_CHAR); + return 0; + } + file_handles[i] = f_handle; + file_used[i] = 1; + return 1 << (i + 1); +} + +/* Given a handle, test to make sure each handle is valid; filter + out invalid handles and give warnings if necessary */ + +handle_t check_handle(handle_t handle) +{ + int i; + handle_t tmp_handle; + + /* Only check for file handles */ + if (handle - 1) { + tmp_handle = handle >> 1; + for (i = 0; i < NHANDLES; i++) + if (tmp_handle >> i & 1) + if (!file_used[i]) { + warning("File not open", NULL_CHAR, NULL_CHAR); + handle &= ~((handle_t) 1 << (i + 1)); + } + } + return handle; +} + +void fflush_V(handle_t handle) +{ + int i; + handle_t tmp_handle; + + /* First, flush stdout (and log file) */ + if (handle & 1) { + fflush(stdout); + if (log_enable) + fflush(log_file); + } + /* If there is some file output, flush it */ + if (handle - 1) { + tmp_handle = handle >> 1; + for (i = 0; i < NHANDLES; i++) + if (tmp_handle >> i & 1) + if (file_used[i]) + fflush(file_handles[i]); + else + warning("File not open", NULL_CHAR, NULL_CHAR); + } +} + +void vfprintf_V(handle_t handle, char *fmt, va_list args) +{ + int i; + handle_t tmp_handle; + + if (global_print_override) { + /* Watcom chokes on this... */ + global_print_p += vsprintf(global_print_p, fmt, args); + return; + } + + /* Do this because some compilers (and ANSI?) don't like to use "args" + more than once */ + + vsprintf(print_buffer, fmt, args); + + /* First, do output to stdout (and to log file) */ + if (handle & 1) { + printf(print_buffer); + if (log_enable) + fprintf(log_file, print_buffer); + } + /* If there is some file output to do, do it */ + if (handle - 1) { + tmp_handle = handle >> 1; + for (i = 0; i < NHANDLES; i++) + if (tmp_handle >> i & 1) + if (file_used[i]) + fprintf(file_handles[i], print_buffer); + else + warning("File not open", NULL_CHAR, NULL_CHAR); + } +} + +void fprintf_V(handle_t handle, char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + vfprintf_V(handle, fmt, args); + va_end(args); +} + +void vprintf_V(char *fmt, va_list args) +{ + if (global_print_override) { + global_print_p += vsprintf(global_print_p, fmt, args); + return; + } else + /* Do this because some compilers (and ANSI?) don't like to use "args" + more than once */ + + vsprintf(print_buffer, fmt, args); + + printf(print_buffer); + + if (log_enable) + fprintf(log_file, print_buffer); +} + +void printf_V(char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + vprintf_V(fmt, args); + va_end(args); +} + +void vprintf_V_log(char *fmt, va_list args) +{ + + vsprintf(print_buffer, fmt, args); + + if (log_enable) + fprintf(log_file, print_buffer); +} + +void printf_V_log(char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + vprintf_V_log(fmt, args); + va_end(args); +} + +void printf_error_V(char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); + if (log_enable) { + va_start(args, fmt); + vfprintf(log_file, fmt, args); + va_end(args); + } +} + +void printf_V_key(char *fmt, ...) +{ + va_list args; + + if (!fin->isatty()) { + va_start(args, fmt); + vprintf(fmt, args); + va_end(args); + } + if (log_enable) { + va_start(args, fmt); + vfprintf(log_file, fmt, args); + va_end(args); + } + if (key_enable) { + va_start(args, fmt); + vfprintf(key_file, fmt, args); + va_end(args); + } +} + +void init_io() +{ + incdir = xmalloc(1); + incdir[0] = 0; + log_enable = 0; + log_available = 0; + key_enable = 0; + key_available = 0; + global_print_override = 0; + global_print_buffer = 0; + global_print_p = 0; + ypathList = (LibPath_t *) malloc(sizeof(LibPath_t)); + ypathList->path = "."; + ypathList->next = NULL; + + memset(&fin, 0, sizeof(fin)); + memset(&input_filename, 0, sizeof(input_filename)); + memset(&filename, 0, sizeof(filename)); + memset(&log_file, 0, sizeof(log_file)); + memset(&key_file, 0, sizeof(key_file)); + memset(&log_file_name, 0, sizeof(log_file_name)); + memset(&file_handles, 0, sizeof(file_handles)); + memset(&file_used, 0, sizeof(file_used)); + memset(&ylibext, 0, sizeof(ylibext)); + +} diff --git a/src/io.h b/src/io.h new file mode 100644 index 0000000..96cc22f --- /dev/null +++ b/src/io.h @@ -0,0 +1,90 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* IO.H - IO prototypes */ + +#ifndef IO_H +#define IO_H + +#include + +// public methods + +/* + * LibPath_t + * - structure to maintain linked list of library paths + */ + +typedef struct LibPath_t { + struct LibPath_t *next; + char *path; +} LibPath_t; + + +#define NHANDLES 31 +//static FILE *file_handles [NHANDLES]; +//static int file_used [NHANDLES]; + +void printf_V_log(char *, ...); +void printf_V(char *, ...); +void printf_error_V(char *, ...); +void printf_V_key(char *, ...); +void fprintf_V(handle_t, char *, ...); +//void vprintf_V (char *, void *); +//void vfprintf_V (handle_t, char *, void *); +void vprintf_V_log(char *, va_list); +void vprintf_V(char *, va_list); +void vfprintf_V(handle_t, char *, va_list); +handle_t fopen_V(char *); +handle_t check_handle(handle_t); +void fclose_V(handle_t); +//tree check_library (char *, int); +void fflush_V(handle_t); + +FILE *fopenbuf(char *, int); + +void init_io(void); +//tree check_library (char *name, int numargs); + +class File; +extern File *fin; +extern char *input_filename; +extern char *filename; + +extern FILE *log_file; +extern FILE *key_file; +extern char *log_file_name; +extern char *key_file_name; +extern int log_enable; +extern int log_available; +extern int key_enable; +extern int key_available; +extern char *ypath; +extern char *ylibext; +extern char *incdir; +extern int global_print_override; +extern char *global_print_buffer; +extern char *global_print_p; + +// private methods + +#ifdef IO_C +#endif //IO_C + +#endif //IO_H diff --git a/src/lex.cc b/src/lex.cc new file mode 100644 index 0000000..2bfce9e --- /dev/null +++ b/src/lex.cc @@ -0,0 +1,1371 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* LEX.C - Read tokens for Verilog grammer */ + +#define LEX_C + +#include +#include +#include +#include +#include + +#include "vtypes.h" +#include "tree.h" + +#include "parse.h" +#include "macro.h" +#include "glue.h" +#include "lex.h" +#include "veriwell.h" +#include "timescal.h" +#include "exec.h" +#include "io.h" + +#define follow(EXPECT, YES, NO) \ + (nextchar == EXPECT) ? \ + (token_buffer[2] = '\0', nextchar = -1, YES) : \ + (token_buffer[1] = '\0', NO) + +#define eatline(c) while (c != '\n' && c != EOF) c = fin->fgetc() + +//extern void * xmalloc(); +//extern void * xrealloc(); + +void yyerror(); +void parse_base_const1(enum radii, char *, nbits_t, nbits_t, tree); +int yylex(YYSTYPE *); +lineno_t lineno; +lineno_t stmt_lineno; +lineno_t keywd_lineno; +static int maxtoken; /* the current length of token buffer */ +char *token_buffer; /* the actual token buffer */ +int enable_edge_digit; +int enable_udp_parse; + + +static int nextchar = -1; +int is_interactive = 0; + +int second_eof = 0; /* Send EOF twice: 1st as token, 2nd as 0 */ + +// Bit value, *v = &value; +int i; + +File *fin__; /* temp for debugging */ + + +#include "v.h" + +/* let syntax coloring tap into lexer */ +int IsReservedWord(char *string, int len) +{ + struct keywords *ptr; + char buffer[32]; + + if (len > sizeof(buffer) - 1) { + return (FALSE); + } + strncpy(buffer, string, len); + buffer[len] = 0; + ptr = (struct keywords *) Perfect_Hash::is_reserved_word(buffer, len); + return (ptr != NULL); +} + +/* Make the token buffer longer, preserving the data in it. + P should point to just beyond the last valid character in the old buffer. + The value we return is a pointer to the new buffer + at a place corresponding to P. */ + +void init_lex() +{ + lineno = 1; + nextchar = -1; + maxtoken = 40; + token_buffer = (char *) xmalloc(maxtoken + 2); + enable_edge_digit = FALSE; + enable_udp_parse = FALSE; +} + +void reinit_lex() +{ + nextchar = -1; +} + +int convert_edge_digit(int c) +{ + ASSERT(X >= 0 && Z >= 0 && ZERO >= 0 && ONE >= 0); + switch (c) { + case 'x': + case 'X': + return (X); + case '0': + return (ZERO); + case '1': + return (ONE); + } + return (-1); +} + +static char *extend_token_buffer(char *p) +{ + int offset = p - token_buffer; + + maxtoken = maxtoken * 2 + 10; + token_buffer = (char *) xrealloc(token_buffer, maxtoken + 2); + + return token_buffer + offset; +} + +void eatnum(void) +{ + char c; + for (c = fin->fgetc(); isalnum(c); c = fin->fgetc()); + fin->fungetc(c); +} + +static char *p; + +/* Read a macro name for `define and `ifdef; report error if necessary */ + +static void read_macro_name() +{ + int c; + c = fin->fgetc(); + p = token_buffer; +// c = skip_white_space (getc (fin)); + +/* Read the rest of the line */ + + for (; c == ' ' || c == '\t'; c = fin->fgetc()); + + if (c == '\n') { + error("Missing macro name in compiler directive", NULL_CHAR, + NULL_CHAR); + nextchar = c; + } + + if (isalnum(c) || c == '_' || c == '$') { + do { + if (p >= token_buffer + maxtoken - 1) + p = extend_token_buffer(p); + *p++ = c; + c = fin->fgetc(); + } + while (isalnum(c) || c == '_' || c == '$'); + + *p = 0; + fin->fungetc(c); + } else { + yyerror("Illegal macro name"); + eatline(c); + nextchar = c; + return; + } +} + +static int if_nesting_level = 0; +//static int if_enable_level = 0; +static int if_disable_level = 0; +//static int if_enable = 1; + +/* Return zero if lex should just return after processing macro + (in most cases, lex shoudl read another token before going back to + the parser) +*/ + +static int compiler_directive_or_macro(char *token) +{ + char c; + tree macro_name_node; + tree macro_string_node; + YYSTYPE yyval; + int depth; + int commentCount; + + if (strcmp(token, "ifdef") == 0) { + if_nesting_level++; + if (if_disable_level) { + if_disable_level++; + return 1; + } + + read_macro_name(); + + if (!lookup_macro(token_buffer)) { + if_disable_level = 1; /* doesn't exist, eat until `else or `endif */ + for (yylex(&yyval); if_disable_level; yylex(&yyval)); + } + } + + else if (strcmp(token, "endif") == 0) { + if (!if_nesting_level) { + error("Unbalanced ifdef/endif pairs", NULL_CHAR, NULL_CHAR); + return 0; + } + + --if_nesting_level; + if (if_disable_level) { + --if_disable_level; + if (!if_disable_level) + return 0; /* Fprce lex to return */ + } +// eatline(c); +// nextchar = c; + + } + + else if (strcmp(token, "else") == 0) { + if (!if_nesting_level) + error("`else not paired with `ifdef", NULL_CHAR, NULL_CHAR); + /* currently enabled, now disable */ + else if (!if_disable_level) { + if_disable_level = 1; + for (yylex(&yyval); if_disable_level; yylex(&yyval)); + } + /* currently disabled at one level; enable */ + else if (if_disable_level == 1) { + if_disable_level = 0; + return 0; + } +// eatline(c); +// nextchar = c; + } else if (if_disable_level) + return 1; + +/* `define: Process the macro directive */ + else if (strcmp(token, "undef") == 0) { + read_macro_name(); + delete_macro(strlen(token_buffer), token_buffer); + } else if (strcmp(token, "define") == 0) { + read_macro_name(); + + macro_name_node = build_string(strlen(token_buffer), token_buffer); + + p = token_buffer; +// c = skip_white_space (c); + +/* Read the rest of the line */ + + for (c = fin->fgetc(); c == ' ' || c == '\t'; c = fin->fgetc()); + +// elliot: defines containing other definitions don't work +// this is my attempt to fix +// for (*p = c; *p != '\n' && *p != EOF; *p = getc (fin)) +// if (p++ >= token_buffer + maxtoken - 1) +// p = extend_token_buffer (p); + + depth = 0; + commentCount = 0; + for (*p = c; *p != '\n' && (depth != 0 || *p != EOF); + *p = fin->fgetc()) { + if (*p == EOF) { + depth--; + fin = pop_stream(); + continue; + } else if (commentCount == 2) { + continue; + } else if (*p == '/') { + commentCount++; + if (commentCount == 2) { + p -= 2; + } + } else if (commentCount == 1) { + commentCount = 0; + } + if (*p == '`') { + char *definition = p; + for (*p = fin->fgetc(); + isalnum(*p) || *p == '_' || *p == '$'; + *p = fin->fgetc()) { + if (p++ >= token_buffer + maxtoken - 1) { + p = extend_token_buffer(p); + } + } + fin->fungetc(*p); + *p = 0; + expand_macro(definition); +/*fin__ = fin; */ + depth++; + p = definition; + continue; + } + if (p++ >= token_buffer + maxtoken - 1) { + p = extend_token_buffer(p); + } + } + + nextchar = *p; + *p = 0; + + macro_string_node = + build_string(strlen(token_buffer), token_buffer); + define_macro(macro_name_node, macro_string_node); + + + } + /* end if "define" */ + else if (strcmp(token, "include") == 0) { + c = fin->fgetc(); + p = token_buffer; + c = skip_white_space(fin->fgetc()); + +/* Read the rest of the line */ + + if (c != '"') { + error("String expected after `include", NULL_CHAR, NULL_CHAR); + return 1; + } else { + do { + if (p >= token_buffer + maxtoken - 1) + p = extend_token_buffer(p); + *p++ = c; + c = fin->fgetc(); + } + while (c != EOF && c != '\n' && c != '"'); + + *p = 0; + eatline(c); + lineno++; + + open_include(token_buffer); + + } + } /* end if "include" */ + else if (strcmp(token, "timescale") == 0) { + if (!process_timescale()) + eatline(c); + } + + else if (strcmp(token, "accelerate") == 0 + || strcmp(token, "expand_vectornets") == 0 + || strcmp(token, "noremove_netnames") == 0 + || strcmp(token, "resetall") == 0 + || strcmp(token, "unconnected_drive") == 0 + || strcmp(token, "celldefine") == 0 + || strcmp(token, "endcelldefine") == 0 + || strcmp(token, "noaccelerate") == 0 + || strcmp(token, "nounconnected_drive") == 0 + || strcmp(token, "protect") == 0 + || strcmp(token, "default_nettype") == 0 + || strcmp(token, "endprotect") == 0 + || strcmp(token, "noexpand_vectornets") == 0 + || strcmp(token, "remove_netnames") == 0 + || strcmp(token, "timescale") == 0) { + c = fin->fgetc(); + eatline(c); + nextchar = c; + } +/* It is not a compiler directive, must be a macro */ + else { + expand_macro(token); +/*fin__ = fin;*/ + } + + + return 1; +} + +int read_num_token(char *p) +{ + int numchars; + int c; + + c = skip_white_space(fin->fgetc()); + + for (numchars = 0; isalnum(c) || c == '?' || c == '_'; + c = fin->fgetc()) + if (c != '_') { + if (p >= token_buffer + maxtoken - 3) + p = extend_token_buffer(p); + *p++ = c; + numchars++; + } +// --numchars; + *p = '\0'; +// nextchar = c; + fin->fungetc(c); + nextchar = -1; + + return numchars; +} + +static tree parse_base_const(nbits_t length) +{ + int c; + char *p1; + int offset; + tree t; + nbits_t numchars; + enum radii base; + + HEAPTEST("Heap Corrupted (in Lex 2)"); + *(p + 1) = '\0'; + switch (c = *p++ = fin->fgetc()) { + case 'b': + case 'B': + base = BIN; + break; + case 'h': + case 'H': + base = HEX; + break; + case 'o': + case 'O': + base = OCT; + break; + case 'd': + case 'D': + base = DEC; + break; + default: + { + char c1[2]; + c1[0] = c; + c1[1] = '\0'; + error("Illegal radix ", (char *) c1, NULL_CHAR); + base = HEX; /* read the number anyway */ + } + } + offset = p - token_buffer; /* token_buffer may move if number is large */ + numchars = read_num_token(p); + +// p1 = p - 1; + p1 = token_buffer + offset + numchars - 1; + + t = build_bit_cst(length, base); + + parse_base_const1(base, p1, length, numchars, t); + HEAPTEST("Heap Corrupted (in Lex 1)"); + return t; +} + +void +parse_base_const1(enum radii base, char *p1, nbits_t length, + nbits_t numchars, tree t) +{ + parse_base_const1g(base, p1, length, numchars, BIT_CST_GROUP(t)); +} + +void +parse_base_const1g(enum radii base, char *p1, nbits_t length, + nbits_t numchars, Group * g) +{ + int c, i, numerror, fillchar; + Bit aval, bval, bit_mask; + nbits_t j, numbits; + int start_bit = 0; + int numgroups = bits_to_groups(length) + 1; + int overflow; + int carry; + + numerror = 0; + switch (base) { + case BIN: + if (numchars > length) + warning("Extra digits in binary number", NULL_CHAR, NULL_CHAR); + numbits = min(numchars, length); /* prevents reading too many chars */ + /* i + j is bit offset; j increments by 8, i wraps at 7 */ + for (j = 0; !numerror && j < length; j += sizeof(Bit) * 8) { + aval = 0; + bval = 0; + for (i = 0; !numerror && i < sizeof(Bit) * 8; i++, p1--) { + if (i + j < numbits) /* normal case; read each char in the buffer */ + c = *p1; + else if (i + j < length) /* all chars read, fill to length */ + c = fillchar; + else /* past length, stop doing */ + break; + + switch (c) { + case '0': + fillchar = '0'; + break; + case '1': + aval = aval + ((Bit) 1 << i); + fillchar = '0'; + break; + case 'x': + case 'X': + aval = aval + ((Bit) 1 << i); + bval = bval + ((Bit) 1 << i); + fillchar = 'x'; + break; + case 'z': + case 'Z': + case '?': + bval = bval + ((Bit) 1 << i); + fillchar = 'z'; + break; + default: + yyerror("Illegal digit in binary number"); + numerror = 1; + } + } + HEAPTEST("Heap Corrupted (in Lex 1)"); + AVAL(g) = aval; + BVAL(g) = bval; + HEAPTEST("Heap Corrupted (in Lex 1)"); + g++; + } + break; + + case HEX: + if ((numchars - 1) * 4 >= length) + warning("Extra digits in hexidecimal number", NULL_CHAR, + NULL_CHAR); + numbits = min(numchars * 4, length); /* prevents reading too many chars */ + /* i + j is bit offset; j increments by 8, i wraps at 7 */ + for (j = 0; !numerror && j < length; j += sizeof(Bit) * 8) { + if ((j + (sizeof(Bit) * 8)) > length) + bit_mask = mask_right[length % (sizeof(Bit) * 8)]; + else + bit_mask = (Bit) - 1; + aval = 0; + bval = 0; + for (i = 0; !numerror && i < sizeof(Bit) * 8; i = i + 4, p1--) { + if (i + j < numbits) /* normal case; read each char in the buffer */ + c = *p1; + else if (i + j < length) /* all chars read, fill to length */ + c = fillchar; + else /* past length, stop doing */ + break; + + switch (c) { + case '0': + fillchar = '0'; + break; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + aval = aval + ((c - '0' + (Bit) 0) << i); + fillchar = '0'; + break; + case 'a': + case 'A': + case 'b': + case 'B': + case 'c': + case 'C': + case 'd': + case 'D': + case 'e': + case 'E': + case 'f': + case 'F': + aval = aval + ((toupper(c) - 'A' + (Bit) 10) << i); + fillchar = '0'; + break; + + case 'x': + case 'X': + aval = aval + ((Bit) 15 << i); + bval = bval + ((Bit) 15 << i); + fillchar = 'x'; + break; + case 'z': + case 'Z': + case '?': + bval = bval + ((Bit) 15 << i); + fillchar = 'z'; + break; + default: + yyerror("Illegal digit in hexidecimal number"); + numerror = 1; + } + } + AVAL(g) = aval & bit_mask; + BVAL(g) = bval & bit_mask; + g++; + } + break; + + case OCT: + if ((numchars - 1) * 3 > length) + warning("Extra digits in octal number", NULL_CHAR, NULL_CHAR); + numbits = min(numchars * 3, length); /* prevents reading too many chars */ + start_bit = 0; + /* i + j is bit offset; j increments by 8, i wraps at 7 */ + for (j = 0; !numerror && j < length; j += sizeof(Bit) * 8) { + aval = 0; + bval = 0; + for (i = start_bit; !numerror && i < (signed) sizeof(Bit) * 8; + i = i + 3, p1--) { + if (i + j < numbits) /* normal case; read each char in the buffer */ + c = *p1; + else if (i + j < length) /* all chars read, fill to length */ + c = fillchar; + else /* past length, stop doing */ + break; + + switch (c) { + case '0': + fillchar = '0'; + break; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + if (i >= 0) + aval |= (((Bit) c - '0' + (Bit) 0) << i); + else + aval |= (((Bit) c - '0' + (Bit) 0) >> -i); + fillchar = '0'; + break; + + case 'x': + case 'X': + aval = aval + ((Bit) 7 << i); + bval = bval + ((Bit) 7 << i); + fillchar = 'x'; + break; + case 'z': + case 'Z': + case '?': + bval = bval + ((Bit) 7 << i); + fillchar = 'z'; + break; + default: + error("Illegal digit in octal number: '%c'", + (char *) c, NULL_CHAR); + numerror = 1; + } + } + AVAL(g) = aval; + BVAL(g) = bval; + start_bit = i - BITS_IN_GROUP - 3; + if (start_bit > -3) + p1++; + else + start_bit = 0; + g++; + } + break; + + case DEC: + /* + * clear aval and bval + */ + for (i = 0; i < numgroups; ++i) { + AVAL(g + i) = 0; + BVAL(g + i) = 0; + } + overflow = 0; + carry = 0; + for (i = 0; i < numchars; ++i) { + char c = *p++; + unsigned carry = 0; + unsigned x2l; + unsigned x4l; + unsigned x2h = 0; + unsigned x4h = 0; + if (!isdigit(c)) { + error("Illegal digit in decimal number", NULL_CHAR, + NULL_CHAR); + } + /* + * multiply aval by 10 + */ + for (j = 0; j < numgroups; ++j) { + x2l = (AVAL(g + j) << 1) + x2h; + x4l = (AVAL(g + j) << 3) + x4h; + x2h = AVAL(g + j) >> (32 - 1); + x4h = AVAL(g + j) >> (32 - 3); + AVAL(g + j) = x2l + carry; + if (AVAL(g + j) < carry) { + AVAL(g + j) = x4l; + continue; + } + AVAL(g + j) += x4l; + carry = (AVAL(g + j) < x4l); + } + overflow = (carry != 0) || (x2h != 0) || (x4h != 0); + AVAL(g) += c - '0' + (Bit) 0; + } + if (length % (sizeof(Bit) * 8) == 0) { + bit_mask = ~0; + } else { + bit_mask = mask_right[length % (sizeof(Bit) * 8)]; + } + if (AVAL(g + numgroups - 1) & ~bit_mask) { + overflow = 1; + } + AVAL(g + numgroups - 1) = AVAL(g + numgroups - 1) & bit_mask; + if (overflow) { + warning("Extra digits in decimal number", NULL_CHAR, + NULL_CHAR); + } + break; + } +} + +int yylex(YYSTYPE * lvalp) +{ + int c; + int value; + + start_lex: + HEAPTEST("Heap Corrupted (in Lex)"); + + fin__ = fin; + + + if (nextchar >= 0) + c = nextchar, nextchar = -1; + else { + if (second_eof) { + second_eof = 0; + return 0; + } else if (!fin) + c = EOF; + + else + c = fin->fgetc(); + } + + if (!c) + c = EOF; /* I hate to do this, but CodeWarrior returns + a 0 at the end of a macro forsome reason. */ + + while (1) { +// if (!fin) +// c = EOF; /* gets here if last line doesn't have newline */ + + switch (c) { + case ' ': /* whitespace */ + case '\t': + case '\f': + case '\r': + case '\v': +/* case '\\': */ + case '\b': + c = fin->fgetc(); + break; + + case '\n': /* special whitespace */ + c = skip_white_space(c); + break; + + case '/': /* comments */ + c = skip_white_space(c); + + default: + goto found_nonwhite; + } + } + + found_nonwhite: + + if (enable_edge_digit) { + if (convert_edge_digit(c) >= 0) { + int c1; + + c1 = fin->fgetc(); + if (convert_edge_digit(c1) >= 0) { + lvalp->double_digit[0] = convert_edge_digit(c); + lvalp->double_digit[1] = convert_edge_digit(c1); + return (DOUBLE_DIGIT); + } + fin->fungetc(c1); + } + } + if (enable_udp_parse) { + switch (c) { + case '0': + lvalp->c = c; + return (UDP_ZERO); + case '1': + lvalp->c = c; + return (UDP_ONE); + case 'x': + case 'X': + lvalp->c = 'x'; + return (UDP_X); + case '?': + lvalp->c = '?'; + return (UDP_HOOK); + case '-': + case '*': + case ':': + lvalp->c = c; + return (UDP_CHAR); + case 'b': + case 'B': + lvalp->c = 'b'; + return (UDP_B); + case 'r': + case 'R': + lvalp->c = 'r'; + return (UDP_CHAR); + case 'f': + case 'F': + lvalp->c = 'f'; + return (UDP_CHAR); + case 'p': + case 'P': + lvalp->c = 'p'; + return (UDP_CHAR); + case 'n': + case 'N': + lvalp->c = 'n'; + return (UDP_CHAR); + case 'E': + case 'e': + enable_udp_parse = FALSE; + break; + } + } + + + if (isdigit(c)) { /* number */ + unsigned_32_t d = 0; + short overflow = 0; + short realnum = 0; + short after_decimal = 0; + + p = token_buffer; + realnum = 0; + + do { + if (p >= token_buffer + maxtoken - 3) + p = extend_token_buffer(p); + *p++ = c; + if (c == '_'); + + else if (c == '.') { + realnum = 1; + if (after_decimal) + error + ("Too many decimal points in floating point constant", + NULL, NULL); + else + after_decimal = 1; + } else { + c = c - '0'; + if (d > d * 10) + overflow = 1; + d *= 10; + d += c; +// if (d < 0) +// overflow = 1; + } + c = fin->fgetc(); + } + while (c >= '0' && c <= '9' || c == '.' || c == '_'); + + if (c == 'e' || c == 'E') { + realnum = 1; + *p++ = c; + for (c = fin->fgetc(); isdigit(c) || c == '-'; + c = fin->fgetc()) { + if (p >= token_buffer + maxtoken - 3) + p = extend_token_buffer(p); + *p++ = c; + } + + } + + /* See if this is a bit-constant (5'b1001...) */ + if (!realnum && (c = skip_white_space(c)) == '\'') { /* single quote? */ + if (d > MAX_BITS || overflow || d <= 0) { + yyerror("Illegal length in constant"); + d = 0L; /* but continue parsing */ + } + *p++ = '\''; + lvalp->ttype = parse_base_const(d); +/* + if (d == 1 && v->bval == 0) + if (v->aval == 0) + lvalp->ttype = bit_zero_node; + else + lvalp->ttype = bit_one_node; + else + lvalp->ttype = build_nt (BIT_CST, d, v); +*/ + return BASE_NUMBER; + } else { /* Must be an integer constant */ + nextchar = c; + *p = 0; + if (overflow) + yyerror("Decimal constant larger than 32 bits"); + + if (!realnum) + lvalp->ttype = build_int_cst(d); + else + lvalp->ttype = build_real_cst(token_buffer); + +// switch (d) +// { +// case 0: lvalp->ttype = integer_zero_node; break; +// case 1: lvalp->ttype = integer_one_node; break; +// default: +// lvalp->ttype = build_int_cst (d); +// } + return NUMBER; + } + } + + /* Bit-constant without length (make assumptions from value) */ + if (c == '\'') { + unsigned_32_t d; + + p = token_buffer; + *p++ = '\''; + + lvalp->ttype = + parse_base_const((unsigned_32_t) sizeof(unsigned_32_t) * 8); +/* if (d == 1 && v->bval == 0) + if (v->aval == 0) + lvalp->ttype = bit_zero_node; + else + lvalp->ttype = bit_zero_node; + else + lvalp->ttype = build_nt (BIT_CST, d, v); +*/ + return BASE_NUMBER; + } + + /* Identifier or keyword */ + if (isalpha(c) || c == '_' || c == '$' || c == '`') { + + p = token_buffer; + value = IDENTIFIER; + + do { + if (p >= token_buffer + maxtoken - 1) + p = extend_token_buffer(p); + + if (c == '.') + if (token_buffer[0] != '$' && token_buffer[0] != '`') + value = HIERARCHY_IDENTIFIER; + else + break; /* System tasks or compiler directive can't have periods */ + + *p++ = c; + c = fin->fgetc(); + + + /* if we were in a macro, EOF is also end of macro. + pop the stream stack (i.e. the macro stack) and + read another character. If this is truly an EOF, + the another will be read and the right thing will happen */ + + if (c == EOF) { + fin = pop_stream(); +// c = getc (fin); +// c = '\n'; +// c = ' '; /* Any harmless seperator */ + if (fin) + c = fin->fgetc(); + else + c = EOF; /* this is a real EOF */ + } + } + while (isalnum(c) || c == '_' || c == '$' || c == '.'); + + *p = 0; + + if (token_buffer[0] == '$') + value = SYSTEM_IDENTIFIER; + + else if (token_buffer[0] == '`') { + fin->fungetc(c); /* don't save latest character */ + nextchar = -1; + if (compiler_directive_or_macro(&token_buffer[1])) + goto start_lex; /* Read another token */ + else + return value; + } + nextchar = c; + lvalp->ttype = NULL_TREE; + +/* Is it a keyword? */ + + { + register const struct keywords *ptr; + + if ((ptr = + Perfect_Hash::is_reserved_word(token_buffer, + p - token_buffer)) != 0) { + lvalp->gtype = (enum tree_type) ptr->type; + value = ptr->kval; + stmt_lineno = lineno; /* save line number for trace info */ + } + + /* Did not find a keyword, treat it as an identifier */ + else + lvalp->ttype = get_identifier(token_buffer); + + return value; + } + } + + if (c == '\\') { /* escaped identifier */ + p = token_buffer; + for (;; c = fin->fgetc()) + switch (c) { + case '\t': + case '\f': + case '\r': + case '\v': + case '\b': + case '\n': + case ' ': + *p = 0; + nextchar = c; + lvalp->ttype = get_identifier(token_buffer); + return IDENTIFIER; + default: + if (p >= token_buffer + maxtoken - 1) + p = extend_token_buffer(p); + *p++ = c; + } + } + + if (c == '"') { /* quoted string */ + char *p1; + int len; + tree t; + ngroups_t ngroups; + Group *g; + int ii; + + for (p = token_buffer; (c = fin->fgetc()) != '"';) { + + if (c == '\n' || c == EOF) { + yyerror("Missing quote"); + nextchar = c; + break; + } + + if (c == '\\') + switch (c = fin->fgetc()) { + case 'n': + c = '\n'; + break; + case 't': + c = '\t'; + break; + case '\\': + c = '\\'; + break; + case '"': + c = '"'; + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + { + int c2, c3; + c2 = fin->fgetc(); + if (c2 < '0' || c2 > '7') { + c = c - '0'; + fin->fungetc(c2); + break; + } else { + c3 = fin->fgetc(); + if (c3 < '0' || c3 > '7') { + c = (c - '0') * 8 + (c2 - '0'); + fin->fungetc(c3); + break; + } + } + c = (c - '0') * 64 + (c2 - '0') * 8 + (c3 - '0'); + break; + } + } + + if (p >= token_buffer + maxtoken - 1) + p = extend_token_buffer(p); + + *p++ = c; + } + *p = 0; + p1 = token_buffer; + len = p - p1; + if (len == 0) + len = 1; +// lvalp->ttype = build_string (p - token_buffer + 1, token_buffer); + + t = build_bit_cst((nbits_t) (len * 8), STRING_); + ngroups = chars_to_groups(len); + g = BIT_CST_GROUP(t) + ngroups; + + i = ((len - 1) % sizeof(Bit)) + 1; /* num chars at beginning */ + AVAL(g) = 0; + for (ii = i - 1; ii >= 0; ii--) +#ifdef WORDS_BIGENDIAN //Endianness problem + *(((char *) (&AVAL(g))) + sizeof(Bit) - 1 - ii) = *p1++; +#else + *(((char *) (&AVAL(g))) + ii) = *p1++; +#endif + BVAL(g) = 0; + --g; + for (i = 1; i <= ngroups; i++, g--) { + for (ii = sizeof(Bit) - 1; ii >= 0; ii--) +#ifdef WORDS_BIGENDIAN //Endianness problem + *(((char *) (&AVAL(g))) + sizeof(Bit) - 1 - ii) = *p1++; +#else + *(((char *) (&AVAL(g))) + ii) = *p1++; +#endif + +// memcpy (((char *)(&AVAL (g))), p1, sizeof (Bit)); + BVAL(g) = 0; + } + lvalp->ttype = t; + +/* lvalp->ttype = build_string (/* p - * /token_buffer, token_buffer + 1); */ + return STRING; + } + token_buffer[0] = c; + if (c != EOF) + token_buffer[1] = nextchar = fin->fgetc(); + else + nextchar = -1; + + switch (c) { + case '*': + return follow('>', STARARROW, '*'); + case '>': + return follow('=', GE, follow('>', RIGHT_SHIFT, GT)); + case '<': + return follow('=', LE, follow('<', LEFT_SHIFT, LT)); + case '=': + if (nextchar == '=') { + nextchar = fin->fgetc(); + return follow('=', CASE_EQUALITY, LOGICAL_EQUALITY); + } else if (nextchar == '>') { + nextchar = -1; + token_buffer[2] = 0; + return EQUALARROW; + } else { + token_buffer[1] = 0; + return '='; + } + case '!': + if (nextchar == '=') { + nextchar = fin->fgetc(); + return follow('=', CASE_INEQUALITY, LOGICAL_INEQUALITY); + } else { + token_buffer[1] = 0; + return '!'; + } + case '|': + return follow('|', OROR, '|'); + case '&': + if (nextchar == '&') { + nextchar = fin->fgetc(); + return follow('&', ANDANDAND, ANDAND); + } else { + token_buffer[1] = 0; + return '&'; + } + + case '-': + return follow('>', ARROW_, '-'); + case '~': + return follow('^', XNOR, + follow('&', REDUCTION_NAND, + follow('|', REDUCTION_NOR, '~'))); + case '^': + return follow('~', XNOR, '^'); + +/* There are two EOFs so that "EOF" shows up in the list + of possible tokens when there is a syntax error */ + + case EOF: + if (second_eof) { + second_eof = 0; + return 0; /* send EOF as known by BISON */ + } else { + +/* EOFs are generated at the end of a macro substitution. + Pop the stream pointer, an continue. If the stream stack + is empty, then it was a real EOF */ + + if ((fin = pop_stream()) != 0) + goto start_lex; /* End of macro, read another char */ + + second_eof = 1; /* next time around, do above */ + return EOF_; /* return tokenized version */ + } + default: + token_buffer[1] = '\0'; + if (isprint(c)) { + return c; + } else { + warning("Unprintable character ignored: 0x%03x", (char *) c, + NULL_CHAR); + goto start_lex; + } + } +} + +/* + SKIP_WHITE_SPACE: + This routine will help you parse through the more difficult "white space" + characters including single & multi-line comments. This routine excepts a + starting character & returns the first non-white_space character. + */ + +int skip_white_space(int c) +{ + int c1; + + for (;;) + switch (c) { + case ' ': /* whitespace */ + case '\t': + case '\f': + case '\r': + case '\v': +/* case '\\': */ + case '\b': + c = fin->fgetc(); + break; + + case '\n': /* special whitespace */ + lineno++; + if (is_interactive) + print_prompt(); + c = fin->fgetc(); + break; + + case EOF: + if ((fin = pop_stream()) == 0) + return c; /* bonafide EOF */ + c = fin->fgetc(); /* Macro or `include EOF */ + break; + + case '/': /* comments */ + c = fin->fgetc(); + if (c == '/') /* Handle "//" */ + eatline(c); + + else if (c == '*') { /* Handle "/*" */ + c1 = 0; + do { + c = c1; + switch (c1 = fin->fgetc()) { + case '*': + if (c == '/') + yyerror("/* found in comment"); + break; + case '\n': + lineno++; + if (is_interactive) + print_prompt(); + break; + case EOF: + yyerror("unterminated comment block"); + return (0); + } + } + while (!(c == '*' && c1 == '/')); + c = fin->fgetc(); + } else { + fin->fungetc(c); + return '/'; + } + break; + + default: + return c; + } +} + +static int backslash(int c) +{ /* get next char with /'s interpreted */ +// char *strchr(); /* `strchr()' in some systems */ + static char transtab[] = "b\bf\fn\nr\rt\t"; + if (c != '\\') + return c; + c = fin->fgetc(); + if (islower(c) && strchr(transtab, c)) + return strchr(transtab, c)[1]; + return c; +} + +/* follow(expect, ifyes, ifno) /* look ahead for >=, etc. */ +/*{ + int c = getc(fin); + token[1] = c; + token[2] = '\0'; + if (c == expect) + return ifyes; + ungetc(c, fin); + token[1] = '\0'; + return ifno; +} */ + +/* Report syntax errors */ + +void yyerror(char *s) +{ +// char buf[200]; + +// strcpy (buf, s); +// strcat (buf, " before '%s'"); +// error (s, token_buffer); + error(s, NULL_CHAR, NULL_CHAR); +} + +void fix_lastchar(void) +{ + fin->fungetc(nextchar); + nextchar = -1; +} + +/******************************************************************* + * + * init_lex_1 + * - initialize global and static variables for lex.c + * + ******************************************************************* + */ + +void init_lex_1() +{ + nextchar = -1; + is_interactive = 0; + second_eof = 0; /* Send EOF twice: 1st as token, 2nd as 0 */ + if_nesting_level = 0; + if_disable_level = 0; + memset(&lineno, 0, sizeof(lineno)); + memset(&stmt_lineno, 0, sizeof(stmt_lineno)); + memset(&keywd_lineno, 0, sizeof(keywd_lineno)); + maxtoken = 0; + token_buffer = NULL; + i = 0; +} diff --git a/src/lex.h b/src/lex.h new file mode 100644 index 0000000..8e0dbac --- /dev/null +++ b/src/lex.h @@ -0,0 +1,42 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +#ifndef LEX_H +#define LEX_H +// public definitions +void fix_lastchar(void); +void init_lex(void); +void reinit_lex(void); +void eatnum(void); +int read_num_token(char *); +void parse_base_const1(enum radii, char *, nbits_t, nbits_t, tree); +void parse_base_const1g(enum radii, char *, nbits_t, nbits_t, Group *); +int skip_white_space(int); +void yyerror(char *); +int prog_parse(void); // this really belongs with the parser +int IsReservedWord(char *, int); +int convert_edge_digit(int c); +void init_parse(void); +void init_lex_1(void); +#ifdef LEX_C // private definitions +static unsigned int hash(register const char *str, + register unsigned int len); +#endif // LEX_C + +#endif // LEX_H diff --git a/src/macro.cc b/src/macro.cc new file mode 100644 index 0000000..7b4ec95 --- /dev/null +++ b/src/macro.cc @@ -0,0 +1,237 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* MACRO.C - Macro definitions and expansion; push/pop streams */ +#define MACRO_C + +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "obstack.h" +#include "io.h" +#include "macro.h" +#include "glue.h" +#include "lex.h" +#include "veriwell.h" + +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free + + +/* Macros are stored (for now) as a chained tree list of string nodes */ +static tree macro_chain = NULL_TREE; + +void define_macro(tree name, tree rest) +{ + tree new_t; +/* look for same name */ + + if (rest && ((new_t = lookup_macro(IDENTIFIER_POINTER(name))) != 0)) { + +// Elliot: verilog does not warn about this +// warning ("Macro %s previously defined, overriding\n", IDENT (name), NULL_CHAR); + TREE_VALUE(new_t) = rest; /* replace old definition */ + } else + macro_chain = tree_cons(name, rest, macro_chain); +} + +tree lookup_macro(char *name) +{ + tree p; + +//printf_V ("Macro name: '%s':\n", name); + for (p = macro_chain; + p && strcmp(name, IDENTIFIER_POINTER(TREE_PURPOSE(p))) != 0; + p = TREE_CHAIN(p)); +// printf_V (" '%s'\n", IDENT (TREE_PURPOSE (p))); +// printf_V ("Returning %p\n\n", p); + return p; +} + +void delete_macro(int len, char *name) +{ + tree p; + tree *parent; + parent = ¯o_chain; + for (p = *parent; + p && strncmp(name, IDENTIFIER_POINTER(TREE_PURPOSE(p)), len) != 0 + && strlen(IDENTIFIER_POINTER(TREE_PURPOSE(p))) == len; + parent = &p, p = TREE_CHAIN(p)); + + // ??? mdh - note this is wasteful, object is left dangling + // on obstack. + if (p) { + *parent = TREE_CHAIN(p); + } else { + *parent = 0; + } + +} + +void expand_macro(char *name) +{ + tree found = lookup_macro(name); + + // IEEE spec say expandition of undefined macros is NULL + if (found) { + push_stream(fin, 0); + fin = File::fopenbuf(TREE_STRING_POINTER(TREE_VALUE(found)), + TREE_STRING_LENGTH(TREE_VALUE(found))); + } +} + +void open_include(char *filename) +{ + File *include; + char *include_name; + + if (incdir) { + char *p; + char *tmpdir; + + tmpdir = (char *) xmalloc(strlen(incdir) + 1); + strcpy(tmpdir, incdir); + for (p = strtok(tmpdir, "+"); p; p = strtok(NULL, "+")) { + include_name = + (char *) xmalloc(strlen(filename) + strlen(p) + 1); + strcpy(include_name, p); + strcat(include_name, PATHSEP); + strcat(include_name, &filename[1]); + + include = File::fopen(include_name, "rt"); + if (include) + break; + free(include_name); + } + } else { + include_name = (char *) xmalloc(strlen(filename) + 1); + strcpy(include_name, &filename[1]); /* strip leading " */ + + include = File::fopen(include_name, "rt"); + } + if (!include) + error("Could not open include file '%s'", &filename[1], NULL_CHAR); + else { + printf_V("Compiling included source file '%s'\n", include_name); + push_stream(fin, 1); + lineno = 1; + fin = include; + input_filename = include_name; + } +} + +static struct obstack macro_obstack; + +struct macro_level { + struct macro_level *prev; /* where to pop to */ + File *file; /* FILE structure within stack */ + char *filename; /* filename (if pushing `include file) */ + lineno_t lineno; /* Linenumber to pop to */ + int include; /* Non-zero if this is include file */ +}; + +static struct macro_level *macro_stack; + +void init_macro() +{ + tree name, rest; + + obstack_init(¯o_obstack); + macro_stack = 0; + + name = build_string(12, "__VERIWELL__"); + rest = build_string(0, ""); + define_macro(name, rest); +} + +/* include == 0: Macro + include == 1: included file (`include) + include == 2: library or pushed file that needs to be closed +*/ + +void push_stream(File * file, int include) +{ + struct macro_level *tem + = (struct macro_level *) obstack_alloc(¯o_obstack, + sizeof(struct macro_level)); + tem->prev = macro_stack; + tem->file = file; /* Copy entire FILE structure onto stack */ + tem->filename = input_filename; + tem->lineno = lineno; + tem->include = include; + macro_stack = tem; +} + +File *pop_stream(void) +{ + struct macro_level *tem = macro_stack; + File *tempfile; + + if (macro_stack == 0) { + if (fin) + fin->fclose(); + return 0; + } + + input_filename = tem->filename; + if (tem->include) { + if (tem->include == 1) + printf_V("Continuing compilation of source file '%s'\n", + input_filename); + fin->fclose(); + } + macro_stack = tem->prev; + tempfile = tem->file; + lineno = tem->lineno; + obstack_free(¯o_obstack, (POINTER) tem); + return tempfile; +} + +static struct obstack input_obstack; + +struct input_level { + struct input_level *prev; /* where to pop to */ + FILE *file; /* FILE structure within stack */ +}; + +static struct input_level *input_stack; + +void init_input() +{ + obstack_init(&input_obstack); + input_stack = 0; +} + +/***************************************************************** + * + * init_macro_1 + * - initializes global and static variables for macro.c + * + ***************************************************************** + */ + +void init_macro_1() +{ + macro_chain = NULL_TREE; + memset(¯o_obstack, 0, sizeof(macro_obstack)); + memset(¯o_stack, 0, sizeof(macro_stack)); + memset(&input_obstack, 0, sizeof(input_obstack)); + memset(&input_stack, 0, sizeof(input_stack)); +} diff --git a/src/macro.h b/src/macro.h new file mode 100644 index 0000000..118664f --- /dev/null +++ b/src/macro.h @@ -0,0 +1,45 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* MACRO.H - Macro routine prototypes */ + +#ifndef MACRO_H +#define MACRO_H + +// public methods + +class File; +void push_stream(File *, int); +File *pop_stream(void); +void define_macro(tree, tree); +tree lookup_macro(char *); +void delete_macro(int len, char *data); +void expand_macro(char *); +void open_include(char *); +void init_macro(void); +void init_input(void); +void open_include(char *filename); +void init_macro_1(void); + +// private methods + +#ifdef MACRO_C +#endif // MACRO_C + +#endif // MACRO_H diff --git a/src/multdiv.cc b/src/multdiv.cc new file mode 100644 index 0000000..4eb075e --- /dev/null +++ b/src/multdiv.cc @@ -0,0 +1,481 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* MULTDIV.C - Arbitrary-length multiply, divide, and modulo arithmetic +*/ + +#include +#include "vtypes.h" +#include "tree.h" +#include "multdiv.h" +#include "veriwell.h" + + +static unsigned NZGroups(Group * ag, unsigned groups); +static unsigned NZBits(Bit a); +static Bit GroupRShift(Group * a, Bit * b, unsigned c, unsigned groups); +static Bit GroupLShift(Bit * a, Group * bg, unsigned c, unsigned groups); +static int BitCmp(Bit * a, Bit * b, unsigned bits); +static void Mult32x32(Bit a[2], Bit b, Bit c); +static void AllocAccs(unsigned words); + +static Bit *cc = 0; +static Bit *dd = 0; +static ngroups_t cc_size = 0; +static ngroups_t dd_size = 0; + +/* + * a=b+c. Returns carry. + */ +Bit BitAdd(Bit * a, Bit * b, Bit * c, unsigned bits) +{ + Bit acc; + Bit carry; + + carry = 0; + for (int i = 0; i < bits; i++) { + if ((acc = b[i] + carry) < carry) { + acc = c[i]; + } else if ((acc += c[i]) < c[i]) { + carry = 1; + } else { + carry = 0; + } + a[i] = acc; + } + return (carry); +} + + +/* + * a=b-c. Returns borrow + */ +Bit BitSub(Bit * a, Bit * b, Bit * c, unsigned bits) +{ + Bit acc; + Bit borrow; + + borrow = 0; + for (int i = 0; i < bits; i++) { + if ((acc = b[i] - borrow) > (~((Bit) 0) - borrow)) { + acc = (~(Bit) 0) - c[i]; + } else if ((acc -= c[i]) > ((~(Bit) 0) - c[i])) { + borrow = 1; + } else { + borrow = 0; + } + a[i] = acc; + } + return (borrow); +} + + +/* + * Returns the number of non-zero groups. + */ +static unsigned NZGroups(Group * ag, unsigned groups) +{ + int i; + for (i = groups - 1; i >= 0; i--) { + if (ag[i].bit.aval) { + break; + } + } + return (i + 1); +} + + +/* + * return the number of significant bits in word + */ +static unsigned NZBits(Bit a) +{ + unsigned i; + for (i = 0; i < sizeof(Bit) * 8; i++, a >>= 1) { + if (a == 0) { + break; + } + } + return (i); +} + +/* + * a = b >> c + * where c is less than number of bits in 'Bit' + */ +static Bit GroupRShift(Group * a, Bit * b, unsigned c, unsigned groups) +{ + Bit bi; + Bit carry; + int i; + unsigned int t; + + if (c >= sizeof(Bit) * 8) { + return 0; + } + t = sizeof(Bit) * 8 - c; + carry = 0; + for (i = groups - 1; i >= 0; i--) { + bi = b[i]; + a[i].bit.aval = (bi >> c) | carry; + carry = c ? (bi << t) : 0; + } + return (carry); +} + +/* + * a = b << c; + * where c is less than number of bits in 'Bit' + */ +static Bit GroupLShift(Bit * a, Group * bg, unsigned c, unsigned groups) +{ + Bit bi; + Bit carry; + unsigned int t; + + if (c >= sizeof(Bit) * 8) { + return (0); + } + t = sizeof(Bit) * 8 - c; + carry = 0; + for (int i = 0; i < groups; i++) { + bi = bg[i].bit.aval; + a[i] = (bi << c) | carry; + carry = c ? (bi >> t) : 0; + } + return (carry); +} + +/* + * compare a to b. returns: + * -1 if a < b, + * 0 if a == b + * 1 if a > b + */ +static int BitCmp(Bit * a, Bit * b, unsigned bits) +{ + for (int i = bits - 1; i >= 0; i--) { + if (a[i] > b[i]) { + return (1); + } + if (a[i] < b[i]) { + return (-1); + } + } + return (0); +} + +/* + * 32 bit by 32 bit multiply + */ +static void Mult32x32(Bit a[2], Bit b, Bit c) +{ + Bit t; + Bit u; + Bit bHigh = b >> 16; + Bit bLow = b & 0xffff; + Bit cHigh = c >> 16; + Bit cLow = c & 0xffff; + + a[0] = bLow * cLow; + t = bLow * cHigh; + u = bHigh * cLow; + a[1] = bHigh * cHigh; + + if ((t += u) < u) { + a[1] += 0x10000; + } + u = t << 16; + + if ((a[0] += u) < u) { + a[1]++; + } + a[1] += t >> 16; +} + + + +/* + * a=b+c*d, where c is a single word + * return carry word + */ +static Bit Mult32Acc(Bit * a, Bit * b, Bit c, Group * dg, unsigned words) +{ + Bit carry; + Bit t[2]; + unsigned i; + + carry = 0; + for (i = 0; i < words; i++) { + Mult32x32(t, c, dg[i].bit.aval); + if ((a[i] = b[i] + carry) < carry) { + carry = 1; + } else { + carry = 0; + } + if ((a[i] += t[0]) < t[0]) { + carry++; + } + carry += t[1]; + } + return (carry); +} + + +/* + * a=b*c + */ +void GroupMult(Group * ag, Group * bg, Group * cg, unsigned groups) +{ + unsigned bGroups; + unsigned cGroups; + + AllocAccs(groups); + /* + * set cc to 0 + */ + for (int i = 0; i < 2 * groups; i++) { + cc[i] = 0; + } + + /* + * calculate number if significant words in each group + */ + bGroups = NZGroups(bg, groups); + cGroups = NZGroups(cg, groups); + + /* + * multiply and accumulate a group at a time + */ + for (int i = 0; i < bGroups; i++) { + cc[i + cGroups] += Mult32Acc(&cc[i], &cc[i], + bg[i].bit.aval, cg, cGroups); + } + /* + * copy result to destination + */ + for (int i = 0; i < groups; i++) { + ag[i].bit.aval = cc[i]; + ag[i].bit.bval = 0; + } +} + +/* + * a=b-c*d, where c is a single word. + * returns borrow + */ +Bit Mult32Sub(Bit * a, Bit * b, Bit c, Bit * d, unsigned words) +{ + Bit borrow; + Bit t[2]; + + borrow = 0; + for (int i = 0; i < words; i++) { + Mult32x32(t, c, d[i]); + if ((a[i] = b[i] - borrow) > ((~(Bit) 0) - borrow)) { + borrow = 1; + } else { + borrow = 0; + } + if ((a[i] -= t[0]) > (~((Bit) 0) - t[0])) { + borrow++; + } + borrow += t[1]; + } + return (borrow); +} + + +/* + * a=b/c, a and c are single words, b is a double word. + * assumptions: b[1] < c and c>>16 > 0. + */ +void Div64by32(Bit * a, Bit b[2], Bit c) +{ + Bit t[2]; + Bit u; + Bit v; + Bit aHigh; + Bit aLow; + Bit cHigh = c >> 16; + Bit cLow = c & 0xffff; + + t[0] = b[0]; + t[1] = b[1]; + + /* + * Underestimate high half of quotient and + * subtract product of estimate and divisor + * from dividend. + */ + if (cHigh == 0xffff) { + aHigh = t[1] >> 16; + } else { + aHigh = (t[1] / (cHigh + 1)) & 0xffff; + } + u = aHigh * cLow; + v = aHigh * cHigh; + if ((t[0] -= (u << 16)) > ((~(Bit) 0) - (u << 16))) { + t[1]--; + } + t[1] -= u >> 16; + t[1] -= v; + + /* Correct estimate. */ + while ((t[1] > cHigh) || ((t[1] == cHigh) && (t[0] >= (cLow << 16)))) { + if ((t[0] -= (cLow << 16)) > (~(Bit) 0) - (cLow << 16)) { + t[1]--; + } + t[1] -= cHigh; + aHigh++; + } + /* + * Underestimate low half of quotient and + * subtract product of estimate and divisor + * from what remains of dividend. + */ + if (cHigh == 0xffff) { + aLow = t[1] >> 16; + } else { + aLow = (((t[1] << 16) + (t[0] >> 16)) / (cHigh + 1)) & 0xffff; + } + u = aLow * cLow; + v = aLow * cHigh; + if ((t[0] -= u) > ((~(Bit) 0) - u)) { + t[1]--; + } + if ((t[0] -= (v << 16)) > ((~(Bit) 0) - (v << 16))) { + t[1]--; + } + t[1] -= v >> 16; + + /* Correct estimate. */ + while ((t[1] > 0) || ((t[1] == 0) && t[0] >= c)) { + if ((t[0] -= c) > ((~(Bit) 0) - c)) { + t[1]--; + } + aLow++; + } + + *a = (aHigh << 16) + aLow; +} + + +/* + * a=c/d and b=c%d. + * d must be > 0 + */ +void +GroupDiv(Group * ag, Group * bg, Group * cg, Group * dg, + unsigned words, int do_mod) +{ + Bit ai; + Bit t; + unsigned dWords; + unsigned shift; + + /* + * calculate number of significant words in divisor + */ + dWords = NZGroups(dg, words); + if (dWords == 0) { + return; + } + + AllocAccs(words); + + /* Normalize operands. */ + shift = sizeof(Bit) * 8 - NZBits(dg[dWords - 1].bit.aval); + /* + * set cc to 0 + */ + for (int i = 0; i < dWords; i++) { + cc[i] = 0; + } + cc[words] = GroupLShift(cc, cg, shift, words); + GroupLShift(dd, dg, shift, dWords); + t = dd[dWords - 1]; + + /* + * set ag to 0 + */ + for (int i = 0; i < words; i++) { + ag[i].bit.aval = 0; + ag[i].bit.bval = 0; + } + + for (int i = words - dWords; i >= 0; i--) { + /* Underestimate quotient digit and subtract. */ + if (t == (~(Bit) 0)) { + ai = cc[i + dWords]; + } else { + Div64by32(&ai, &cc[i + dWords - 1], t + 1); + } + cc[i + dWords] -= Mult32Sub(&cc[i], &cc[i], ai, dd, dWords); + /* Correct estimate. */ + while (cc[i + dWords] || (BitCmp(&cc[i], dd, dWords) >= 0)) { + ai++; + cc[i + dWords] -= BitSub(&cc[i], &cc[i], dd, dWords); + } + ag[i].bit.aval = ai; + } + /* Restore result. */ + if (do_mod) { + /* + * zero out bg + */ + for (int i = 0; i < words; i++) { + bg[i].bit.aval = 0; + bg[i].bit.bval = 0; + } + GroupRShift(bg, cc, shift, dWords); + } +} + +static void AllocAccs(unsigned words) +{ + /* + * used shared accumulators when calculating results + */ + if (!cc || cc_size <= words) { + if (cc) { + cc = (Bit *) xrealloc((char *) cc, + (2 * (words + 1) + 1) * sizeof(Bit)); + } else { + cc = (Bit *) xmalloc((2 * (words + 1) + 1) * sizeof(Bit)); + } + cc_size = words + 1; + } + if (!dd || dd_size <= words) { + if (dd) { + dd = (Bit *) xrealloc((char *) dd, (words + 1) * sizeof(Bit)); + } else { + dd = (Bit *) xmalloc((words + 1) * sizeof(Bit)); + } + dd_size = words + 1; + } +} + +void init_multdiv() +{ + cc = 0; + dd = 0; + cc_size = 0; + dd_size = 0; +} diff --git a/src/multdiv.h b/src/multdiv.h new file mode 100644 index 0000000..b669ac4 --- /dev/null +++ b/src/multdiv.h @@ -0,0 +1,36 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* MULTDIV.H - Multdiv routine prototypes */ + + +#ifndef MULTDIV_H +#define MULTDIV_H + +// public methods + +void init_multdiv(void); + +Bit BitAdd(Bit * a, Bit * b, Bit * c, unsigned bits); +Bit BitSub(Bit * a, Bit * b, Bit * c, unsigned bits); +void GroupMult(Group * ag, Group * bg, Group * cg, unsigned groups); +void GroupDiv(Group * ag, Group * bg, Group * cg, Group * dg, + unsigned words, int do_mod); + +#endif // MULTDIV_H diff --git a/src/nsched.cc b/src/nsched.cc new file mode 100644 index 0000000..61ba685 --- /dev/null +++ b/src/nsched.cc @@ -0,0 +1,321 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/************************************************************************ + * + * nsched.c + * - experimental framework for new scheduler for gates + * + *********************************************************************** + */ + + +#define NSCHED_C + +#include +#include "vtypes.h" +#include "tree.h" +#include "glue.h" +#include "nsched.h" +#include "veriwell.h" + +static timeq_t *gateList = (timeq_t *) BADPTR; +static timeq_t *nodeFreeList = (timeq_t *) BADPTR; + +extern time64 CurrentTime; + + +/************************************************************************** + + ScheduleGate + - add gate to list of gates ready to fire + + **************************************************************************/ + +void ScheduleGate(tree gate, delay_t delay) +{ + time64 timeIndex; + timeq_t *newNode; + tree head; + timeq_t *node; + int cmpResult; + + ASSERT(gate != NULL); + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + ASSERT(gateList != BADPTR); + ASSERT(nodeFreeList != BADPTR); + + ADDTIME6432(&timeIndex, &CurrentTime, delay); + + /* this is a hack to attempt to match Cadence */ + /* (also, reschedule if new input before delay is up */ + + if (IsGateScheduled(gate) && + !CMPTIME64(&(GATE_TIMEQ(gate)->timeIndex), &timeIndex) && + !(TREE_TYPE(gate) == GATE_UDP_TYPE + && GATE_PATH_OUTPUT(gate) == NULL_TREE) + && !(TREE_TYPE(gate) == GATE_NOT_TYPE + && TREE_CHAIN(GATE_OUTPUT_LIST(gate)) != NULL_TREE) + && !(TREE_TYPE(gate) == GATE_BUF_TYPE + && TREE_CHAIN(GATE_OUTPUT_LIST(gate)) != NULL_TREE)) { + return; + } + + + if (IsGateScheduled(gate)) { + RemoveGate(gate); + } + + if (gateList == NULL) { + // insert a new node at the beginning of list + + if (nodeFreeList != NULL) { + newNode = nodeFreeList; + nodeFreeList = nodeFreeList->next; + } else { + newNode = (timeq_t *) xmalloc(sizeof(timeq_t)); + } + + newNode->gate = gate; + GATE_NEXT(gate) = gate; + GATE_PREV(gate) = gate; + GATE_TIMEQ(gate) = newNode; + newNode->next = newNode; + newNode->prev = newNode; + ASSIGNTIME64(&newNode->timeIndex, &timeIndex); + gateList = newNode; + return; + } + + node = gateList; + while (TRUE) { + cmpResult = CMPTIME64(&timeIndex, &node->timeIndex); + if (cmpResult == 0) { + // add to this node + head = node->gate; + GATE_NEXT(gate) = head; + GATE_PREV(gate) = GATE_PREV(head); + GATE_NEXT(GATE_PREV(head)) = gate; + GATE_PREV(head) = gate; + GATE_TIMEQ(gate) = node; + return; + } else if (cmpResult < 0) { + // insert a new node before this node + if (nodeFreeList != NULL) { + newNode = nodeFreeList; + nodeFreeList = nodeFreeList->next; + } else { + newNode = (timeq_t *) xmalloc(sizeof(timeq_t)); + } + + newNode->gate = gate; + ASSIGNTIME64(&newNode->timeIndex, &timeIndex); + GATE_TIMEQ(gate) = newNode; + GATE_NEXT(gate) = gate; + GATE_PREV(gate) = gate; + newNode->next = node; + newNode->prev = node->prev; + node->prev->next = newNode; + node->prev = newNode; + if (node == gateList) { + gateList = newNode; + } + return; + } else if (node->next == gateList) { + // insert a new node at the end of queue + if (nodeFreeList != NULL) { + newNode = nodeFreeList; + nodeFreeList = nodeFreeList->next; + } else { + newNode = (timeq_t *) xmalloc(sizeof(timeq_t)); + } + + newNode->gate = gate; + ASSIGNTIME64(&newNode->timeIndex, &timeIndex); + GATE_TIMEQ(gate) = newNode; + GATE_NEXT(gate) = gate; + GATE_PREV(gate) = gate; + newNode->next = gateList; + newNode->prev = gateList->prev; + gateList->prev->next = newNode; + gateList->prev = newNode; + return; + } + node = node->next; + } + ASSERT(FALSE); + return; +} + +/************************************************************************** + + PeekGate + - return pointer to next gate ready to fire + + **************************************************************************/ + +tree PeekGate(void) +{ + + if (gateList) { + return (gateList->gate); + } else { + return (NULL_TREE); + } +} + +/************************************************************************** + + RemoveNextReadyGate + - return pointer to next gate ready to fire and remove it from list + + **************************************************************************/ + +tree RemoveNextReadyGate(void) +{ + tree next; + + next = PeekGate(); + if (next != NULL_TREE && + CMPTIME64(&(GATE_TIMEQ(next)->timeIndex), &CurrentTime) == 0) { + RemoveGate(next); + return (next); + } + return (NULL_TREE); +} + +/************************************************************************** + + RemoveGate + - remove the given gate from the gatelist + + **************************************************************************/ + +void RemoveGate(tree gate) +{ + timeq_t *head; + + + ASSERT(gate != NULL_TREE); + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + + head = GATE_TIMEQ(gate); + + if (GATE_NEXT(gate) == gate) { + // last gate for this time so remove node + GATE_TIMEQ(gate) = NULL; + if (head->next == head) { + // gatelist is now empty + gateList = NULL; + head->next = nodeFreeList; + nodeFreeList = head; + return; + } + // unlink node + if (head == gateList) { + gateList = head->next; + } + head->next->prev = head->prev; + head->prev->next = head->next; + return; + } + // unlink gate only + if (head->gate == gate) { + head->gate = GATE_NEXT(gate); + } + GATE_NEXT(GATE_PREV(gate)) = GATE_NEXT(gate); + GATE_PREV(GATE_NEXT(gate)) = GATE_PREV(gate); + GATE_TIMEQ(gate) = NULL; + +} + +/************************************************************************** + + IsGateScheduled + - returns TRUE if gate is currently scheduled + + **************************************************************************/ + +int IsGateScheduled(tree gate) +{ + ASSERT(gate != NULL_TREE); + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + return (GATE_TIMEQ(gate) != NULL); +} + +/************************************************************************** + + IsGateReady + - returns TRUE if gate is currently ready to fire + + **************************************************************************/ + +int IsGateReady() +{ + tree gate; + + gate = PeekGate(); + + if (gate == NULL_TREE) { + return (FALSE); + } + + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + return (CMPTIME64(&(GATE_TIMEQ(gate)->timeIndex), &CurrentTime) == 0); +} + +/************************************************************************** + + GateConditionalAdvanceTime + - advance time if it is less than or equal to given time + return TRUE if time advanced + + **************************************************************************/ + +int GateConditionalAdvanceTime(time64 * timePtr) +{ + extern void set_simulation_time(time64 *); /* in exec.c */ + tree gate; + + gate = PeekGate(); + + if (gate == NULL_TREE) { + return (FALSE); + } + + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + if (CMPTIME64(&(GATE_TIMEQ(gate)->timeIndex), timePtr) >= 0) { + return (FALSE); + } +// ASSIGNTIME64( &CurrentTime, &(GATE_TIMEQ(gate)->timeIndex) ); + set_simulation_time(&(GATE_TIMEQ(gate)->timeIndex)); + return (TRUE); +} + +/************************************************************************** + + InitNSched + - initialize module global data + + **************************************************************************/ +void InitNSched() +{ + gateList = NULL; + nodeFreeList = NULL; +} diff --git a/src/nsched.h b/src/nsched.h new file mode 100644 index 0000000..01eff69 --- /dev/null +++ b/src/nsched.h @@ -0,0 +1,56 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/**************************************************************************** + * + * nsched.h + * - header for nsched.c + * + *************************************************************************** + */ + + +#ifndef NSCHED_H +#define NSCHED_H + +// public definitions + +typedef struct timeq_tag { + struct timeq_tag *next; + struct timeq_tag *prev; + time64 timeIndex; + tree gate; +} timeq_t; + +void ScheduleGate(tree gate, delay_t delay); +tree PeekGate(void); +tree RemoveNextReadyGate(void); +void RemoveGate(tree); +int IsGateScheduled(tree); +int IsGateReady(void); +int GateConditionalAdvanceTime(time64 * time); +void InitNSched(void); + + + +#ifdef NSCHED_C + +#endif // NSCHED_C + +#endif // NSCHED_H diff --git a/src/obstack.cc b/src/obstack.cc new file mode 100644 index 0000000..0c70590 --- /dev/null +++ b/src/obstack.cc @@ -0,0 +1,286 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ +#define OBSTACK_C + +#include "glue.h" +#include "obstack.h" +#include "vtypes.h" +#include "tree.h" +#include "veriwell.h" +#include +/************************************************************************************** + obstack_init + - initialize obstack +**************************************************************************************/ +void obstack_init(obstack_t * ostack) +{ + chunk_t *chunk; + ASSERT(ostack != NULL); + chunk = (chunk_t *) xmalloc(OBSTACK_DEFAULT_BLOCK_SIZE); + chunk->next = NULL; + chunk->freeOffset = 0; + chunk->objectOffset = 0; + chunk->size = OBSTACK_DEFAULT_BLOCK_SIZE - (sizeof(chunk_t) - 4); + ostack->defaultSize = chunk->size; + ostack->alignment = 8; /* Sparcs like 8 */ + ostack->next = chunk; +} + +/************************************************************************************** + obstack_next_free + - return next free byte +**************************************************************************************/ +void *obstack_next_free(obstack_t * ostack) +{ + chunk_t *chunk; + ASSERT(ostack != NULL); + ASSERT(ostack->next != NULL); + + chunk = ostack->next; + ASSERT(chunk->freeOffset <= chunk->size); + ASSERT(chunk->objectOffset <= chunk->size); + ASSERT(chunk->freeOffset >= 0); + ASSERT(chunk->objectOffset >= 0); + return (&chunk->data[chunk->freeOffset]); +} + +/************************************************************************************** + obstack_base + - return base of current object +**************************************************************************************/ +void *obstack_base(obstack_t * ostack) +{ + chunk_t *chunk; + ASSERT(ostack != NULL); + ASSERT(ostack->next != NULL); + chunk = ostack->next; + ASSERT(chunk->freeOffset <= chunk->size); + ASSERT(chunk->objectOffset <= chunk->size); + ASSERT(chunk->freeOffset >= 0); + ASSERT(chunk->objectOffset >= 0); + return (&chunk->data[chunk->objectOffset]); +} + +/************************************************************************************** + obstack_set_base + - force current object base +**************************************************************************************/ +void obstack_set_base(obstack_t * ostack, void *object) +{ + chunk_t *chunk; + ASSERT(ostack != NULL); + ASSERT(ostack->next != NULL); + + chunk = ostack->next; + ASSERT(chunk->freeOffset <= chunk->size); + ASSERT(chunk->objectOffset <= chunk->size); + ASSERT(chunk->freeOffset >= 0); + ASSERT(chunk->objectOffset >= 0); + ASSERT(&chunk->data[0] <= (char *) object); + ASSERT(&chunk->data[chunk->size] >= (char *) object); + + chunk->objectOffset = ((char *) object) - &chunk->data[0]; +} + +/************************************************************************************** + obstack_ptr_grow + - grow obstack by one pointer and copy object ptr into it +**************************************************************************************/ +void obstack_ptr_grow(obstack_t * ostack, void *object) +{ + obstack_grow(ostack, &object, sizeof(object)); +} + +/************************************************************************************** + obstack_object_size + - return size of current object +**************************************************************************************/ +int obstack_object_size(obstack_t * ostack) +{ + chunk_t *chunk; + ASSERT(ostack != NULL); + ASSERT(ostack->next != NULL); + + chunk = ostack->next; + ASSERT(chunk->freeOffset <= chunk->size); + ASSERT(chunk->objectOffset <= chunk->size); + ASSERT(chunk->freeOffset >= 0); + ASSERT(chunk->objectOffset >= 0); + return (chunk->freeOffset - chunk->objectOffset); +} + +/************************************************************************************** + obstack_copy + - copy object into obstack, returns ptr to data in obstack +**************************************************************************************/ +void *obstack_copy(obstack_t * ostack, void *object, int size) +{ + void *ptr; + ptr = obstack_alloc(ostack, size); + memcpy(ptr, object, size); + return (ptr); +} + +/************************************************************************************** + obstack_copy0 + - copy object into obstack with null terminator, returns ptr to data in obstack +**************************************************************************************/ +void *obstack_copy0(obstack_t * ostack, void *object, int size) +{ + void *ptr; + ptr = obstack_alloc(ostack, size + 1); + memcpy(ptr, object, size); + ((char *) ptr)[size] = 0; + return (ptr); +} + +/************************************************************************************** + obstack_finish + - finalize object by advance object base to next free spot(aligned) +**************************************************************************************/ +void *obstack_finish(obstack_t * ostack) +{ + chunk_t *chunk; + int offset; + int startOffset; + ASSERT(ostack != NULL); + ASSERT(ostack->next != NULL); + + chunk = ostack->next; + ASSERT(chunk->freeOffset <= chunk->size); + ASSERT(chunk->objectOffset <= chunk->size); + ASSERT(chunk->freeOffset >= 0); + ASSERT(chunk->objectOffset >= 0); + offset = chunk->freeOffset; + startOffset = chunk->objectOffset; + offset = + ((offset + ostack->alignment - + 1) / ostack->alignment) * ostack->alignment; + if (offset > chunk->size) { + offset = chunk->size; + } + chunk->freeOffset = offset; + chunk->objectOffset = offset; + return (&chunk->data[startOffset]); +} + +/************************************************************************************** + obstack_alloc + - allocate space and advance object. return start of object +**************************************************************************************/ +void *obstack_alloc(obstack_t * ostack, int size) +{ + void *ptr; + chunk_t *chunk; + + ptr = grow_chunk(ostack, size); + ASSERT(ptr == obstack_base(ostack)); + + return (obstack_finish(ostack)); +} + +/************************************************************************************** + obstack_grow + - append data to current object +**************************************************************************************/ +void obstack_grow(obstack_t * ostack, void *data, int size) +{ + void *ptr; + + ptr = grow_chunk(ostack, size); + memcpy(ptr, data, size); +} + +/************************************************************************************** + obstack_free + - free all storage after object + if object is 0, free all +**************************************************************************************/ +void obstack_free(obstack_t * ostack, void *object) +{ + chunk_t *chunk; + ASSERT(ostack != NULL); + ASSERT(ostack->next != NULL); + + chunk = ostack->next; + while (chunk && chunk->next) { + ASSERT(chunk->freeOffset >= 0); + ASSERT(chunk->objectOffset >= 0); + ASSERT(chunk->freeOffset <= chunk->size); + ASSERT(chunk->objectOffset <= chunk->size); + if ((char *) object >= &chunk->data[0] + && ((char *) object <= (&chunk->data[0] + chunk->size))) { + break; + } + ostack->next = chunk->next; + free(chunk); + chunk = ostack->next; + } + if (object == 0) { + chunk->freeOffset = 0; + chunk->objectOffset = 0; + } else { + ASSERT((char *) object >= &chunk->data[0] + && ((char *) object <= (&chunk->data[0] + chunk->size))); + chunk->objectOffset = (char *) object - &chunk->data[0]; + chunk->freeOffset = chunk->objectOffset; + } + +} + +/************************************************************************************** + grow_chunk + - make room for data, allocate new hunk if needed +**************************************************************************************/ +static void *grow_chunk(obstack_t * ostack, int size) +{ + chunk_t *chunk; + chunk_t *newChunk; + int currentSize; + int newSize; + void *ptr; + ASSERT(ostack != NULL); + ASSERT(ostack->next != NULL); + chunk = ostack->next; + ASSERT(chunk->freeOffset <= chunk->size); + ASSERT(chunk->objectOffset <= chunk->size); + ASSERT(chunk->freeOffset >= 0); + ASSERT(chunk->objectOffset >= 0); + if (chunk->size - chunk->freeOffset < size) { + newSize = OBSTACK_DEFAULT_BLOCK_SIZE - (sizeof(chunk_t) - 4); + if (newSize < size) { + newSize = size; + } + currentSize = chunk->freeOffset - chunk->objectOffset; + newChunk = (chunk_t *) xmalloc(newSize + (sizeof(chunk_t) - 4)); + newChunk->next = chunk; + newChunk->freeOffset = currentSize; + newChunk->objectOffset = 0; + newChunk->size = newSize; + memcpy(&newChunk->data[0], &chunk->data[chunk->objectOffset], + currentSize); + ostack->next = newChunk; + chunk = newChunk; + } + + ptr = &chunk->data[chunk->freeOffset]; + chunk->freeOffset += size; + return (ptr); + +} diff --git a/src/obstack.h b/src/obstack.h new file mode 100644 index 0000000..69bc2bf --- /dev/null +++ b/src/obstack.h @@ -0,0 +1,59 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* obstack.h - obstack memory management routines */ + +#ifndef OBSTACK_H +#define OBSTACK_H +// public definitions +// generic pointer definition +typedef void *POINTER; +// obstack chunk definition +typedef struct obstackChunk_tag { + struct obstackChunk_tag *next; // pointer to next allocated chunk + int size; // data size of this chunk + int objectOffset; // offset of current object + int freeOffset; // offset of next free byte + char data[4]; // start of data area +} chunk_t; +// obstack header definition +typedef struct obstack { + chunk_t *next; // pointer to next allocated chunk + int alignment; // number of byte to align to + int defaultSize; // number of data byte to allocate by default +} obstack_t; +// prototypes +void obstack_init(obstack_t *); +void *obstack_alloc(obstack_t *, int); +void obstack_free(obstack_t *, void *); +void obstack_set_base(obstack_t *, void *); +void *obstack_base(obstack_t *); +void *obstack_next_free(obstack_t *); +void *obstack_finish(obstack_t *); +void *obstack_copy(obstack_t *, void *, int); +void *obstack_copy0(obstack_t *, void *, int); +int obstack_object_size(obstack_t *); +void obstack_grow(obstack_t *, void *, int); +void obstack_ptr_grow(obstack_t *, void *); +#ifdef OBSTACK_C +// private definitions +#define OBSTACK_DEFAULT_BLOCK_SIZE (4096) +static void *grow_chunk(obstack_t *, int); +#endif // OBSTACK_C +#endif // OBSTACK_H diff --git a/src/parse.cc b/src/parse.cc new file mode 100644 index 0000000..0023202 --- /dev/null +++ b/src/parse.cc @@ -0,0 +1,5509 @@ +/* A Bison parser, made by GNU Bison 2.0. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 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., 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. */ + +/* 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 + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + LOWEST = 258, + IF = 259, + ELSE = 260, + OROR = 261, + ANDAND = 262, + ANDANDAND = 263, + XNOR = 264, + CASE_INEQUALITY = 265, + CASE_EQUALITY = 266, + LOGICAL_INEQUALITY = 267, + LOGICAL_EQUALITY = 268, + GE = 269, + GT = 270, + LE = 271, + LT = 272, + RIGHT_SHIFT = 273, + LEFT_SHIFT = 274, + REDUCTION_NOR = 275, + REDUCTION_NAND = 276, + UNARY = 277, + IDENTIFIER = 278, + HIERARCHY_IDENTIFIER = 279, + STARARROW = 280, + EQUALARROW = 281, + SPECPARAM = 282, + SETUP = 283, + HOLD = 284, + PERIOD = 285, + WIDTH = 286, + SKEW = 287, + RECOVERY = 288, + SETUPHOLD = 289, + NOCHANGE = 290, + MODULE = 291, + MACROMODULE = 292, + ENDMODULE = 293, + SPECIFY = 294, + ENDSPECIFY = 295, + PRIMITIVE = 296, + ENDPRIMITIVE = 297, + TABLE = 298, + ENDTABLE = 299, + TASK = 300, + ENDTASK = 301, + FUNCTION = 302, + ENDFUNCTION = 303, + PARAMETER = 304, + INPUT = 305, + OUTPUT = 306, + INOUT = 307, + NETTYPE = 308, + TRIREG = 309, + SCALARED = 310, + VECTORED = 311, + REG = 312, + TIME = 313, + INTEGER = 314, + REAL = 315, + EVENT = 316, + ASSIGN = 317, + DEFPARAM = 318, + STRENGTH0 = 319, + STRENGTH1 = 320, + SUPPLY0 = 321, + SUPPLY1 = 322, + LOGIC = 323, + BUFFER = 324, + BUFIF = 325, + CMOS = 326, + PULL = 327, + TRAN = 328, + INITIAL = 329, + ALWAYS = 330, + CASE = 331, + CASEZ = 332, + CASEX = 333, + ENDCASE = 334, + FOREVER = 335, + REPEAT = 336, + WHILE = 337, + FOR = 338, + WAIT_ = 339, + ARROW_ = 340, + DISABLE = 341, + DEASSIGN = 342, + FORCE = 343, + RELEASE = 344, + DEFAULT = 345, + BEGIN = 346, + END = 347, + FORK = 348, + JOIN = 349, + SYSTEM_IDENTIFIER = 350, + STRING = 351, + NUMBER = 352, + BASE_NUMBER = 353, + POSEDGE = 354, + NEGEDGE = 355, + OR = 356, + SMALL = 357, + MEDIUM = 358, + LARGE = 359, + EDGE = 360, + DOUBLE_DIGIT = 361, + UDP_CHAR = 362, + UDP_ONE = 363, + UDP_ZERO = 364, + UDP_X = 365, + UDP_B = 366, + UDP_HOOK = 367, + EOF_ = 368 + }; +#endif +#define LOWEST 258 +#define IF 259 +#define ELSE 260 +#define OROR 261 +#define ANDAND 262 +#define ANDANDAND 263 +#define XNOR 264 +#define CASE_INEQUALITY 265 +#define CASE_EQUALITY 266 +#define LOGICAL_INEQUALITY 267 +#define LOGICAL_EQUALITY 268 +#define GE 269 +#define GT 270 +#define LE 271 +#define LT 272 +#define RIGHT_SHIFT 273 +#define LEFT_SHIFT 274 +#define REDUCTION_NOR 275 +#define REDUCTION_NAND 276 +#define UNARY 277 +#define IDENTIFIER 278 +#define HIERARCHY_IDENTIFIER 279 +#define STARARROW 280 +#define EQUALARROW 281 +#define SPECPARAM 282 +#define SETUP 283 +#define HOLD 284 +#define PERIOD 285 +#define WIDTH 286 +#define SKEW 287 +#define RECOVERY 288 +#define SETUPHOLD 289 +#define NOCHANGE 290 +#define MODULE 291 +#define MACROMODULE 292 +#define ENDMODULE 293 +#define SPECIFY 294 +#define ENDSPECIFY 295 +#define PRIMITIVE 296 +#define ENDPRIMITIVE 297 +#define TABLE 298 +#define ENDTABLE 299 +#define TASK 300 +#define ENDTASK 301 +#define FUNCTION 302 +#define ENDFUNCTION 303 +#define PARAMETER 304 +#define INPUT 305 +#define OUTPUT 306 +#define INOUT 307 +#define NETTYPE 308 +#define TRIREG 309 +#define SCALARED 310 +#define VECTORED 311 +#define REG 312 +#define TIME 313 +#define INTEGER 314 +#define REAL 315 +#define EVENT 316 +#define ASSIGN 317 +#define DEFPARAM 318 +#define STRENGTH0 319 +#define STRENGTH1 320 +#define SUPPLY0 321 +#define SUPPLY1 322 +#define LOGIC 323 +#define BUFFER 324 +#define BUFIF 325 +#define CMOS 326 +#define PULL 327 +#define TRAN 328 +#define INITIAL 329 +#define ALWAYS 330 +#define CASE 331 +#define CASEZ 332 +#define CASEX 333 +#define ENDCASE 334 +#define FOREVER 335 +#define REPEAT 336 +#define WHILE 337 +#define FOR 338 +#define WAIT_ 339 +#define ARROW_ 340 +#define DISABLE 341 +#define DEASSIGN 342 +#define FORCE 343 +#define RELEASE 344 +#define DEFAULT 345 +#define BEGIN 346 +#define END 347 +#define FORK 348 +#define JOIN 349 +#define SYSTEM_IDENTIFIER 350 +#define STRING 351 +#define NUMBER 352 +#define BASE_NUMBER 353 +#define POSEDGE 354 +#define NEGEDGE 355 +#define OR 356 +#define SMALL 357 +#define MEDIUM 358 +#define LARGE 359 +#define EDGE 360 +#define DOUBLE_DIGIT 361 +#define UDP_CHAR 362 +#define UDP_ONE 363 +#define UDP_ZERO 364 +#define UDP_X 365 +#define UDP_B 366 +#define UDP_HOOK 367 +#define EOF_ 368 + + + + +/* Copy the first part of user declarations. */ +#line 22 "parse.yy" + +#define yyparse prog_parse +#define YYERROR_VERBOSE +#define YYDEBUG 2 + +#include +#include +#include +#include +#include +#include "glue.h" +#include "vtypes.h" +#include "tree.h" +#include "decl.h" +#include "flags.h" +#include "io.h" +#include "specify.h" +#include "gates.h" +#include "udp.h" +#include "lex.h" +#include "scope.h" +#include "veriwell.h" + + +#define syn_warning(TEXT) \ + if (synopsys_flag) \ + synopsys_warn(TEXT); + +#define function_error \ + if (in_function) \ + error ("Statement not allowed in a function", NULL_CHAR, NULL_CHAR) + +/* Used in BISON.SIM */ +extern char *token_buffer; + +void eat_block (short token); + +#ifdef __cplusplus + union YYSTYPE; + int yylex (YYSTYPE *); +#endif // __cplusplus + +/* list of parsed modules (exported in tree.h) */ +tree module_list = NULL_TREE; + +/* tree list of hierarchical references to be resolved at pass3 */ +tree hierarchical_list; + +/* The spec of the current declaration */ +tree current_spec; + +tree current_module; +tree current_case; +tree current_delay; +enum tree_type current_gatetype; + + +tree current_instance_module = NULL_TREE; +tree current_instance_param = NULL_TREE; +tree current_udp_string = NULL_TREE; + +tree interactive_statement; + +tree tmp_tree; + +/* Defined in decl.c */ +extern tree current_scope; + +/* Defined in verilog.c */ +extern int is_interactive; + + +/* Certain constructs are not allowed while inside a function. Also, ports + are treated differently in functions and tasks than for modules. */ +int in_function = 0; +int in_tf = 0; +int in_systask = 0; + +/* If inside continuous assignment, handle lval differently */ +enum lval_type lval_type = LVAL_REG; + +/* If inside instantiation port list, allow implicit net declarations. */ +int in_instantiation = 0; + +/* If inside event statement, accept event types. */ +int in_event = 0; + +void init_parse() +{ + current_instance_module = NULL_TREE; + current_instance_param = NULL_TREE; + current_udp_string = NULL_TREE; + in_function = 0; + in_tf = 0; + in_systask = 0; + lval_type = LVAL_REG; + in_instantiation = 0; + module_list = NULL_TREE; + hierarchical_list = NULL_TREE; + current_spec = NULL_TREE; + current_module = NULL_TREE; + current_case = NULL_TREE; + current_delay = NULL_TREE; + interactive_statement = NULL_TREE; + tmp_tree = NULL_TREE; +} + + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 132 "parse.yy" +typedef union YYSTYPE { + tree ttype; /* pointer to a tree node */ + int integer; /* used for integers */ +// inst ctype; /* pointer to an instruction node (code) */ +// Datum *dtype; /* pointer to a bit string for returning NUMBERs */ + lineno_t ltype; /* for passing line numbers */ + enum tree_code code; /* for operators */ + enum tree_type gtype; /* for gates */ + enum tree_type ntype; /* for nets (same as gtype, buy more readable) */ + char double_digit[2]; /* structure for parsing edges */ + char c; /* char used in udp parsing */ +} YYSTYPE; +/* Line 190 of yacc.c. */ +#line 424 "parse.cc" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +/* Line 213 of yacc.c. */ +#line 436 "parse.cc" + +#if ! defined (yyoverflow) || YYERROR_VERBOSE + +# ifndef YYFREE +# define YYFREE free +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# endif + +/* 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 +# else +# define YYSTACK_ALLOC alloca +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# endif +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short int yyss; + YYSTYPE yyvs; + }; + +/* 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 (short int) + 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 \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (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 (0) + +#endif + +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short int yysigned_char; +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 74 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 2571 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 138 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 212 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 519 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 998 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 368 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char 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, 32, 2, 134, 2, 29, 14, 2, + 30, 135, 27, 25, 128, 26, 129, 28, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 7, 137, + 2, 133, 2, 6, 136, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 31, 2, 132, 12, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 130, 11, 131, 33, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 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, 8, 9, 10, 13, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned short int yyprhs[] = +{ + 0, 0, 3, 5, 8, 10, 12, 14, 17, 19, + 21, 22, 23, 24, 34, 35, 38, 41, 45, 46, + 48, 52, 54, 58, 60, 66, 68, 72, 73, 75, + 79, 81, 86, 93, 95, 97, 99, 101, 103, 105, + 107, 109, 111, 113, 115, 117, 119, 120, 121, 122, + 134, 135, 138, 141, 143, 145, 149, 150, 156, 157, + 162, 164, 167, 170, 171, 174, 176, 178, 180, 182, + 184, 186, 191, 193, 195, 197, 199, 201, 202, 210, + 211, 220, 221, 223, 225, 227, 228, 231, 233, 235, + 237, 238, 244, 246, 250, 252, 256, 260, 264, 268, + 269, 274, 279, 284, 289, 292, 295, 298, 300, 304, + 306, 309, 313, 317, 320, 323, 326, 328, 330, 331, + 336, 341, 346, 350, 351, 357, 359, 361, 363, 365, + 368, 371, 372, 373, 379, 383, 385, 389, 391, 394, + 398, 402, 403, 408, 410, 414, 416, 419, 423, 427, + 428, 433, 437, 441, 447, 449, 453, 455, 458, 462, + 466, 468, 475, 477, 481, 483, 487, 488, 492, 496, + 500, 501, 503, 509, 515, 517, 519, 521, 523, 524, + 526, 532, 533, 537, 539, 541, 543, 545, 547, 549, + 551, 552, 556, 557, 562, 564, 568, 573, 577, 578, + 584, 585, 588, 593, 598, 605, 614, 616, 620, 622, + 626, 628, 631, 635, 639, 641, 645, 647, 650, 654, + 658, 663, 667, 669, 671, 673, 677, 679, 683, 685, + 686, 688, 692, 698, 703, 704, 708, 709, 713, 715, + 717, 720, 721, 729, 730, 731, 740, 741, 745, 746, + 753, 754, 761, 762, 773, 774, 778, 779, 783, 784, + 791, 792, 799, 800, 806, 807, 814, 815, 822, 823, + 830, 831, 836, 838, 840, 842, 844, 845, 850, 851, + 858, 859, 864, 865, 872, 873, 878, 879, 882, 884, + 886, 888, 889, 894, 896, 899, 901, 904, 908, 912, + 915, 917, 921, 923, 927, 929, 933, 934, 936, 937, + 942, 943, 951, 952, 957, 958, 966, 967, 970, 973, + 974, 977, 980, 981, 984, 986, 988, 991, 997, 1000, + 1001, 1008, 1010, 1012, 1014, 1019, 1026, 1027, 1031, 1034, + 1035, 1038, 1041, 1043, 1045, 1047, 1048, 1053, 1059, 1069, + 1080, 1091, 1103, 1109, 1116, 1118, 1122, 1124, 1128, 1132, + 1134, 1138, 1140, 1144, 1148, 1150, 1155, 1162, 1164, 1169, + 1176, 1178, 1184, 1192, 1206, 1208, 1210, 1212, 1214, 1216, + 1218, 1220, 1222, 1224, 1225, 1230, 1241, 1252, 1261, 1269, + 1280, 1291, 1302, 1315, 1327, 1328, 1331, 1333, 1336, 1341, + 1344, 1349, 1350, 1352, 1354, 1355, 1361, 1363, 1365, 1366, + 1372, 1374, 1378, 1380, 1382, 1386, 1389, 1393, 1397, 1401, + 1405, 1407, 1409, 1411, 1413, 1418, 1425, 1429, 1431, 1433, + 1437, 1441, 1443, 1446, 1450, 1454, 1458, 1460, 1462, 1464, + 1470, 1476, 1478, 1481, 1484, 1487, 1490, 1493, 1496, 1499, + 1502, 1505, 1508, 1512, 1516, 1520, 1521, 1526, 1527, 1532, + 1536, 1540, 1541, 1546, 1547, 1552, 1556, 1560, 1564, 1568, + 1572, 1576, 1580, 1584, 1588, 1592, 1596, 1600, 1606, 1608, + 1610, 1612, 1614, 1619, 1626, 1628, 1630, 1634, 1638, 1642, + 1649, 1654, 1659, 1661, 1663, 1665, 1667, 1669, 1670, 1672, + 1675, 1678, 1683, 1685, 1689, 1695, 1698, 1701, 1706, 1707, + 1711, 1712, 1718, 1720, 1723, 1726, 1730, 1732, 1734, 1736 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const short int yyrhs[] = +{ + 139, 0, -1, 242, -1, 140, 127, -1, 1, -1, + 127, -1, 141, -1, 140, 141, -1, 142, -1, 154, + -1, -1, -1, -1, 50, 143, 338, 144, 147, 349, + 145, 146, 52, -1, -1, 146, 153, -1, 146, 1, + -1, 30, 148, 347, -1, -1, 149, -1, 148, 128, + 149, -1, 1, -1, 148, 128, 1, -1, 150, -1, + 129, 37, 30, 150, 347, -1, 152, -1, 130, 151, + 131, -1, -1, 152, -1, 151, 128, 152, -1, 37, + -1, 37, 31, 326, 132, -1, 37, 31, 326, 7, + 326, 132, -1, 176, -1, 182, -1, 189, -1, 181, + -1, 217, -1, 225, -1, 204, -1, 195, -1, 288, + -1, 237, -1, 239, -1, 169, -1, 171, -1, -1, + -1, -1, 55, 155, 37, 156, 147, 349, 157, 158, + 161, 162, 56, -1, -1, 158, 159, -1, 158, 1, + -1, 182, -1, 160, -1, 71, 37, 349, -1, -1, + 88, 37, 133, 321, 349, -1, -1, 57, 163, 164, + 58, -1, 165, -1, 164, 165, -1, 166, 349, -1, + -1, 166, 167, -1, 121, -1, 126, -1, 123, -1, + 122, -1, 125, -1, 124, -1, 30, 168, 168, 347, + -1, 124, -1, 123, -1, 122, -1, 125, -1, 126, + -1, -1, 59, 37, 349, 170, 174, 241, 60, -1, + -1, 61, 173, 37, 349, 172, 174, 241, 62, -1, + -1, 216, -1, 73, -1, 74, -1, -1, 174, 175, + -1, 176, -1, 182, -1, 181, -1, -1, 63, 215, + 177, 178, 349, -1, 179, -1, 178, 128, 179, -1, + 1, -1, 178, 1, 179, -1, 178, 128, 1, -1, + 37, 133, 326, -1, 37, 133, 328, -1, -1, 185, + 180, 206, 349, -1, 187, 180, 208, 349, -1, 186, + 180, 209, 349, -1, 183, 180, 184, 349, -1, 64, + 215, -1, 65, 215, -1, 66, 215, -1, 37, -1, + 184, 128, 37, -1, 1, -1, 184, 1, -1, 184, + 1, 37, -1, 184, 128, 1, -1, 71, 215, -1, + 73, 215, -1, 72, 215, -1, 74, -1, 75, -1, + -1, 190, 188, 209, 349, -1, 191, 180, 209, 349, + -1, 190, 188, 198, 349, -1, 193, 194, 339, -1, + -1, 68, 192, 210, 194, 339, -1, 67, -1, 80, + -1, 81, -1, 216, -1, 69, 216, -1, 70, 216, + -1, -1, -1, 197, 180, 196, 201, 349, -1, 76, + 211, 339, -1, 199, -1, 198, 128, 199, -1, 1, + -1, 198, 1, -1, 198, 1, 199, -1, 198, 128, + 1, -1, -1, 37, 133, 200, 329, -1, 202, -1, + 201, 128, 202, -1, 1, -1, 201, 1, -1, 201, + 1, 202, -1, 201, 128, 1, -1, -1, 286, 133, + 203, 329, -1, 77, 205, 349, -1, 337, 133, 326, + -1, 205, 128, 337, 133, 326, -1, 207, -1, 206, + 128, 207, -1, 1, -1, 206, 1, -1, 206, 1, + 207, -1, 206, 128, 1, -1, 37, -1, 37, 31, + 326, 7, 326, 132, -1, 37, -1, 208, 128, 37, + -1, 37, -1, 209, 128, 37, -1, -1, 30, 116, + 347, -1, 30, 117, 347, -1, 30, 118, 347, -1, + -1, 212, -1, 30, 213, 128, 214, 347, -1, 30, + 214, 128, 213, 347, -1, 78, -1, 80, -1, 79, + -1, 81, -1, -1, 216, -1, 31, 326, 7, 326, + 348, -1, -1, 219, 218, 220, -1, 82, -1, 115, + -1, 83, -1, 84, -1, 85, -1, 86, -1, 87, + -1, -1, 221, 223, 349, -1, -1, 340, 222, 223, + 349, -1, 224, -1, 223, 128, 224, -1, 37, 30, + 229, 347, -1, 30, 229, 347, -1, -1, 37, 227, + 226, 230, 349, -1, -1, 134, 326, -1, 134, 30, + 228, 135, -1, 134, 30, 327, 135, -1, 134, 30, + 327, 128, 327, 135, -1, 134, 30, 327, 128, 327, + 128, 327, 135, -1, 326, -1, 228, 128, 326, -1, + 329, -1, 229, 128, 329, -1, 1, -1, 229, 1, + -1, 229, 1, 329, -1, 229, 128, 1, -1, 231, + -1, 230, 128, 231, -1, 1, -1, 230, 1, -1, + 230, 1, 231, -1, 230, 128, 1, -1, 37, 30, + 232, 347, -1, 30, 232, 347, -1, 233, -1, 235, + -1, 234, -1, 233, 128, 234, -1, 1, -1, 233, + 128, 1, -1, 329, -1, -1, 236, -1, 235, 128, + 236, -1, 129, 37, 30, 329, 347, -1, 129, 37, + 30, 347, -1, -1, 88, 238, 242, -1, -1, 89, + 240, 242, -1, 242, -1, 349, -1, 266, 349, -1, + -1, 4, 243, 30, 329, 347, 241, 264, -1, -1, + -1, 244, 265, 245, 30, 329, 347, 268, 93, -1, + -1, 94, 246, 242, -1, -1, 95, 247, 30, 329, + 347, 242, -1, -1, 96, 248, 30, 329, 347, 242, + -1, -1, 97, 249, 30, 266, 349, 329, 349, 266, + 347, 242, -1, -1, 342, 250, 241, -1, -1, 343, + 251, 241, -1, -1, 286, 133, 252, 342, 329, 349, + -1, -1, 286, 133, 253, 343, 329, 349, -1, -1, + 286, 21, 254, 329, 349, -1, -1, 286, 21, 255, + 342, 329, 349, -1, -1, 286, 21, 256, 343, 329, + 349, -1, -1, 98, 257, 30, 325, 347, 241, -1, + -1, 99, 258, 337, 349, -1, 273, -1, 276, -1, + 283, -1, 284, -1, -1, 100, 259, 337, 349, -1, + -1, 76, 260, 286, 133, 329, 349, -1, -1, 101, + 261, 286, 349, -1, -1, 102, 262, 286, 133, 329, + 349, -1, -1, 103, 263, 286, 349, -1, -1, 5, + 241, -1, 90, -1, 91, -1, 92, -1, -1, 286, + 133, 267, 329, -1, 269, -1, 268, 269, -1, 1, + -1, 268, 1, -1, 270, 7, 241, -1, 104, 7, + 241, -1, 104, 241, -1, 329, -1, 270, 128, 329, + -1, 1, -1, 270, 128, 1, -1, 272, -1, 271, + 128, 272, -1, -1, 329, -1, -1, 105, 274, 279, + 106, -1, -1, 105, 7, 37, 275, 281, 279, 106, + -1, -1, 107, 277, 280, 108, -1, -1, 107, 7, + 37, 278, 281, 280, 108, -1, -1, 279, 242, -1, + 279, 1, -1, -1, 280, 242, -1, 280, 1, -1, + -1, 281, 282, -1, 176, -1, 181, -1, 337, 349, + -1, 337, 30, 270, 347, 349, -1, 109, 349, -1, + -1, 109, 285, 30, 271, 347, 349, -1, 287, -1, + 323, -1, 337, -1, 337, 31, 329, 132, -1, 337, + 31, 329, 7, 329, 132, -1, -1, 53, 289, 290, + -1, 291, 54, -1, -1, 291, 292, -1, 291, 1, + -1, 293, -1, 295, -1, 309, -1, -1, 41, 294, + 178, 349, -1, 308, 296, 133, 301, 349, -1, 30, + 297, 304, 30, 298, 7, 306, 347, 347, -1, 30, + 307, 297, 304, 30, 298, 7, 306, 347, 347, -1, + 30, 297, 304, 30, 298, 303, 7, 306, 347, 347, + -1, 30, 307, 297, 304, 30, 298, 303, 7, 306, + 347, 347, -1, 30, 297, 304, 298, 347, -1, 30, + 297, 303, 304, 298, 347, -1, 299, -1, 297, 128, + 299, -1, 1, -1, 297, 1, 299, -1, 297, 128, + 1, -1, 300, -1, 298, 128, 300, -1, 1, -1, + 298, 1, 300, -1, 298, 128, 1, -1, 37, -1, + 37, 31, 326, 348, -1, 37, 31, 326, 7, 326, + 348, -1, 37, -1, 37, 31, 326, 348, -1, 37, + 31, 326, 7, 326, 348, -1, 302, -1, 30, 302, + 128, 302, 347, -1, 30, 302, 128, 302, 128, 302, + 347, -1, 30, 302, 128, 302, 128, 302, 128, 302, + 128, 302, 128, 302, 347, -1, 327, -1, 25, -1, + 26, -1, 39, -1, 40, -1, 329, -1, 329, -1, + 113, -1, 114, -1, -1, 4, 30, 305, 347, -1, + 42, 30, 312, 128, 312, 128, 329, 310, 347, 349, + -1, 43, 30, 312, 128, 312, 128, 329, 310, 347, + 349, -1, 44, 30, 313, 128, 329, 310, 347, 349, + -1, 45, 30, 313, 128, 329, 347, 349, -1, 45, + 30, 313, 128, 329, 128, 329, 310, 347, 349, -1, + 46, 30, 312, 128, 312, 128, 329, 310, 347, 349, + -1, 47, 30, 313, 128, 312, 128, 329, 310, 347, + 349, -1, 48, 30, 312, 128, 312, 128, 329, 128, + 329, 310, 347, 349, -1, 49, 30, 313, 128, 312, + 128, 329, 128, 329, 347, 349, -1, -1, 128, 311, + -1, 37, -1, 314, 322, -1, 314, 322, 10, 319, + -1, 316, 322, -1, 316, 322, 10, 319, -1, -1, + 113, -1, 114, -1, -1, 119, 31, 315, 318, 348, + -1, 113, -1, 114, -1, -1, 119, 31, 317, 318, + 348, -1, 120, -1, 120, 128, 318, -1, 1, -1, + 320, -1, 30, 319, 135, -1, 33, 320, -1, 320, + 18, 321, -1, 320, 16, 321, -1, 320, 15, 321, + -1, 320, 17, 321, -1, 37, -1, 112, -1, 111, + -1, 337, -1, 337, 31, 329, 132, -1, 337, 31, + 326, 7, 326, 132, -1, 130, 324, 131, -1, 287, + -1, 323, -1, 324, 128, 287, -1, 324, 128, 323, + -1, 1, -1, 324, 1, -1, 324, 1, 287, -1, + 324, 1, 323, -1, 324, 128, 1, -1, 329, -1, + 329, -1, 329, -1, 329, 7, 329, 7, 329, -1, + 329, 7, 329, 7, 329, -1, 334, -1, 25, 334, + -1, 26, 334, -1, 32, 334, -1, 33, 334, -1, + 14, 334, -1, 35, 334, -1, 11, 334, -1, 34, + 334, -1, 12, 334, -1, 13, 334, -1, 329, 25, + 329, -1, 329, 26, 329, -1, 329, 27, 329, -1, + -1, 329, 28, 330, 329, -1, -1, 329, 29, 331, + 329, -1, 329, 18, 329, -1, 329, 17, 329, -1, + -1, 329, 16, 332, 329, -1, -1, 329, 15, 333, + 329, -1, 329, 9, 329, -1, 329, 8, 329, -1, + 329, 22, 329, -1, 329, 21, 329, -1, 329, 20, + 329, -1, 329, 19, 329, -1, 329, 14, 329, -1, + 329, 11, 329, -1, 329, 12, 329, -1, 329, 13, + 329, -1, 329, 24, 329, -1, 329, 23, 329, -1, + 329, 6, 329, 7, 329, -1, 110, -1, 111, -1, + 112, -1, 337, -1, 337, 31, 329, 132, -1, 337, + 31, 326, 7, 326, 132, -1, 335, -1, 336, -1, + 30, 327, 347, -1, 30, 1, 347, -1, 130, 270, + 131, -1, 130, 326, 130, 270, 131, 131, -1, 337, + 30, 271, 347, -1, 109, 30, 271, 347, -1, 109, + -1, 38, -1, 37, -1, 37, -1, 115, -1, -1, + 340, -1, 134, 111, -1, 134, 337, -1, 134, 30, + 341, 347, -1, 327, -1, 327, 128, 327, -1, 327, + 128, 327, 128, 327, -1, 134, 111, -1, 134, 337, + -1, 134, 30, 327, 347, -1, -1, 136, 344, 337, + -1, -1, 136, 30, 345, 346, 347, -1, 329, -1, + 113, 329, -1, 114, 329, -1, 346, 115, 346, -1, + 135, -1, 132, -1, 1, -1, 137, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short int yyrline[] = +{ + 0, 425, 425, 434, 435, 444, 453, 454, 466, 467, + 472, 477, 486, 471, 498, 500, 502, 506, 509, 513, + 514, 518, 524, 528, 534, 539, 540, 545, 549, 551, + 556, 558, 563, 571, 572, 573, 574, 575, 576, 579, + 580, 581, 582, 586, 590, 591, 606, 611, 618, 605, + 628, 629, 631, 635, 636, 640, 654, 655, 674, 673, + 685, 686, 692, 701, 702, 706, 711, 716, 721, 726, + 731, 736, 751, 752, 753, 754, 755, 760, 759, 780, + 779, 799, 800, 802, 804, 810, 811, 815, 816, 817, + 826, 825, 834, 835, 839, 840, 842, 846, 849, 856, + 860, 863, 866, 873, 881, 888, 896, 908, 910, 914, + 915, 916, 918, 922, 924, 929, 936, 941, 948, 952, + 958, 959, 968, 976, 975, 984, 985, 987, 999, 1000, + 1005, 1011, 1016, 1015, 1025, 1032, 1034, 1038, 1039, 1040, + 1042, 1046, 1046, 1056, 1058, 1062, 1063, 1064, 1066, 1070, + 1070, 1076, 1081, 1086, 1095, 1096, 1100, 1101, 1102, 1104, + 1108, 1110, 1117, 1119, 1124, 1126, 1132, 1133, 1135, 1137, + 1143, 1144, 1152, 1154, 1159, 1160, 1164, 1165, 1179, 1180, + 1184, 1201, 1200, 1211, 1213, 1215, 1217, 1219, 1221, 1223, + 1237, 1237, 1243, 1242, 1248, 1249, 1253, 1259, 1271, 1270, + 1307, 1308, 1310, 1312, 1314, 1318, 1326, 1328, 1355, 1357, + 1360, 1361, 1362, 1364, 1374, 1375, 1377, 1378, 1379, 1381, + 1385, 1393, 1403, 1404, 1408, 1409, 1413, 1414, 1418, 1421, + 1425, 1426, 1431, 1434, 1442, 1441, 1449, 1449, 1455, 1456, + 1461, 1464, 1464, 1468, 1470, 1468, 1479, 1478, 1485, 1484, + 1494, 1493, 1499, 1499, 1510, 1509, 1518, 1517, 1527, 1526, + 1538, 1537, 1548, 1547, 1559, 1558, 1570, 1569, 1586, 1585, + 1594, 1593, 1601, 1602, 1603, 1604, 1605, 1605, 1612, 1611, + 1618, 1617, 1622, 1622, 1631, 1631, 1643, 1645, 1650, 1652, + 1654, 1666, 1666, 1673, 1674, 1678, 1679, 1683, 1686, 1691, + 1699, 1701, 1703, 1704, 1708, 1715, 1725, 1726, 1731, 1730, + 1738, 1737, 1762, 1761, 1770, 1769, 1793, 1794, 1798, 1803, + 1804, 1808, 1813, 1814, 1818, 1819, 1823, 1829, 1837, 1840, + 1839, 1848, 1850, 1855, 1857, 1860, 1871, 1870, 1879, 1885, + 1886, 1891, 1894, 1895, 1896, 1915, 1914, 1923, 1934, 1942, + 1950, 1958, 1966, 1972, 1980, 1981, 1985, 1986, 1988, 1991, + 1992, 1996, 1997, 1999, 2002, 2006, 2010, 2016, 2020, 2024, + 2030, 2031, 2035, 2042, 2055, 2061, 2065, 2071, 2075, 2081, + 2086, 2089, 2093, 2100, 2103, 2110, 2115, 2120, 2125, 2130, + 2135, 2140, 2145, 2150, 2158, 2161, 2167, 2170, 2174, 2181, + 2185, 2193, 2197, 2202, 2208, 2207, 2219, 2224, 2230, 2229, + 2241, 2246, 2251, 2257, 2258, 2260, 2262, 2264, 2266, 2268, + 2272, 2276, 2280, 2287, 2292, 2297, 2310, 2318, 2320, 2322, + 2324, 2326, 2327, 2328, 2329, 2330, 2334, 2338, 2349, 2350, + 2360, 2370, 2371, 2373, 2375, 2377, 2379, 2381, 2383, 2385, + 2387, 2389, 2391, 2393, 2395, 2398, 2397, 2402, 2401, 2405, + 2407, 2410, 2409, 2414, 2413, 2417, 2419, 2421, 2423, 2425, + 2427, 2429, 2431, 2433, 2435, 2437, 2439, 2441, 2443, 2463, + 2464, 2465, 2467, 2469, 2471, 2472, 2473, 2475, 2508, 2513, + 2522, 2527, 2531, 2542, 2551, 2555, 2556, 2576, 2577, 2581, + 2585, 2590, 2599, 2603, 2607, 2614, 2616, 2618, 2623, 2623, + 2635, 2635, 2642, 2649, 2652, 2655, 2664, 2669, 2671, 2676 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE +/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "LOWEST", "IF", "ELSE", "'?'", "':'", + "OROR", "ANDAND", "ANDANDAND", "'|'", "'^'", "XNOR", "'&'", + "CASE_INEQUALITY", "CASE_EQUALITY", "LOGICAL_INEQUALITY", + "LOGICAL_EQUALITY", "GE", "GT", "LE", "LT", "RIGHT_SHIFT", "LEFT_SHIFT", + "'+'", "'-'", "'*'", "'/'", "'%'", "'('", "'['", "'!'", "'~'", + "REDUCTION_NOR", "REDUCTION_NAND", "UNARY", "IDENTIFIER", + "HIERARCHY_IDENTIFIER", "STARARROW", "EQUALARROW", "SPECPARAM", "SETUP", + "HOLD", "PERIOD", "WIDTH", "SKEW", "RECOVERY", "SETUPHOLD", "NOCHANGE", + "MODULE", "MACROMODULE", "ENDMODULE", "SPECIFY", "ENDSPECIFY", + "PRIMITIVE", "ENDPRIMITIVE", "TABLE", "ENDTABLE", "TASK", "ENDTASK", + "FUNCTION", "ENDFUNCTION", "PARAMETER", "INPUT", "OUTPUT", "INOUT", + "NETTYPE", "TRIREG", "SCALARED", "VECTORED", "REG", "TIME", "INTEGER", + "REAL", "EVENT", "ASSIGN", "DEFPARAM", "STRENGTH0", "STRENGTH1", + "SUPPLY0", "SUPPLY1", "LOGIC", "BUFFER", "BUFIF", "CMOS", "PULL", "TRAN", + "INITIAL", "ALWAYS", "CASE", "CASEZ", "CASEX", "ENDCASE", "FOREVER", + "REPEAT", "WHILE", "FOR", "WAIT_", "ARROW_", "DISABLE", "DEASSIGN", + "FORCE", "RELEASE", "DEFAULT", "BEGIN", "END", "FORK", "JOIN", + "SYSTEM_IDENTIFIER", "STRING", "NUMBER", "BASE_NUMBER", "POSEDGE", + "NEGEDGE", "OR", "SMALL", "MEDIUM", "LARGE", "EDGE", "DOUBLE_DIGIT", + "UDP_CHAR", "UDP_ONE", "UDP_ZERO", "UDP_X", "UDP_B", "UDP_HOOK", "EOF_", + "','", "'.'", "'{'", "'}'", "']'", "'='", "'#'", "')'", "'@'", "';'", + "$accept", "source_text", "description_list", "description", "module", + "@1", "@2", "@3", "module_item_list", "list_of_ports_o", "port_clist", + "port", "port_expression_o", "port_reference_clist", "port_reference", + "module_item", "UDP", "@4", "@5", "@6", "UDP_declarations", + "UDP_declaration", "UDP_reg_statement", "UDP_initial_statement", + "UDP_table_definition", "@7", "table_entry_list", "table_entry", + "table_digit_list", "table_digit", "table_digit1", "task", "@8", + "function", "@9", "function_type", "tf_declaration_list", + "tf_declaration", "parameter_declaration", "@10", + "list_of_param_assignments", "param_assignment", "setspec", + "static_declaration", "port_declaration", "port_spec", + "port_decl_identifiers", "reg_spec", "real_spec", "event_spec", + "setnetspec", "net_declaration", "net_spec", "trireg_spec", "@11", + "nettype", "expandrange_o", "continuous_assign", "@12", "assign_spec", + "list_of_net_assignments", "net_assignment", "@13", + "list_of_assignments", "cont_assignment", "@14", "parameter_override", + "list_of_param_overrides", "reg_decl_identifiers", "reg_decl_identifier", + "non_reg_decl_identifiers", "decl_identifiers", "charge_strength_o", + "drive_strength_o", "drive_strength", "strength0", "strength1", "xrange", + "range", "gate_declaration", "@15", "gatetype", "gate_description", + "@16", "@17", "gate_instance_clist", "gate_instance", + "UDP_or_module_instantiation", "@18", "xparameter_value_assignment", + "constant_expression_clist", "terminal_clist", "module_instance_clist", + "module_instance", "list_of_module_connections_o", + "module_port_connection_clist", "module_port_connection", + "named_port_connection_clist", "named_port_connection", + "initial_statement", "@19", "always_statement", "@20", + "statement_or_null", "statement", "@21", "@22", "@23", "@24", "@25", + "@26", "@27", "@28", "@29", "@30", "@31", "@32", "@33", "@34", "@35", + "@36", "@37", "@38", "@39", "@40", "@41", "elsepart", "case", + "assignment", "@42", "case_item_plist", "case_expr", "expression_clist", + "xexpression_clist", "xexpression", "seq_block", "@43", "@44", + "par_block", "@45", "@46", "statement_list", "statement_tree_list", + "block_declaration_list", "block_declaration", "task_enable", + "system_task_enable", "@47", "lvalue", "lval_normal", "specify_block", + "@48", "specify_stuff", "specify_items", "specify_item", + "specparam_declaration", "@49", "path_declaration", "path_description", + "list_of_path_inputs", "list_of_path_outputs", + "specify_input_terminal_descriptor", + "specify_output_terminal_descriptor", "path_delay_value", + "path_delay_expression", "polarity_operator", "path_operator", + "conditional_port_expression", "data_source_expression", + "edge_identifier", "specify_if_clause", "system_timing_check", + "notify_clause", "notify_register", "timing_check_event", + "controlled_timing_check_event", "timing_check_event_control", "@50", + "timing_check_event_control_no_empty", "@51", "edge_list", + "timing_check_condition", "scalar_expression", "scalar_constant", + "timing_input_terminal_descriptor", "lval_concat", "lval_clist", + "conditional_expression", "constant_expression", "mintypmax_expression", + "mintypmax_expression_triplet", "expression", "@52", "@53", "@54", "@55", + "primary", "concatenation", "function_call", "identifier", + "IDENTIFIER_or_OR", "delay_o", "delay", "mintypmax_clist", + "delay_control", "event_control", "@56", "@57", "event_expression", "rp", + "rb", "sc", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short int yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 63, 58, 261, 262, + 263, 124, 94, 264, 38, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 43, 45, 42, 47, 37, + 40, 91, 33, 126, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, + 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, + 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, + 361, 362, 363, 364, 365, 366, 367, 368, 44, 46, + 123, 125, 93, 61, 35, 41, 64, 59 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned short int yyr1[] = +{ + 0, 138, 139, 139, 139, 139, 140, 140, 141, 141, + 143, 144, 145, 142, 146, 146, 146, 147, 147, 148, + 148, 148, 148, 149, 149, 150, 150, 150, 151, 151, + 152, 152, 152, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 153, 155, 156, 157, 154, + 158, 158, 158, 159, 159, 160, 161, 161, 163, 162, + 164, 164, 165, 166, 166, 167, 167, 167, 167, 167, + 167, 167, 168, 168, 168, 168, 168, 170, 169, 172, + 171, 173, 173, 173, 173, 174, 174, 175, 175, 175, + 177, 176, 178, 178, 178, 178, 178, 179, 179, 180, + 181, 181, 181, 182, 183, 183, 183, 184, 184, 184, + 184, 184, 184, 185, 185, 185, 186, 187, 188, 189, + 189, 189, 190, 192, 191, 193, 193, 193, 194, 194, + 194, 194, 196, 195, 197, 198, 198, 198, 198, 198, + 198, 200, 199, 201, 201, 201, 201, 201, 201, 203, + 202, 204, 205, 205, 206, 206, 206, 206, 206, 206, + 207, 207, 208, 208, 209, 209, 210, 210, 210, 210, + 211, 211, 212, 212, 213, 213, 214, 214, 215, 215, + 216, 218, 217, 219, 219, 219, 219, 219, 219, 219, + 221, 220, 222, 220, 223, 223, 224, 224, 226, 225, + 227, 227, 227, 227, 227, 227, 228, 228, 229, 229, + 229, 229, 229, 229, 230, 230, 230, 230, 230, 230, + 231, 231, 232, 232, 233, 233, 233, 233, 234, 234, + 235, 235, 236, 236, 238, 237, 240, 239, 241, 241, + 242, 243, 242, 244, 245, 242, 246, 242, 247, 242, + 248, 242, 249, 242, 250, 242, 251, 242, 252, 242, + 253, 242, 254, 242, 255, 242, 256, 242, 257, 242, + 258, 242, 242, 242, 242, 242, 259, 242, 260, 242, + 261, 242, 262, 242, 263, 242, 264, 264, 265, 265, + 265, 267, 266, 268, 268, 268, 268, 269, 269, 269, + 270, 270, 270, 270, 271, 271, 272, 272, 274, 273, + 275, 273, 277, 276, 278, 276, 279, 279, 279, 280, + 280, 280, 281, 281, 282, 282, 283, 283, 284, 285, + 284, 286, 286, 287, 287, 287, 289, 288, 290, 291, + 291, 291, 292, 292, 292, 294, 293, 295, 296, 296, + 296, 296, 296, 296, 297, 297, 297, 297, 297, 298, + 298, 298, 298, 298, 299, 299, 299, 300, 300, 300, + 301, 301, 301, 301, 302, 303, 303, 304, 304, 305, + 306, 307, 307, 308, 308, 309, 309, 309, 309, 309, + 309, 309, 309, 309, 310, 310, 311, 312, 312, 313, + 313, 314, 314, 314, 315, 314, 316, 316, 317, 316, + 318, 318, 318, 319, 319, 319, 319, 319, 319, 319, + 320, 321, 321, 322, 322, 322, 323, 324, 324, 324, + 324, 324, 324, 324, 324, 324, 325, 326, 327, 327, + 328, 329, 329, 329, 329, 329, 329, 329, 329, 329, + 329, 329, 329, 329, 329, 330, 329, 331, 329, 329, + 329, 332, 329, 333, 329, 329, 329, 329, 329, 329, + 329, 329, 329, 329, 329, 329, 329, 329, 329, 334, + 334, 334, 334, 334, 334, 334, 334, 334, 335, 335, + 336, 336, 336, 337, 337, 338, 338, 339, 339, 340, + 340, 340, 341, 341, 341, 342, 342, 342, 344, 343, + 345, 343, 346, 346, 346, 346, 347, 348, 348, 349 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const unsigned char yyr2[] = +{ + 0, 2, 1, 2, 1, 1, 1, 2, 1, 1, + 0, 0, 0, 9, 0, 2, 2, 3, 0, 1, + 3, 1, 3, 1, 5, 1, 3, 0, 1, 3, + 1, 4, 6, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 0, 0, 0, 11, + 0, 2, 2, 1, 1, 3, 0, 5, 0, 4, + 1, 2, 2, 0, 2, 1, 1, 1, 1, 1, + 1, 4, 1, 1, 1, 1, 1, 0, 7, 0, + 8, 0, 1, 1, 1, 0, 2, 1, 1, 1, + 0, 5, 1, 3, 1, 3, 3, 3, 3, 0, + 4, 4, 4, 4, 2, 2, 2, 1, 3, 1, + 2, 3, 3, 2, 2, 2, 1, 1, 0, 4, + 4, 4, 3, 0, 5, 1, 1, 1, 1, 2, + 2, 0, 0, 5, 3, 1, 3, 1, 2, 3, + 3, 0, 4, 1, 3, 1, 2, 3, 3, 0, + 4, 3, 3, 5, 1, 3, 1, 2, 3, 3, + 1, 6, 1, 3, 1, 3, 0, 3, 3, 3, + 0, 1, 5, 5, 1, 1, 1, 1, 0, 1, + 5, 0, 3, 1, 1, 1, 1, 1, 1, 1, + 0, 3, 0, 4, 1, 3, 4, 3, 0, 5, + 0, 2, 4, 4, 6, 8, 1, 3, 1, 3, + 1, 2, 3, 3, 1, 3, 1, 2, 3, 3, + 4, 3, 1, 1, 1, 3, 1, 3, 1, 0, + 1, 3, 5, 4, 0, 3, 0, 3, 1, 1, + 2, 0, 7, 0, 0, 8, 0, 3, 0, 6, + 0, 6, 0, 10, 0, 3, 0, 3, 0, 6, + 0, 6, 0, 5, 0, 6, 0, 6, 0, 6, + 0, 4, 1, 1, 1, 1, 0, 4, 0, 6, + 0, 4, 0, 6, 0, 4, 0, 2, 1, 1, + 1, 0, 4, 1, 2, 1, 2, 3, 3, 2, + 1, 3, 1, 3, 1, 3, 0, 1, 0, 4, + 0, 7, 0, 4, 0, 7, 0, 2, 2, 0, + 2, 2, 0, 2, 1, 1, 2, 5, 2, 0, + 6, 1, 1, 1, 4, 6, 0, 3, 2, 0, + 2, 2, 1, 1, 1, 0, 4, 5, 9, 10, + 10, 11, 5, 6, 1, 3, 1, 3, 3, 1, + 3, 1, 3, 3, 1, 4, 6, 1, 4, 6, + 1, 5, 7, 13, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 0, 4, 10, 10, 8, 7, 10, + 10, 10, 12, 11, 0, 2, 1, 2, 4, 2, + 4, 0, 1, 1, 0, 5, 1, 1, 0, 5, + 1, 3, 1, 1, 3, 2, 3, 3, 3, 3, + 1, 1, 1, 1, 4, 6, 3, 1, 1, 3, + 3, 1, 2, 3, 3, 3, 1, 1, 1, 5, + 5, 1, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 3, 3, 3, 0, 4, 0, 4, 3, + 3, 0, 4, 0, 4, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 5, 1, 1, + 1, 1, 4, 6, 1, 1, 3, 3, 3, 6, + 4, 4, 1, 1, 1, 1, 1, 0, 1, 2, + 2, 4, 1, 3, 5, 2, 2, 4, 0, 3, + 0, 5, 1, 2, 2, 3, 1, 1, 1, 1 +}; + +/* 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 unsigned short int yydefact[] = +{ + 0, 4, 241, 494, 493, 10, 46, 278, 246, 248, + 250, 252, 268, 270, 276, 280, 282, 284, 308, 312, + 329, 5, 0, 0, 508, 0, 0, 6, 8, 9, + 2, 0, 0, 272, 273, 274, 275, 0, 331, 332, + 333, 254, 256, 0, 0, 0, 0, 243, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 316, 0, + 319, 519, 0, 328, 431, 427, 428, 0, 333, 0, + 505, 506, 510, 0, 1, 3, 7, 288, 289, 290, + 244, 240, 262, 291, 0, 0, 326, 243, 243, 0, + 495, 496, 11, 47, 0, 247, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 310, 0, 314, 0, 306, + 432, 0, 426, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 492, 478, 479, 480, 0, 0, + 438, 441, 484, 485, 481, 0, 509, 0, 0, 0, + 0, 0, 0, 0, 302, 0, 300, 0, 255, 238, + 239, 257, 0, 18, 18, 0, 0, 0, 0, 0, + 0, 436, 271, 277, 281, 0, 285, 322, 318, 309, + 317, 322, 321, 313, 320, 0, 304, 307, 433, 434, + 435, 429, 430, 448, 450, 451, 446, 442, 443, 0, + 0, 444, 445, 449, 447, 306, 0, 0, 300, 516, + 507, 0, 0, 0, 0, 0, 0, 0, 0, 463, + 461, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 455, 457, 306, 0, 0, 0, 512, 0, + 0, 0, 0, 0, 0, 0, 292, 0, 0, 0, + 334, 243, 0, 0, 0, 0, 243, 243, 0, 291, + 243, 0, 316, 319, 306, 0, 487, 486, 0, 488, + 0, 0, 0, 466, 465, 472, 473, 474, 471, 0, + 0, 460, 459, 470, 469, 468, 467, 476, 475, 452, + 453, 454, 0, 0, 0, 0, 437, 513, 514, 0, + 511, 0, 263, 0, 0, 0, 0, 303, 301, 327, + 0, 286, 21, 30, 0, 0, 0, 19, 23, 25, + 12, 48, 279, 249, 251, 0, 269, 283, 178, 178, + 178, 178, 116, 117, 324, 325, 99, 99, 99, 0, + 323, 0, 305, 330, 491, 0, 0, 0, 464, 462, + 456, 458, 490, 0, 482, 515, 0, 265, 267, 259, + 261, 335, 243, 242, 0, 0, 0, 28, 0, 17, + 14, 50, 0, 0, 90, 179, 113, 115, 114, 0, + 0, 0, 311, 315, 0, 477, 439, 0, 437, 295, + 243, 0, 293, 0, 287, 0, 27, 0, 26, 22, + 20, 0, 0, 0, 0, 0, 156, 160, 0, 154, + 164, 0, 162, 0, 489, 483, 243, 299, 296, 245, + 294, 243, 0, 31, 0, 29, 16, 200, 13, 336, + 0, 81, 178, 178, 178, 125, 123, 170, 0, 126, + 127, 183, 185, 186, 187, 188, 189, 234, 236, 184, + 15, 44, 45, 33, 36, 34, 99, 35, 118, 99, + 131, 40, 99, 39, 37, 181, 38, 42, 43, 41, + 52, 0, 0, 51, 54, 0, 53, 243, 0, 94, + 0, 0, 92, 0, 157, 0, 100, 0, 102, 0, + 101, 298, 297, 0, 24, 0, 198, 339, 0, 83, + 84, 0, 82, 104, 105, 106, 166, 0, 497, 171, + 0, 0, 243, 243, 0, 0, 0, 0, 0, 497, + 128, 132, 190, 0, 0, 58, 0, 253, 0, 0, + 0, 0, 91, 0, 158, 159, 155, 165, 163, 32, + 0, 201, 0, 337, 0, 77, 0, 0, 131, 174, + 176, 175, 177, 0, 0, 0, 134, 498, 0, 151, + 0, 235, 237, 109, 107, 0, 137, 164, 0, 135, + 0, 0, 129, 130, 122, 0, 182, 0, 192, 55, + 0, 63, 49, 518, 517, 180, 97, 98, 437, 95, + 96, 93, 0, 0, 206, 0, 437, 216, 0, 0, + 0, 214, 341, 0, 345, 0, 0, 0, 0, 0, + 0, 0, 0, 338, 340, 342, 343, 0, 344, 85, + 79, 0, 0, 0, 497, 0, 0, 0, 499, 500, + 0, 152, 110, 0, 103, 141, 138, 0, 121, 119, + 120, 145, 0, 143, 0, 0, 0, 0, 194, 0, + 422, 421, 0, 63, 60, 0, 0, 0, 0, 202, + 0, 516, 226, 0, 0, 222, 224, 223, 230, 228, + 0, 217, 0, 199, 0, 0, 401, 401, 0, 0, + 401, 0, 401, 0, 0, 0, 243, 85, 167, 168, + 169, 124, 0, 0, 502, 0, 0, 111, 112, 108, + 0, 0, 139, 140, 136, 146, 0, 133, 149, 210, + 0, 208, 0, 0, 191, 0, 57, 59, 61, 0, + 65, 68, 67, 70, 69, 66, 64, 62, 0, 161, + 207, 0, 0, 221, 0, 0, 0, 218, 219, 215, + 0, 379, 0, 402, 403, 0, 0, 0, 0, 406, + 407, 0, 0, 0, 0, 0, 0, 0, 0, 356, + 364, 381, 382, 0, 354, 0, 0, 86, 87, 89, + 88, 0, 243, 172, 173, 0, 501, 153, 142, 147, + 148, 144, 0, 211, 0, 197, 0, 195, 193, 74, + 73, 72, 75, 76, 0, 0, 0, 204, 0, 227, + 225, 231, 220, 384, 346, 404, 401, 397, 423, 401, + 408, 0, 399, 0, 401, 401, 401, 401, 0, 0, + 375, 376, 377, 378, 0, 0, 0, 0, 0, 0, + 370, 374, 78, 0, 503, 150, 212, 213, 209, 196, + 0, 440, 0, 0, 233, 0, 0, 0, 0, 0, + 0, 394, 0, 0, 0, 0, 0, 0, 0, 357, + 358, 355, 0, 361, 0, 367, 0, 359, 0, 0, + 374, 347, 80, 0, 71, 205, 232, 412, 410, 0, + 0, 0, 0, 420, 398, 413, 0, 437, 0, 0, + 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, + 365, 0, 0, 0, 0, 0, 352, 0, 0, 504, + 0, 405, 394, 0, 415, 0, 0, 0, 0, 0, + 424, 394, 409, 396, 395, 0, 394, 388, 394, 394, + 0, 0, 0, 353, 0, 0, 0, 362, 363, 360, + 0, 0, 411, 0, 414, 418, 417, 419, 416, 0, + 0, 387, 0, 0, 0, 0, 0, 366, 0, 380, + 0, 0, 368, 0, 0, 0, 371, 0, 425, 0, + 0, 0, 0, 394, 0, 0, 0, 0, 0, 0, + 0, 385, 386, 389, 390, 391, 0, 0, 348, 0, + 369, 0, 0, 0, 372, 0, 393, 350, 349, 0, + 0, 392, 351, 0, 0, 0, 0, 373 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const short int yydefgoto[] = +{ + -1, 25, 26, 27, 28, 44, 153, 360, 391, 243, + 306, 307, 308, 356, 309, 440, 29, 45, 154, 361, + 392, 463, 464, 465, 516, 571, 643, 644, 645, 716, + 784, 441, 609, 442, 677, 491, 676, 757, 324, 395, + 471, 472, 369, 325, 760, 446, 555, 326, 327, 328, + 505, 447, 448, 449, 496, 450, 509, 451, 565, 452, + 558, 559, 690, 632, 633, 772, 453, 500, 398, 399, + 403, 401, 538, 498, 499, 543, 544, 364, 365, 454, + 512, 455, 566, 567, 639, 637, 638, 456, 532, 486, + 583, 700, 590, 591, 654, 655, 656, 657, 658, 457, + 502, 458, 503, 148, 149, 43, 31, 137, 47, 48, + 49, 50, 87, 88, 141, 142, 138, 139, 140, 51, + 52, 53, 46, 54, 55, 56, 353, 80, 32, 143, + 381, 382, 383, 175, 176, 33, 58, 167, 34, 60, + 171, 106, 108, 252, 330, 35, 36, 62, 37, 38, + 459, 487, 533, 534, 604, 605, 665, 606, 675, 753, + 856, 754, 857, 819, 820, 815, 816, 730, 948, 755, + 607, 608, 881, 914, 736, 742, 737, 835, 743, 840, + 869, 874, 875, 642, 797, 39, 67, 160, 197, 821, + 577, 378, 282, 283, 270, 269, 131, 132, 133, 134, + 92, 546, 547, 685, 41, 42, 73, 135, 229, 257, + 575, 150 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -826 +static const short int yypact[] = +{ + 538, -826, -826, -826, -826, -826, -826, -826, -826, -826, + -826, -826, -826, -826, -826, -826, -826, -826, 58, 117, + 51, -826, 53, 10, 107, 237, -19, -826, -826, -826, + -826, 513, 51, -826, -826, -826, -826, 1, -826, -826, + 80, -826, -826, 239, -9, 248, 245, 1349, 280, 301, + 309, 392, 184, 184, 245, 245, 245, 257, -826, 397, + -826, -826, 398, -826, -826, -826, -826, 4, 416, 2182, + -826, -826, -826, 184, -826, -826, -826, -826, -826, -826, + -826, -826, -51, -16, 1643, 2182, -826, 1305, 1305, 2182, + -826, -826, -826, -826, 356, -826, 2182, 2182, 245, 2182, + 51, 51, 51, 359, 51, -826, 926, -826, 1065, 2182, + 245, 85, -826, 361, 361, 361, 361, 361, 361, 1682, + 361, 361, 361, 361, 470, -826, -826, -826, 1643, 380, + 2383, -826, -826, -826, 296, 676, -826, 504, 2182, 424, + 407, 424, 407, 2182, -826, 244, 2505, 1890, -826, -826, + -826, -826, 1526, 521, 521, 2182, 1526, 1526, 51, 430, + 380, 2505, -826, -826, -826, 2182, -826, -826, -826, -826, + -826, -826, -826, -826, -826, 303, -826, 2505, -826, -826, + -826, -826, -826, -826, -826, -826, -826, -826, -826, 380, + 380, -826, -826, -826, -826, 2182, 153, 443, 2012, -826, + -826, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, -826, + -826, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, + 2182, 2182, -826, -826, 2182, 2182, 2182, 2182, 2505, -63, + 2182, 1478, 2182, 2182, 2182, 2182, 2505, 1731, 51, 2182, + -826, 1305, 24, 51, 51, 1478, 1349, 1349, 2182, -826, + 1305, 1478, 411, 411, 2182, 51, -826, -826, 303, -826, + 1643, 2409, 2433, 1448, 2524, 2542, 1848, 1848, 2059, 2182, + 2182, 483, 483, 712, 712, 712, 712, 558, 558, 468, + 468, -826, 2182, 2182, 303, 582, 1939, 2505, 2505, 676, + -826, 1526, -826, 1478, 1478, 1478, 1478, -826, 2505, -826, + 1963, 586, -826, 570, 574, 576, 324, -826, -826, -826, + -826, -826, -826, -826, -826, 1478, -826, -826, 590, 590, + 590, 590, -826, -826, -826, -826, -826, -826, -826, 1112, + -826, 1185, -826, -826, -826, 259, 2182, 2182, 483, 483, + -826, -826, -826, 2182, -826, -826, 1594, -826, -826, -826, + -826, -826, 1305, -826, 2182, 593, 276, -826, 132, -826, + -826, -826, 245, 2182, -826, -826, -826, -826, -826, 36, + 594, 605, -826, -826, 530, 2505, 2505, 531, 2505, 0, + 423, 1555, -826, 28, -826, 12, -14, 576, -826, -826, + -826, 2299, 379, 380, 657, 41, -826, 635, 8, -826, + -826, -82, -826, -41, -826, -826, 1305, -826, 0, -826, + -826, 1305, 2182, -826, 380, -826, -826, 535, -826, -826, + 633, 40, 590, 590, 590, -826, -826, 641, 184, -826, + -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, + -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, + 290, -826, -826, -826, -826, -826, -826, -826, -826, -826, + -826, 638, 639, -826, -826, 616, -826, 1349, 2182, -826, + 545, 23, -826, 2182, 642, 52, -826, 643, -826, 645, + -826, -826, -826, 551, -826, 2210, -826, -826, 51, -826, + -826, 649, -826, -826, -826, -826, 666, 500, 564, -826, + 216, 566, 1349, 1349, 204, 279, 594, 590, 590, 564, + -826, -826, 564, 51, 567, -826, 647, -826, 38, 2182, + 667, 298, -826, 698, -826, -826, -826, -826, -826, -826, + 1682, -826, 67, -826, 855, -826, 51, 491, 290, -826, + -826, -826, -826, 579, 587, 282, -826, -826, 184, -826, + 2182, -826, -826, -826, -826, 61, -826, 584, 73, -826, + -82, -82, -826, -826, -826, 195, -826, 434, -826, -826, + 265, -826, -826, -826, -826, -826, -826, -826, 2457, -826, + -826, -826, 2182, 341, -826, 353, 2383, -826, 840, 689, + 75, -826, -826, 690, -826, 692, 693, 697, 699, 700, + 701, 714, 717, -826, -826, -826, -826, 719, -826, -826, + -826, 380, 380, 380, 564, 219, 278, 2182, -826, -826, + 595, -826, 705, 317, -826, -826, 715, 363, -826, -826, + -826, -826, 76, -826, 618, 1770, 723, 277, -826, 434, + -826, -826, 51, 702, -826, 226, 2182, 623, 2182, -826, + 2182, 271, -826, 720, 380, 628, -826, 630, -826, 2505, + 840, 457, 306, -826, 2182, 41, 453, 453, 455, 455, + 453, 455, 453, 455, 190, 626, 1261, -826, -826, -826, + -826, -826, 380, 380, 634, 380, 2182, -826, -826, -826, + 2182, 584, -826, -826, -826, 245, 215, -826, -826, -826, + 74, 2505, 1770, 434, -826, 277, -826, -826, -826, 474, + -826, -826, -826, -826, -826, -826, -826, -826, 2481, -826, + -826, 401, 734, -826, 1219, 637, 380, -826, -826, -826, + 380, 2505, 23, -826, -826, 740, 644, 184, 646, -826, + -826, 742, 648, 184, 651, 652, 653, 655, 656, -826, + 744, -826, -826, 238, -826, 381, 2238, -826, -826, -826, + -826, 731, 1261, -826, -826, 2182, -826, -826, 2505, -826, + -826, -826, 2182, 2182, 1819, -826, 74, -826, -826, -826, + -826, -826, -826, -826, 474, 2182, 2182, -826, 2035, -826, + -826, -826, -826, -826, -826, -826, 453, 755, 746, 453, + -826, 2182, 782, 2182, 453, 453, 453, 453, 2182, 756, + -826, -826, -826, -826, 396, 370, 428, 205, 1682, 51, + -826, -826, -826, 732, 668, 2505, 2505, -826, 2505, -826, + 380, 2505, 662, 1526, -826, 20, 672, 387, 2182, 673, + 20, 2085, 387, 1502, 674, 675, 679, 680, 25, -826, + -826, -826, 405, -826, 405, 773, 91, -826, 780, 684, + 380, -826, -826, 2182, -826, -826, -826, -826, 685, 38, + 2182, 387, 777, -826, -826, 636, 808, 1987, 2182, 38, + 779, 380, -826, 2182, 51, 2182, 2182, 2182, 2182, 2182, + -826, 91, 264, 2182, 783, 418, -826, 405, 2182, -826, + 20, -826, 2085, 686, -826, 265, 265, 265, 265, 2182, + -826, 2085, -826, -826, -826, 51, 2085, -826, 2085, 2085, + 2109, 2160, 38, -826, 2182, 812, 26, -826, -826, -826, + 304, 409, -826, 380, -826, -826, -826, -826, -826, 694, + 380, -826, 380, 380, 380, 2182, 2182, -826, 380, 2505, + 2182, 2182, -826, 2182, 815, 2182, -826, 51, -826, 51, + 51, 51, 51, 2085, 1526, 380, 380, 38, 380, 2182, + 417, -826, -826, -826, -826, -826, 380, 51, -826, 380, + -826, 380, 380, 2182, -826, 51, -826, -826, -826, 380, + 696, -826, -826, 2182, 703, 2182, 380, -826 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const short int yypgoto[] = +{ + -826, -826, -826, 801, -826, -826, -826, -826, -826, 678, + -826, 471, 442, -826, -275, -826, -826, -826, -826, -826, + -826, -826, -826, -826, -826, -826, -826, 191, -826, -826, + 49, -826, -826, -826, -826, -826, 158, -826, -389, -826, + 171, 34, -198, -388, 155, -826, -826, -826, -826, -826, + -826, -826, -826, -826, -826, -826, 299, -826, -826, -826, + -826, -11, -826, -826, -77, -826, -826, -826, -826, 152, + -826, 143, -826, -826, -826, 228, 234, -28, -407, -826, + -826, -826, -826, -826, -826, 211, 159, -826, -826, -826, + -826, 166, -826, -6, 201, -826, 131, -826, 144, -826, + -826, -826, -826, 5, 11, -826, -826, -826, -826, -826, + -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, + -826, -826, -826, -826, -826, -826, -826, -826, -94, -826, + -826, 490, -78, -125, 622, -826, -826, -826, -826, -826, + -826, 627, 629, 710, -826, -826, -826, -826, -38, 16, + -826, -826, -826, -826, -826, -826, -826, -826, -826, 133, + -788, -707, -235, -826, -755, -825, -378, -826, -703, -826, + -826, -826, -462, -826, -657, -79, -826, -826, -826, -826, + -806, -635, 14, -214, 146, 212, -826, -826, -84, -68, + -826, -40, -826, -826, -826, -826, 803, -826, -826, 315, + -826, -468, 378, -826, 336, 391, -826, -826, 602, 157, + -514, -20 +}; + +/* 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 -438 +static const short int yytable[] = +{ + 63, 129, 443, 444, 158, 110, 145, -302, 94, 474, + 738, 30, 81, 745, 492, 747, 102, 103, 104, 412, + 86, 867, 82, 303, 520, 302, 573, 573, 90, 130, + 357, 5, 889, 951, 879, 411, 6, 396, 65, 573, + 69, 564, 469, 510, 146, 147, 477, 3, 4, 152, + 196, 190, 289, 525, 64, 61, 156, 157, 95, 161, + 159, 303, 622, 859, 891, 57, 892, 925, 587, 177, + 258, 363, 199, 397, 626, 773, 661, 695, 470, 130, + 162, 163, 164, -264, 166, -266, 180, 479, 198, 397, + 3, 4, 894, 151, 932, 228, 61, 588, 231, 284, + 562, 563, 849, 236, 589, 954, 91, 851, 75, 930, + 84, 85, 415, 489, 490, 245, 305, 170, -258, 174, + -260, 70, 3, 4, 59, 251, 178, 181, -302, 370, + 371, 510, 111, 389, 83, 112, 475, 72, 248, 836, + 868, 285, 839, 931, 413, 61, 681, 844, 845, 846, + 847, 521, -27, 304, 305, 177, 237, 574, 574, -27, + 61, 261, 262, 263, 264, 265, 266, 267, 268, 303, + 574, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 335, 22, 177, 286, 287, 288, 61, 623, + 291, 749, 293, 294, 295, 296, 631, 298, 61, 300, + 970, 627, 774, 662, 696, 553, 809, 882, 315, 199, + 61, 292, 61, 61, 177, 22, 770, 61, 299, 895, + 146, 3, 4, 310, 311, 312, 199, 750, 990, 338, + 339, 317, 3, 4, 66, 333, 903, 74, 994, 809, + 996, 554, 340, 341, 812, 813, 301, 966, 504, 228, + 968, 506, 3, 4, 511, 316, 709, 313, 314, 377, + -27, 304, 305, 810, 811, 894, 982, -27, 393, 89, + 385, 924, -203, 347, 348, 349, 350, 812, 813, 394, + 556, 237, 3, 4, 259, 93, 200, 758, 759, 810, + 811, 366, 367, 368, 105, 362, 375, 376, 540, 580, + 542, -203, 238, 751, 752, 894, 146, 728, -203, 241, + 96, 953, 617, 246, 247, 40, 557, 250, 688, 3, + 4, 363, 179, 182, 159, 22, 224, 225, 483, 810, + 811, 97, 255, 814, 890, 470, 588, 68, 71, 98, + 170, 146, 174, 589, 548, 22, 256, 710, 711, 712, + 713, 714, 715, 61, 689, 901, 539, 384, 541, 507, + 508, 68, 40, 61, 693, 912, 814, 100, 101, 68, + 68, 68, 237, 758, 759, 22, 640, 641, 476, 199, + 460, 478, 749, 480, 518, 407, 290, 237, 136, 523, + 374, 119, 895, 618, 493, 494, 495, 850, 3, 4, + 691, 531, 40, 40, 387, 703, 853, 388, 947, 812, + 813, 481, 952, 68, 61, 334, 482, 871, 750, 928, + 872, 40, 99, 40, 873, 68, 68, 2, 109, 853, + 406, 254, 895, 750, 107, 576, -56, 852, 199, 858, + 933, 342, 855, 422, 423, 424, 584, 85, 346, 940, + 461, 522, 358, 980, 942, 855, 943, 944, 854, 199, + 3, 4, 585, 359, 635, 855, 621, 462, 535, 648, + 124, 636, 126, 127, 318, 232, 649, 234, 517, 578, + 549, 650, 319, 320, 321, 322, 323, 588, 651, 155, + 586, 128, 165, 569, 589, 221, 222, 223, 647, 7, + 195, 976, 213, 214, 215, 216, 217, 218, 219, 220, + 221, 222, 223, 551, 552, 199, 610, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 634, 18, 786, + 19, 233, 20, 235, 230, 624, 787, 955, 628, 1, + 629, 630, 2, 24, 199, 983, 445, 466, 659, 684, + 467, 242, 199, 22, 579, 581, 40, 23, 23, 24, + 61, 40, 40, 249, 720, 40, 733, 734, 739, 740, + 663, 484, 735, 260, 741, 3, 4, 130, 539, 540, + 541, 542, 721, 219, 220, 221, 222, 223, 5, 343, + 744, 352, 746, 6, 748, 701, 779, 780, 781, 782, + 783, 354, 767, 77, 78, 79, 718, 611, 612, 613, + 130, 355, 697, 303, 7, 692, 694, 704, 769, 771, + 659, 363, 706, 386, 731, 717, 524, 526, -243, -243, + -243, 400, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 402, 18, 40, 19, 40, 20, 560, 561, + 768, 905, 906, 907, 908, 727, 729, 634, 634, 927, + 929, 404, 701, 405, 468, 21, 473, 40, 22, 485, + 488, 497, 23, 515, 24, 513, 514, 68, 519, 397, + 527, 761, 528, 529, 659, 778, 536, 113, 114, 115, + 116, 935, 936, 937, 938, 40, 537, 824, 545, 550, + 570, 117, 118, 572, 470, 582, 119, 615, 120, 121, + 122, 123, 794, 3, 4, 616, 130, 625, 832, 660, + 664, 40, 666, 667, 848, 130, 40, 668, 686, 669, + 670, 671, 825, 826, 828, 217, 218, 219, 220, 221, + 222, 223, 687, 501, 672, 831, 130, 673, 833, 674, + 860, 698, 691, 702, 876, 719, 724, 722, 725, 756, + 707, 841, 765, 843, 788, 837, 653, 823, 678, 679, + 680, 795, 796, 800, 799, 808, 801, 838, 130, 803, + 804, 805, 40, 806, 807, 124, 125, 126, 127, 226, + 227, 822, 842, 750, 862, 899, 863, 865, 877, 861, + 870, 878, 885, 886, 893, 922, 128, 887, 888, 926, + 897, 723, 898, 900, 873, 909, 913, 40, 40, 950, + 855, 934, 969, 130, 993, 939, 958, 76, 414, 390, + 902, 995, 244, 830, 708, 762, 732, 614, 911, 763, + 764, 652, 766, 916, 683, 918, 919, 920, 921, 682, + 705, 113, 114, 115, 116, 790, 592, 775, 130, 593, + 619, 726, 777, 620, 917, 117, 118, 967, 776, 791, + 119, 410, 120, 121, 122, 123, 332, 3, 4, 329, + 68, 253, 331, 792, 949, -383, 904, 793, 817, 802, + 568, 345, 0, 0, 0, 941, 594, 595, 596, 597, + 598, 599, 600, 601, 602, 963, 964, 0, 0, 603, + 949, 0, 0, 949, 0, 130, 183, 184, 185, 186, + 187, 188, 0, 191, 192, 193, 194, 168, 0, 949, + 2, 0, 0, 829, 0, 0, 0, 971, 0, 972, + 973, 974, 975, 130, 0, 834, 0, 0, 0, 124, + 125, 126, 127, 130, 0, 130, 0, 986, 0, 0, + 0, 0, 0, 3, 4, 991, 0, 0, -229, 653, + 128, 0, 0, 0, 0, -229, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 864, 0, 0, + 866, 40, 0, 0, 0, 0, 0, 0, 0, 0, + 884, 0, 7, 0, 0, 0, 0, 0, 0, 0, + 68, 68, 0, 896, 0, 0, -243, -243, -243, 0, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 0, 18, 169, 19, 0, 20, 0, 0, 915, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 923, 0, + 0, 0, 798, 0, 0, 0, 22, 0, 798, 0, + 23, 0, 24, 0, 0, 0, 172, 0, 0, 2, + 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 956, 0, + 957, 0, 0, 0, 0, 0, 0, 959, 0, 960, + 961, 962, 3, 4, 0, 965, 0, 0, 0, 0, + 0, 0, 0, 168, 0, 0, 2, 0, 0, 0, + 0, 977, 978, 979, 0, 981, 0, 984, 0, 0, + 0, 0, 0, 985, 0, 0, 987, 0, 988, 989, + 0, 7, 0, 0, 0, 0, 992, 0, 0, 3, + 4, 0, 0, 997, 0, -243, -243, -243, 0, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, + 18, 0, 19, 173, 20, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 172, 0, 7, 2, + 0, 0, 0, 0, 0, 22, 0, 0, 0, 23, + 0, 24, -243, -243, -243, 0, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 0, 18, 372, 19, + 789, 20, 3, 4, 0, 0, 0, 0, 0, 0, + 113, 114, 115, 116, 0, 0, 0, 0, 0, 0, + 0, 0, 22, 0, 117, 118, 23, 0, 24, 119, + 0, 120, 121, 122, 123, 0, 3, 4, 0, 0, + 0, 7, 0, 0, 0, 2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -243, -243, -243, 0, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, + 18, 0, 19, 373, 20, 0, 0, 0, 3, 4, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 22, 0, 0, 0, 23, + 0, 24, 0, 0, 318, 422, 423, 424, 124, 125, + 126, 127, 319, 320, 321, 322, 323, 7, 0, 0, + 0, 0, 3, 4, 0, 0, 0, -229, 0, 128, + 0, 0, 0, 2, -229, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 0, 18, 0, 19, 0, + 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 7, 0, 0, 0, 0, 3, 4, 0, 0, + 0, 22, 0, 0, 0, 23, 0, 24, 61, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, + 18, 0, 19, 0, 20, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 22, 0, 0, 0, 23, + 0, 24, 61, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 0, 18, 0, 19, 204, 20, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 0, 22, + 0, 0, 0, 23, 201, 24, 203, 204, 0, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 201, 0, + 203, 204, 0, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 201, 0, 203, 204, 0, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 408, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 113, 114, 115, 116, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 117, 118, 0, 0, 0, 119, 0, 120, 121, 122, + 123, 0, 3, 4, 0, 379, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 113, 114, 115, 116, 0, + 0, 0, 0, 0, 0, 61, 0, 0, 0, 117, + 118, 0, 0, 0, 119, 0, 120, 121, 122, 123, + 883, 3, 4, 0, 0, 0, 0, 199, 0, 0, + 0, 0, 0, 0, 144, 0, 0, 0, 409, 0, + 0, 0, 0, 0, 113, 114, 115, 116, 0, 380, + 0, 199, 0, 0, 124, 125, 126, 127, 117, 118, + 0, 0, 0, 119, 0, 120, 121, 122, 123, 0, + 3, 4, 0, 189, 0, 128, 0, 0, 0, 0, + 0, 0, 0, 113, 114, 115, 116, 0, 380, 0, + 0, 0, 0, 124, 125, 126, 127, 117, 118, 0, + 0, 0, 119, 0, 120, 121, 122, 123, 0, 3, + 4, 0, 0, 0, 128, 0, 0, 0, 0, 0, + 0, 0, 297, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 113, 114, 115, 116, 0, 0, 0, 0, + 0, 0, 124, 125, 126, 127, 117, 118, 0, 0, + 0, 119, 0, 120, 121, 122, 123, 0, 3, 4, + 0, 699, 0, 128, 0, 0, 0, 0, 0, 0, + 0, 113, 114, 115, 116, 0, 0, 0, 0, 0, + 0, 124, 125, 126, 127, 117, 118, 0, 0, 0, + 119, 0, 120, 121, 122, 123, 0, 3, 4, 0, + 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, + 827, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 113, 114, 115, 116, 0, 0, 0, 0, 0, 0, + 124, 125, 126, 127, 117, 118, 0, 0, 0, 119, + 0, 120, 121, 122, 123, 0, 3, 4, 0, 0, + 0, 128, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 0, 124, + 125, 126, 127, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 201, 239, 203, 204, + 128, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 0, 0, 0, 0, 0, 0, 0, 0, 124, 125, + 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 201, 0, 203, 204, 128, + 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 201, + 0, 203, 204, 0, 205, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, + 221, 222, 223, 201, 0, 203, 204, 0, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 0, 201, 0, + 203, 204, 240, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 0, 0, 0, 0, 113, 114, 115, 116, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 117, 118, 0, 0, 0, 119, 0, 120, 121, 122, + 123, 344, 3, 4, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 0, + 0, 201, 0, 203, 204, 351, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 201, 0, 203, 204, 910, + 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 0, + 0, 0, -437, 0, 124, 125, 126, 127, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 128, 201, 0, 203, 204, + 199, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 0, 0, 0, 113, 114, 115, 116, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 117, 118, 0, + 0, 0, 119, 880, 120, 121, 122, 123, 0, 3, + 4, 113, 114, 115, 116, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 117, 118, 945, 0, 0, + 530, 0, 120, 121, 122, 123, 0, 3, 4, 113, + 114, 115, 116, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 117, 118, 0, 0, 0, 818, 0, + 120, 121, 122, 123, 0, 3, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 946, 0, + 0, 124, 125, 126, 127, 0, 0, 0, 0, 0, + 416, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 128, 0, 0, 0, 0, 0, 0, 124, + 125, 126, 127, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 417, 0, 0, 0, + 128, 0, 0, 0, 0, 0, 0, 124, 125, 126, + 127, 418, 419, 0, 0, 0, 0, 0, 420, 0, + 421, 0, 318, 422, 423, 424, 425, 426, 128, 0, + 319, 320, 321, 322, 323, 427, 428, 0, 0, 429, + 430, 431, 432, 433, 434, 435, 436, 437, 438, 201, + 202, 203, 204, 0, 205, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, + 221, 222, 223, 0, 439, 201, 336, 203, 204, 0, + 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 201, + 337, 203, 204, 0, 205, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, + 221, 222, 223, 201, 646, 203, 204, 0, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 201, 785, 203, + 204, 0, 205, 206, 207, 208, 209, 210, 211, 212, + 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, + 223, 201, 0, 203, 204, 0, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223 +}; + +static const short int yycheck[] = +{ + 20, 69, 391, 391, 98, 1, 84, 7, 46, 1, + 667, 0, 32, 670, 421, 672, 54, 55, 56, 7, + 40, 1, 21, 37, 1, 1, 1, 1, 37, 69, + 305, 50, 7, 7, 840, 7, 55, 1, 22, 1, + 30, 509, 1, 450, 84, 85, 128, 37, 38, 89, + 128, 119, 115, 1, 1, 137, 96, 97, 47, 99, + 98, 37, 1, 818, 852, 7, 854, 892, 1, 109, + 195, 31, 135, 37, 1, 1, 1, 1, 37, 119, + 100, 101, 102, 134, 104, 136, 1, 128, 128, 37, + 37, 38, 1, 88, 900, 135, 137, 30, 138, 224, + 507, 508, 809, 143, 37, 930, 115, 814, 127, 897, + 30, 31, 387, 73, 74, 155, 130, 106, 134, 108, + 136, 111, 37, 38, 7, 165, 110, 111, 128, 327, + 328, 538, 128, 1, 133, 131, 128, 30, 158, 796, + 120, 225, 799, 898, 132, 137, 614, 804, 805, 806, + 807, 128, 128, 129, 130, 195, 128, 132, 132, 135, + 137, 201, 202, 203, 204, 205, 206, 207, 208, 37, + 132, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 260, 130, 224, 225, 226, 227, 137, 128, + 230, 1, 232, 233, 234, 235, 1, 237, 137, 239, + 955, 128, 128, 128, 128, 1, 1, 842, 248, 135, + 137, 231, 137, 137, 254, 130, 1, 137, 238, 128, + 260, 37, 38, 243, 244, 245, 135, 37, 983, 269, + 270, 251, 37, 38, 22, 255, 871, 0, 993, 1, + 995, 37, 282, 283, 39, 40, 241, 950, 446, 289, + 953, 449, 37, 38, 452, 250, 30, 246, 247, 343, + 128, 129, 130, 25, 26, 1, 969, 135, 362, 30, + 354, 7, 1, 293, 294, 295, 296, 39, 40, 363, + 1, 128, 37, 38, 131, 37, 129, 676, 676, 25, + 26, 319, 320, 321, 37, 315, 336, 337, 79, 1, + 81, 30, 145, 113, 114, 1, 346, 1, 37, 152, + 30, 7, 30, 156, 157, 0, 37, 160, 1, 37, + 38, 31, 110, 111, 362, 130, 30, 31, 412, 25, + 26, 30, 175, 128, 848, 37, 30, 22, 23, 30, + 329, 381, 331, 37, 128, 130, 189, 121, 122, 123, + 124, 125, 126, 137, 37, 869, 78, 352, 80, 69, + 70, 46, 47, 137, 1, 879, 128, 52, 53, 54, + 55, 56, 128, 762, 762, 130, 111, 112, 398, 135, + 1, 401, 1, 403, 468, 380, 229, 128, 73, 473, + 131, 30, 128, 111, 422, 423, 424, 1, 37, 38, + 37, 485, 87, 88, 128, 128, 1, 131, 922, 39, + 40, 406, 926, 98, 137, 258, 411, 30, 37, 1, + 33, 106, 30, 108, 37, 110, 111, 4, 30, 1, + 7, 128, 128, 37, 37, 519, 57, 815, 135, 817, + 902, 284, 37, 64, 65, 66, 530, 31, 291, 911, + 71, 471, 128, 967, 916, 37, 918, 919, 30, 135, + 37, 38, 530, 306, 30, 37, 550, 88, 488, 128, + 109, 37, 111, 112, 63, 139, 135, 141, 467, 519, + 500, 128, 71, 72, 73, 74, 75, 30, 135, 133, + 530, 130, 133, 513, 37, 27, 28, 29, 582, 76, + 30, 963, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 502, 503, 135, 536, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 565, 105, 128, + 107, 140, 109, 142, 30, 555, 135, 128, 558, 1, + 560, 561, 4, 136, 135, 128, 391, 392, 588, 617, + 393, 30, 135, 130, 520, 521, 241, 134, 134, 136, + 137, 246, 247, 133, 648, 250, 113, 114, 113, 114, + 590, 414, 119, 130, 119, 37, 38, 617, 78, 79, + 80, 81, 650, 25, 26, 27, 28, 29, 50, 7, + 669, 5, 671, 55, 673, 635, 122, 123, 124, 125, + 126, 31, 686, 90, 91, 92, 646, 116, 117, 118, + 650, 37, 632, 37, 76, 626, 627, 637, 695, 696, + 660, 31, 642, 30, 664, 645, 474, 475, 90, 91, + 92, 37, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 37, 105, 329, 107, 331, 109, 505, 506, + 690, 15, 16, 17, 18, 661, 662, 695, 696, 894, + 895, 131, 702, 132, 7, 127, 31, 352, 130, 134, + 37, 30, 134, 57, 136, 37, 37, 362, 133, 37, + 37, 676, 37, 132, 724, 705, 37, 11, 12, 13, + 14, 905, 906, 907, 908, 380, 30, 765, 134, 133, + 133, 25, 26, 56, 37, 7, 30, 128, 32, 33, + 34, 35, 732, 37, 38, 128, 756, 133, 786, 30, + 30, 406, 30, 30, 808, 765, 411, 30, 133, 30, + 30, 30, 772, 773, 774, 23, 24, 25, 26, 27, + 28, 29, 37, 428, 30, 785, 786, 30, 788, 30, + 818, 133, 37, 30, 838, 132, 128, 37, 128, 133, + 58, 801, 128, 803, 30, 10, 129, 762, 611, 612, + 613, 31, 128, 31, 128, 31, 128, 31, 818, 128, + 128, 128, 467, 128, 128, 109, 110, 111, 112, 113, + 114, 60, 10, 37, 62, 863, 128, 135, 838, 819, + 128, 128, 128, 128, 31, 889, 130, 128, 128, 893, + 30, 654, 128, 128, 37, 7, 37, 502, 503, 7, + 37, 135, 7, 863, 128, 909, 132, 26, 386, 358, + 870, 128, 154, 784, 643, 677, 665, 538, 878, 682, + 683, 1, 685, 883, 616, 885, 886, 887, 888, 615, + 639, 11, 12, 13, 14, 724, 1, 700, 898, 4, + 545, 660, 703, 548, 884, 25, 26, 951, 702, 725, + 30, 381, 32, 33, 34, 35, 254, 37, 38, 252, + 565, 171, 253, 726, 924, 30, 872, 730, 755, 743, + 512, 289, -1, -1, -1, 915, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 945, 946, -1, -1, 54, + 950, -1, -1, 953, -1, 955, 113, 114, 115, 116, + 117, 118, -1, 120, 121, 122, 123, 1, -1, 969, + 4, -1, -1, 776, -1, -1, -1, 957, -1, 959, + 960, 961, 962, 983, -1, 788, -1, -1, -1, 109, + 110, 111, 112, 993, -1, 995, -1, 977, -1, -1, + -1, -1, -1, 37, 38, 985, -1, -1, 128, 129, + 130, -1, -1, -1, -1, 135, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 830, -1, -1, + 833, 676, -1, -1, -1, -1, -1, -1, -1, -1, + 843, -1, 76, -1, -1, -1, -1, -1, -1, -1, + 695, 696, -1, 856, -1, -1, 90, 91, 92, -1, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + -1, 105, 106, 107, -1, 109, -1, -1, 881, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 891, -1, + -1, -1, 737, -1, -1, -1, 130, -1, 743, -1, + 134, -1, 136, -1, -1, -1, 1, -1, -1, 4, + -1, -1, -1, -1, -1, -1, -1, 762, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 931, -1, + 933, -1, -1, -1, -1, -1, -1, 940, -1, 942, + 943, 944, 37, 38, -1, 948, -1, -1, -1, -1, + -1, -1, -1, 1, -1, -1, 4, -1, -1, -1, + -1, 964, 965, 966, -1, 968, -1, 970, -1, -1, + -1, -1, -1, 976, -1, -1, 979, -1, 981, 982, + -1, 76, -1, -1, -1, -1, 989, -1, -1, 37, + 38, -1, -1, 996, -1, 90, 91, 92, -1, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, -1, + 105, -1, 107, 108, 109, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 1, -1, 76, 4, + -1, -1, -1, -1, -1, 130, -1, -1, -1, 134, + -1, 136, 90, 91, 92, -1, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, -1, 105, 106, 107, + 1, 109, 37, 38, -1, -1, -1, -1, -1, -1, + 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, + -1, -1, 130, -1, 25, 26, 134, -1, 136, 30, + -1, 32, 33, 34, 35, -1, 37, 38, -1, -1, + -1, 76, -1, -1, -1, 4, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 90, 91, 92, -1, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, -1, + 105, -1, 107, 108, 109, -1, -1, -1, 37, 38, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, + -1, -1, -1, -1, -1, 130, -1, -1, -1, 134, + -1, 136, -1, -1, 63, 64, 65, 66, 109, 110, + 111, 112, 71, 72, 73, 74, 75, 76, -1, -1, + -1, -1, 37, 38, -1, -1, -1, 128, -1, 130, + -1, -1, -1, 4, 135, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, -1, 105, -1, 107, -1, + 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 76, -1, -1, -1, -1, 37, 38, -1, -1, + -1, 130, -1, -1, -1, 134, -1, 136, 137, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, -1, + 105, -1, 107, -1, 109, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 130, -1, -1, -1, 134, + -1, 136, 137, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, -1, 105, -1, 107, 9, 109, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, -1, 130, + -1, -1, -1, 134, 6, 136, 8, 9, -1, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 6, -1, + 8, 9, -1, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 6, -1, 8, 9, -1, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 11, 12, 13, 14, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 25, 26, -1, -1, -1, 30, -1, 32, 33, 34, + 35, -1, 37, 38, -1, 1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 11, 12, 13, 14, -1, + -1, -1, -1, -1, -1, 137, -1, -1, -1, 25, + 26, -1, -1, -1, 30, -1, 32, 33, 34, 35, + 128, 37, 38, -1, -1, -1, -1, 135, -1, -1, + -1, -1, -1, -1, 1, -1, -1, -1, 93, -1, + -1, -1, -1, -1, 11, 12, 13, 14, -1, 104, + -1, 135, -1, -1, 109, 110, 111, 112, 25, 26, + -1, -1, -1, 30, -1, 32, 33, 34, 35, -1, + 37, 38, -1, 1, -1, 130, -1, -1, -1, -1, + -1, -1, -1, 11, 12, 13, 14, -1, 104, -1, + -1, -1, -1, 109, 110, 111, 112, 25, 26, -1, + -1, -1, 30, -1, 32, 33, 34, 35, -1, 37, + 38, -1, -1, -1, 130, -1, -1, -1, -1, -1, + -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 11, 12, 13, 14, -1, -1, -1, -1, + -1, -1, 109, 110, 111, 112, 25, 26, -1, -1, + -1, 30, -1, 32, 33, 34, 35, -1, 37, 38, + -1, 1, -1, 130, -1, -1, -1, -1, -1, -1, + -1, 11, 12, 13, 14, -1, -1, -1, -1, -1, + -1, 109, 110, 111, 112, 25, 26, -1, -1, -1, + 30, -1, 32, 33, 34, 35, -1, 37, 38, -1, + -1, -1, 130, -1, -1, -1, -1, -1, -1, -1, + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, + 109, 110, 111, 112, 25, 26, -1, -1, -1, 30, + -1, 32, 33, 34, 35, -1, 37, 38, -1, -1, + -1, 130, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, -1, 109, + 110, 111, 112, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 6, 7, 8, 9, + 130, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + -1, -1, -1, -1, -1, -1, -1, -1, 109, 110, + 111, 112, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 6, -1, 8, 9, 130, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 6, + -1, 8, 9, -1, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 6, -1, 8, 9, -1, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, -1, 6, -1, + 8, 9, 132, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, -1, -1, -1, -1, 11, 12, 13, 14, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 25, 26, -1, -1, -1, 30, -1, 32, 33, 34, + 35, 132, 37, 38, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, -1, + -1, 6, -1, 8, 9, 132, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 6, -1, 8, 9, 132, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, -1, + -1, -1, 130, -1, 109, 110, 111, 112, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 130, 6, -1, 8, 9, + 135, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + -1, -1, -1, 11, 12, 13, 14, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 25, 26, -1, + -1, -1, 30, 128, 32, 33, 34, 35, -1, 37, + 38, 11, 12, 13, 14, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 25, 26, 128, -1, -1, + 30, -1, 32, 33, 34, 35, -1, 37, 38, 11, + 12, 13, 14, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 25, 26, -1, -1, -1, 30, -1, + 32, 33, 34, 35, -1, 37, 38, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 128, -1, + -1, 109, 110, 111, 112, -1, -1, -1, -1, -1, + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 130, -1, -1, -1, -1, -1, -1, 109, + 110, 111, 112, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, + 130, -1, -1, -1, -1, -1, -1, 109, 110, 111, + 112, 52, 53, -1, -1, -1, -1, -1, 59, -1, + 61, -1, 63, 64, 65, 66, 67, 68, 130, -1, + 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 6, + 7, 8, 9, -1, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, -1, 115, 6, 7, 8, 9, -1, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 6, + 7, 8, 9, -1, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 6, 7, 8, 9, -1, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 6, 7, 8, + 9, -1, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 6, -1, 8, 9, -1, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned short int yystos[] = +{ + 0, 1, 4, 37, 38, 50, 55, 76, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 105, 107, + 109, 127, 130, 134, 136, 139, 140, 141, 142, 154, + 242, 244, 266, 273, 276, 283, 284, 286, 287, 323, + 337, 342, 343, 243, 143, 155, 260, 246, 247, 248, + 249, 257, 258, 259, 261, 262, 263, 7, 274, 7, + 277, 137, 285, 349, 1, 287, 323, 324, 337, 30, + 111, 337, 30, 344, 0, 127, 141, 90, 91, 92, + 265, 349, 21, 133, 30, 31, 349, 250, 251, 30, + 37, 115, 338, 37, 286, 242, 30, 30, 30, 30, + 337, 337, 286, 286, 286, 37, 279, 37, 280, 30, + 1, 128, 131, 11, 12, 13, 14, 25, 26, 30, + 32, 33, 34, 35, 109, 110, 111, 112, 130, 327, + 329, 334, 335, 336, 337, 345, 337, 245, 254, 255, + 256, 252, 253, 267, 1, 270, 329, 329, 241, 242, + 349, 241, 329, 144, 156, 133, 329, 329, 266, 286, + 325, 329, 349, 349, 349, 133, 349, 275, 1, 106, + 242, 278, 1, 108, 242, 271, 272, 329, 287, 323, + 1, 287, 323, 334, 334, 334, 334, 334, 334, 1, + 327, 334, 334, 334, 334, 30, 270, 326, 329, 135, + 347, 6, 7, 8, 9, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 113, 114, 329, 346, + 30, 329, 342, 343, 342, 343, 329, 128, 347, 7, + 132, 347, 30, 147, 147, 329, 347, 347, 349, 133, + 347, 329, 281, 281, 128, 347, 347, 347, 271, 131, + 130, 329, 329, 329, 329, 329, 329, 329, 329, 333, + 332, 329, 329, 329, 329, 329, 329, 329, 329, 329, + 329, 329, 330, 331, 271, 326, 329, 329, 329, 115, + 347, 329, 349, 329, 329, 329, 329, 1, 329, 349, + 329, 241, 1, 37, 129, 130, 148, 149, 150, 152, + 349, 349, 349, 242, 242, 329, 241, 349, 63, 71, + 72, 73, 74, 75, 176, 181, 185, 186, 187, 279, + 282, 280, 272, 349, 347, 270, 7, 7, 329, 329, + 329, 329, 347, 7, 132, 346, 347, 349, 349, 349, + 349, 132, 5, 264, 31, 37, 151, 152, 128, 347, + 145, 157, 349, 31, 215, 216, 215, 215, 215, 180, + 180, 180, 106, 108, 131, 329, 329, 326, 329, 1, + 104, 268, 269, 270, 241, 326, 30, 128, 131, 1, + 149, 146, 158, 266, 326, 177, 1, 37, 206, 207, + 37, 209, 37, 208, 131, 132, 7, 241, 1, 93, + 269, 7, 7, 132, 150, 152, 1, 37, 52, 53, + 59, 61, 64, 65, 66, 67, 68, 76, 77, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 115, + 153, 169, 171, 176, 181, 182, 183, 189, 190, 191, + 193, 195, 197, 204, 217, 219, 225, 237, 239, 288, + 1, 71, 88, 159, 160, 161, 182, 347, 7, 1, + 37, 178, 179, 31, 1, 128, 349, 128, 349, 128, + 349, 241, 241, 326, 347, 134, 227, 289, 37, 73, + 74, 173, 216, 215, 215, 215, 192, 30, 211, 212, + 205, 337, 238, 240, 180, 188, 180, 69, 70, 194, + 216, 180, 218, 37, 37, 57, 162, 242, 326, 133, + 1, 128, 349, 326, 207, 1, 207, 37, 37, 132, + 30, 326, 226, 290, 291, 349, 37, 30, 210, 78, + 79, 80, 81, 213, 214, 134, 339, 340, 128, 349, + 133, 242, 242, 1, 37, 184, 1, 37, 198, 199, + 209, 209, 216, 216, 339, 196, 220, 221, 340, 349, + 133, 163, 56, 1, 132, 348, 326, 328, 329, 179, + 1, 179, 7, 228, 326, 327, 329, 1, 30, 37, + 230, 231, 1, 4, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 54, 292, 293, 295, 308, 309, 170, + 349, 116, 117, 118, 194, 128, 128, 30, 111, 337, + 337, 326, 1, 128, 349, 133, 1, 128, 349, 349, + 349, 1, 201, 202, 286, 30, 37, 223, 224, 222, + 111, 112, 321, 164, 165, 166, 7, 326, 128, 135, + 128, 135, 1, 129, 232, 233, 234, 235, 236, 329, + 30, 1, 128, 349, 30, 294, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 296, 174, 172, 347, 347, + 347, 339, 214, 213, 327, 341, 133, 37, 1, 37, + 200, 37, 199, 1, 199, 1, 128, 349, 133, 1, + 229, 329, 30, 128, 349, 223, 349, 58, 165, 30, + 121, 122, 123, 124, 125, 126, 167, 349, 329, 132, + 326, 327, 37, 347, 128, 128, 232, 231, 1, 231, + 305, 329, 178, 113, 114, 119, 312, 314, 312, 113, + 114, 119, 313, 316, 313, 312, 313, 312, 313, 1, + 37, 113, 114, 297, 299, 307, 133, 175, 176, 181, + 182, 241, 174, 347, 347, 128, 347, 326, 329, 202, + 1, 202, 203, 1, 128, 347, 229, 224, 349, 122, + 123, 124, 125, 126, 168, 7, 128, 135, 30, 1, + 234, 236, 347, 347, 349, 31, 128, 322, 337, 128, + 31, 128, 322, 128, 128, 128, 128, 128, 31, 1, + 25, 26, 39, 40, 128, 303, 304, 297, 30, 301, + 302, 327, 60, 241, 327, 329, 329, 1, 329, 347, + 168, 329, 327, 329, 347, 315, 312, 10, 31, 312, + 317, 329, 10, 329, 312, 312, 312, 312, 326, 299, + 1, 299, 304, 1, 30, 37, 298, 300, 304, 302, + 327, 349, 62, 128, 347, 135, 347, 1, 120, 318, + 128, 30, 33, 37, 319, 320, 326, 329, 128, 318, + 128, 310, 319, 128, 347, 128, 128, 128, 128, 7, + 348, 298, 298, 31, 1, 128, 347, 30, 128, 327, + 128, 348, 329, 319, 320, 15, 16, 17, 18, 7, + 132, 329, 348, 37, 311, 347, 329, 349, 329, 329, + 329, 329, 326, 347, 7, 303, 326, 300, 1, 300, + 298, 302, 318, 310, 135, 321, 321, 321, 321, 326, + 310, 349, 310, 310, 310, 128, 128, 348, 306, 329, + 7, 7, 348, 7, 303, 128, 347, 347, 132, 347, + 347, 347, 347, 329, 329, 347, 306, 326, 306, 7, + 302, 349, 349, 349, 349, 349, 310, 347, 347, 347, + 348, 347, 306, 128, 347, 347, 349, 347, 347, 347, + 302, 349, 347, 128, 302, 128, 302, 347 +}; + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + +#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; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror ("syntax error: cannot back up");\ + YYERROR; \ + } \ +while (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 (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) +#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, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval) +#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 (0) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_stack_print (short int *bottom, short int *top) +#else +static void +yy_stack_print (bottom, top) + short int *bottom; + short int *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; 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 (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; +#endif +{ + int yyi; + unsigned int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + yyrule - 1, yylno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ +} while (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 + SIZE_MAX < 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. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif +{ + register const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; +} +# 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. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif +{ + register char *yyd = yydest; + register const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +#endif /* !YYERROR_VERBOSE */ + + + +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) +#else +static void +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); +} + +#endif /* ! YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + 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 (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +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; + + register int yystate; + register 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; + + /* 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. */ + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + register short int *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; + + + +#define YYPOPSTACK (yyvsp--, yyssp--) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; + + 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; + + + yyvsp[0] = yylval; + + 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; + short int *yyss1 = yyss; + + + /* 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 ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyoverflowlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + short int *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + 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. */ +/* yyresume: */ + + /* 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; + + /* 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; + + *++yyvsp = yylval; + + + /* 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: + /* 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]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 425 "parse.yy" + { if (!is_interactive) + YYFAIL; +#if VDEBUG != 0 + if (vdebug) + printf_error_V ("interactive statement\n"); +#endif + interactive_statement = (yyvsp[0].ttype); + fix_lastchar(); + YYACCEPT;} + break; + + case 4: +#line 436 "parse.yy" + { +#if VDEBUG != 0 +if (vdebug) + printf ("source error\n"); +#endif + if (is_interactive) + YYABORT; + } + break; + + case 5: +#line 444 "parse.yy" + { +#if VDEBUG != 0 +if (vdebug) + printf_error_V ("EOF\n"); +#endif + (yyval.ttype) = NULL; } + break; + + case 7: +#line 455 "parse.yy" + { yyerrok; +#if VDEBUG != 0 +if (vdebug) + printf ("description_list\n"); +#endif + } + break; + + case 10: +#line 472 "parse.yy" + { if (is_interactive) { + YYFAIL; + } + } + break; + + case 11: +#line 477 "parse.yy" + { + current_module = current_scope = build_module ((yyvsp[0].ttype)); + push_scope (); + /* list of parse modules */ + module_list = tree_cons (current_module, NULL_TREE, module_list); + /* for now, assume all to be at lop level */ +// top_level = chainon (current_module, top_level); + } + break; + + case 12: +#line 486 "parse.yy" + { MODULE_PORT_LIST (current_module) = nreverse ((yyvsp[-1].ttype)); } + break; + + case 13: +#line 488 "parse.yy" + { + current_scope = pop_scope (); + BLOCK_BODY (current_module) = nreverse (BLOCK_BODY (current_module)); + BLOCK_DECL (current_module) = nreverse (BLOCK_DECL (current_module)); + end_module (current_module); + } + break; + + case 15: +#line 501 "parse.yy" + { yyerrok; } + break; + + case 17: +#line 507 "parse.yy" + { (yyval.ttype) = (yyvsp[-1].ttype); } + break; + + case 18: +#line 509 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 20: +#line 515 "parse.yy" + { yyerrok; + (yyval.ttype) = chainon ((yyvsp[0].ttype), (yyvsp[-2].ttype)); + } + break; + + case 23: +#line 529 "parse.yy" + { if ((yyvsp[0].ttype)) + (yyval.ttype) = build_tree_list ((yyvsp[0].ttype), NULL_TREE); + else + (yyval.ttype) = NULL_TREE; + } + break; + + case 24: +#line 535 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[-1].ttype), (yyvsp[-3].ttype)); } + break; + + case 26: +#line 541 "parse.yy" + { (yyval.ttype) = (yyvsp[-1].ttype); + sorry ("Port concatenations not supported in this version"); + } + break; + + case 27: +#line 545 "parse.yy" + { (yyval.ttype) = NULL_TREE; } + break; + + case 28: +#line 550 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[0].ttype), NULL_TREE); } + break; + + case 29: +#line 552 "parse.yy" + { (yyval.ttype) = tree_cons ((yyvsp[0].ttype), NULL_TREE, (yyvsp[-2].ttype)); } + break; + + case 30: +#line 557 "parse.yy" + { set_decl ((yyvsp[0].ttype), (yyvsp[0].ttype)); } + break; + + case 31: +#line 559 "parse.yy" + { (yyval.ttype) = build_bit_ref ((yyvsp[-3].ttype), (yyvsp[-1].ttype)); + set_decl ((yyvsp[-3].ttype), (yyval.ttype)); +// sorry ("Port bit-select not supported in this version"); + } + break; + + case 32: +#line 564 "parse.yy" + { (yyval.ttype) = build_part_ref ((yyvsp[-5].ttype), (yyvsp[-3].ttype), (yyvsp[-1].ttype)); + set_decl ((yyvsp[-5].ttype), (yyval.ttype)); +// sorry ("Port part-selects not supported in this version"); + } + break; + + case 42: +#line 583 "parse.yy" + { BLOCK_BODY (current_module) = tree_cons ((yyvsp[0].ttype), + (tree)INITIAL_CODE, BLOCK_BODY (current_module)); + } + break; + + case 43: +#line 587 "parse.yy" + { BLOCK_BODY (current_module) = tree_cons ((yyvsp[0].ttype), + (tree)ALWAYS_CODE, BLOCK_BODY (current_module)); + } + break; + + case 46: +#line 606 "parse.yy" + { if (is_interactive) { + YYFAIL; + } + } + break; + + case 47: +#line 611 "parse.yy" + { + current_module = current_scope = build_udp ((yyvsp[0].ttype)); + push_scope (); + /* list of parse modules */ + module_list = tree_cons (current_module, NULL_TREE, module_list); + } + break; + + case 48: +#line 618 "parse.yy" + { UDP_PORT_LIST (current_module) = nreverse ((yyvsp[-1].ttype)); } + break; + + case 49: +#line 620 "parse.yy" + { + current_scope = pop_scope (); + UDP_STRING_LIST (current_module) = nreverse (UDP_STRING_LIST (current_module)); + end_primitive (current_module); + } + break; + + case 50: +#line 628 "parse.yy" + { (yyval.ttype) = NULL_TREE; } + break; + + case 51: +#line 630 "parse.yy" + { yyerrok; } + break; + + case 55: +#line 641 "parse.yy" + { + if( strcmp( IDENT((yyvsp[-1].ttype)), + IDENT(DECL_NAME(TREE_PURPOSE(MODULE_PORT_LIST(current_module)))) )!=0 ) { + error( "only the first declared port in a udp can be a reg", + NULL_CHAR, NULL_CHAR ); + } else { + UDP_REG_NAME(current_module) = (yyvsp[-1].ttype); + } + (yyval.ttype) = NULL_TREE; + } + break; + + case 56: +#line 654 "parse.yy" + { (yyval.ttype) = NULL_TREE; } + break; + + case 57: +#line 656 "parse.yy" + { + if( UDP_REG_NAME(current_module)==NULL_TREE ) { + error( "initial statement is no allowed in combinatorial udp's", + NULL_CHAR, NULL_CHAR ); + } else if( strcmp(IDENT((yyvsp[-3].ttype)),IDENT(UDP_REG_NAME(current_module)))!=0 ) { + error( "initial statement does not reference port output", + NULL_CHAR, NULL_CHAR ); + } else { + UDP_INITIAL_VALUE(current_module) = (yyvsp[-1].ttype); + } + (yyval.ttype) = NULL_TREE; + } + break; + + case 58: +#line 674 "parse.yy" + { extern int enable_udp_parse; + enable_udp_parse = TRUE; + current_udp_string = NULL_TREE; + } + break; + + case 59: +#line 679 "parse.yy" + { + UDP_STRING_LIST(current_module) = (yyvsp[-1].ttype); + (yyval.ttype) = NULL_TREE; + } + break; + + case 61: +#line 687 "parse.yy" + { + (yyval.ttype) = chainon ((yyvsp[0].ttype), (yyvsp[-1].ttype)); + } + break; + + case 62: +#line 693 "parse.yy" + { + validate_udp_string( current_module, current_udp_string ); + (yyval.ttype) = current_udp_string; + current_udp_string = NULL_TREE; + } + break; + + case 63: +#line 701 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 64: +#line 703 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 65: +#line 707 "parse.yy" + { + append_udp_digits( ¤t_udp_string, (yyvsp[0].c), (yyvsp[0].c) ); + (yyval.ttype) = NULL; + } + break; + + case 66: +#line 712 "parse.yy" + { + append_udp_digits( ¤t_udp_string,'?','?' ); + (yyval.ttype) = NULL; + } + break; + + case 67: +#line 717 "parse.yy" + { + append_udp_digits( ¤t_udp_string,'0','0' ); + (yyval.ttype) = NULL; + } + break; + + case 68: +#line 722 "parse.yy" + { + append_udp_digits( ¤t_udp_string,'1','1' ); + (yyval.ttype) = NULL; + } + break; + + case 69: +#line 727 "parse.yy" + { + append_udp_digits( ¤t_udp_string,'b','b' ); + (yyval.ttype) = NULL; + } + break; + + case 70: +#line 732 "parse.yy" + { + append_udp_digits( ¤t_udp_string,'x','x' ); + (yyval.ttype) = NULL; + } + break; + + case 71: +#line 737 "parse.yy" + { + /* ? and b must be convert different but equivilent characters + otherwise edges cannot be distinguished from levels */ + + if( (yyvsp[-2].c)=='?' ) { + (yyvsp[-2].c) = '!'; + } else if( (yyvsp[-2].c)=='b' ) { + (yyvsp[-2].c) = '%'; + } + append_udp_digits( ¤t_udp_string,(yyvsp[-2].c), (yyvsp[-1].c) ); + (yyval.ttype) = NULL; + } + break; + + case 77: +#line 760 "parse.yy" + { syn_warning ("Task definition"); + tmp_tree = build_task (check_task ((yyvsp[-1].ttype))); + make_block_decl ((yyvsp[0].ttype), current_scope, tmp_tree); + current_scope = tmp_tree; + BLOCK_DOWN (current_module) = chainon (current_scope, BLOCK_DOWN (current_module)); + BLOCK_UP (current_scope) = current_module; + push_scope (); + in_tf = 1; + } + break; + + case 78: +#line 770 "parse.yy" + { BLOCK_BODY (current_scope) = (yyvsp[-1].ttype); + in_tf = 0; + BLOCK_PORTS (current_scope) = nreverse (BLOCK_PORTS (current_scope)); + BLOCK_DECL (current_scope) = nreverse (BLOCK_DECL (current_scope)); + current_scope = pop_scope (); + } + break; + + case 79: +#line 780 "parse.yy" + { current_scope = build_function (check_function ((yyvsp[-1].ttype))); + make_block_decl ((yyvsp[-1].ttype), current_module, current_scope); + push_scope (); /* funct name becomes var inside of funct */ + FUNCT_DECL (current_scope) = make_decl ((yyvsp[-1].ttype), (yyvsp[-2].ttype), NULL_TREE, NULL_TREE); + BLOCK_DOWN (current_module) = chainon (current_scope, BLOCK_DOWN (current_module)); + BLOCK_UP (current_scope) = current_module; + in_tf = in_function = 1; + } + break; + + case 80: +#line 789 "parse.yy" + { BLOCK_BODY (current_scope) = (yyvsp[-1].ttype); + in_tf = in_function = 0; + BLOCK_PORTS (current_scope) = nreverse (BLOCK_PORTS (current_scope)); + BLOCK_DECL (current_scope) = nreverse (BLOCK_DECL (current_scope)); + current_scope = pop_scope (); + } + break; + + case 81: +#line 799 "parse.yy" + { (yyval.ttype) = make_reg_spec (NULL_TREE); } + break; + + case 82: +#line 801 "parse.yy" + { (yyval.ttype) = make_reg_spec ((yyvsp[0].ttype)); } + break; + + case 83: +#line 803 "parse.yy" + { (yyval.ttype) = make_integer_spec (NULL_TREE); } + break; + + case 84: +#line 805 "parse.yy" + { (yyval.ttype) = make_real_spec (NULL_TREE); } + break; + + case 85: +#line 810 "parse.yy" + {} + break; + + case 90: +#line 826 "parse.yy" + { current_spec = make_param_spec ((yyvsp[0].ttype)); } + break; + + case 91: +#line 828 "parse.yy" + { BLOCK_DECL (current_scope) = + chainon ((yyvsp[-1].ttype), BLOCK_DECL (current_scope)); + } + break; + + case 93: +#line 836 "parse.yy" + { yyerrok; + (yyval.ttype) = chainon ((yyvsp[0].ttype), (yyvsp[-2].ttype)); + } + break; + + case 95: +#line 841 "parse.yy" + { yyerrok; } + break; + + case 97: +#line 847 "parse.yy" + { (yyval.ttype) = make_param_decl (check_non_reg ((yyvsp[-2].ttype)), current_spec, (yyvsp[0].ttype)); + } + break; + + case 98: +#line 850 "parse.yy" + { (yyval.ttype) = make_param_decl (check_non_reg ((yyvsp[-2].ttype)), current_spec, (yyvsp[0].ttype)); + } + break; + + case 99: +#line 856 "parse.yy" + {} + break; + + case 100: +#line 861 "parse.yy" + { BLOCK_DECL (current_scope) = + chainon ((yyvsp[-1].ttype), BLOCK_DECL (current_scope)); } + break; + + case 101: +#line 864 "parse.yy" + { BLOCK_DECL (current_scope) = + chainon ((yyvsp[-1].ttype), BLOCK_DECL (current_scope)); } + break; + + case 102: +#line 867 "parse.yy" + { BLOCK_DECL (current_scope) = + chainon ((yyvsp[-1].ttype), BLOCK_DECL (current_scope)); } + break; + + case 103: +#line 874 "parse.yy" + { BLOCK_PORTS (current_scope) = + chainon ((yyvsp[-1].ttype), BLOCK_PORTS (current_scope)); } + break; + + case 104: +#line 882 "parse.yy" + { if (in_tf) + (yyval.ttype) = current_spec = make_reg_spec ((yyvsp[0].ttype)); + else + (yyval.ttype) = current_spec = make_net_spec (default_net_type, (yyvsp[0].ttype), NULL_TREE); + PORT_INPUT_ATTR ((yyval.ttype)) = 1; + } + break; + + case 105: +#line 889 "parse.yy" + { function_error; + if (in_tf) + (yyval.ttype) = current_spec = make_reg_spec ((yyvsp[0].ttype)); + else + (yyval.ttype) = current_spec = make_net_spec (default_net_type, (yyvsp[0].ttype), NULL_TREE); + PORT_OUTPUT_ATTR ((yyval.ttype)) = 1; + } + break; + + case 106: +#line 897 "parse.yy" + { function_error; + if (in_tf) + (yyval.ttype) = current_spec = make_reg_spec ((yyvsp[0].ttype)); + else + (yyval.ttype) = current_spec = make_net_spec (default_net_type, (yyvsp[0].ttype), NULL_TREE); + PORT_INPUT_ATTR ((yyval.ttype)) = 1; + PORT_OUTPUT_ATTR ((yyval.ttype)) = 1; + } + break; + + case 107: +#line 909 "parse.yy" + { (yyval.ttype) = make_decl (check_port ((yyvsp[0].ttype)), current_spec, NULL_TREE, NULL_TREE); } + break; + + case 108: +#line 911 "parse.yy" + { yyerrok; + (yyval.ttype) = chainon (make_decl (check_port ((yyvsp[0].ttype)), current_spec, NULL_TREE, NULL_TREE), (yyvsp[-2].ttype)); + } + break; + + case 111: +#line 917 "parse.yy" + { yyerrok; } + break; + + case 113: +#line 923 "parse.yy" + { current_spec = make_reg_spec ((yyvsp[0].ttype)); } + break; + + case 114: +#line 925 "parse.yy" + { if (!(yyvsp[0].ttype)) + syn_warning ("Integer Range"); + current_spec = make_integer_spec ((yyvsp[0].ttype)); + } + break; + + case 115: +#line 930 "parse.yy" + { syn_warning ("TIME"); + current_spec = make_time_spec ((yyvsp[0].ttype)); + } + break; + + case 116: +#line 937 "parse.yy" + { current_spec = make_real_spec (NULL_TREE); } + break; + + case 117: +#line 942 "parse.yy" + { syn_warning ("EVENT"); + current_spec = make_event_spec (); } + break; + + case 118: +#line 948 "parse.yy" + { lval_type = LVAL_NEW_NET; } + break; + + case 119: +#line 953 "parse.yy" + { BLOCK_DECL (current_scope) = + chainon ((yyvsp[-1].ttype), BLOCK_DECL (current_scope)); + lval_type = LVAL_REG; + current_delay = NULL_TREE; + } + break; + + case 121: +#line 960 "parse.yy" + { lval_type = LVAL_REG; + MODULE_ASSIGNMENTS (current_module) = + chainon ((yyvsp[-1].ttype), MODULE_ASSIGNMENTS (current_module)); + current_delay = NULL_TREE; + } + break; + + case 122: +#line 969 "parse.yy" + { (yyval.ttype) = current_spec = make_net_spec ((yyvsp[-2].ntype), (yyvsp[-1].ttype), (yyvsp[0].ttype)); + current_delay = (yyvsp[0].ttype); + } + break; + + case 123: +#line 976 "parse.yy" + { syn_warning ("TRIREG net"); + sorry ("TRIREG net type is not supported in this version"); + } + break; + + case 124: +#line 980 "parse.yy" + { (yyval.ttype) = error_mark_node; } + break; + + case 126: +#line 986 "parse.yy" + { syn_warning ("SUPPLY0 net"); } + break; + + case 127: +#line 988 "parse.yy" + { syn_warning ("SUPPLY1 net"); } + break; + + case 129: +#line 1001 "parse.yy" + { sorry ("SCALARED keyword not supported; all nets treated as vectored"); + NET_SCALARED_ATTR ((yyvsp[0].ttype)) = 1; + (yyval.ttype) = (yyvsp[0].ttype); + } + break; + + case 130: +#line 1006 "parse.yy" + { sorry ("VECTORED keyword is not supported; all nets treated as vectored"); + NET_VECTORED_ATTR ((yyvsp[0].ttype)) = 1; + (yyval.ttype) = (yyvsp[0].ttype); + } + break; + + case 131: +#line 1011 "parse.yy" + { (yyval.ttype) = NULL_TREE; } + break; + + case 132: +#line 1016 "parse.yy" + { lval_type = LVAL_NET; } + break; + + case 133: +#line 1018 "parse.yy" + { lval_type = LVAL_REG; + MODULE_ASSIGNMENTS (current_module) = + chainon ((yyvsp[-1].ttype), MODULE_ASSIGNMENTS (current_module)); + } + break; + + case 134: +#line 1026 "parse.yy" + { current_delay = (yyvsp[0].ttype); /* strength not supported */ + (yyval.ttype) = NULL; + } + break; + + case 135: +#line 1033 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[0].ttype), NULL_TREE); } + break; + + case 136: +#line 1035 "parse.yy" + { yyerrok; + (yyval.ttype) = tree_cons ((yyvsp[0].ttype), NULL_TREE, (yyvsp[-2].ttype)); + } + break; + + case 139: +#line 1041 "parse.yy" + { yyerrok; } + break; + + case 141: +#line 1046 "parse.yy" + { (yyval.ltype) = stmt_lineno; } + break; + + case 142: +#line 1048 "parse.yy" + { (yyval.ttype) = build_cont_assign ( + check_lval ((yyvsp[-3].ttype), lval_type, current_spec), + (yyvsp[0].ttype), (yyvsp[-1].ltype), current_delay, current_delay!=0); + } + break; + + case 143: +#line 1057 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[0].ttype), NULL_TREE); } + break; + + case 144: +#line 1059 "parse.yy" + { yyerrok; + (yyval.ttype) = tree_cons ((yyvsp[0].ttype), NULL_TREE, (yyvsp[-2].ttype)); + } + break; + + case 147: +#line 1065 "parse.yy" + { yyerrok; } + break; + + case 149: +#line 1070 "parse.yy" + { (yyval.ltype) = stmt_lineno; } + break; + + case 150: +#line 1072 "parse.yy" + { (yyval.ttype) = build_cont_assign ((yyvsp[-3].ttype), (yyvsp[0].ttype), (yyvsp[-1].ltype), current_delay, + current_delay!=0); } + break; + + case 151: +#line 1077 "parse.yy" + { syn_warning ("DEFPARAM"); } + break; + + case 152: +#line 1082 "parse.yy" + { MODULE_DEFPARAMS (current_module) = chainon ( + build_stmt (ASSIGN_STMT, stmt_lineno, (yyvsp[-2].ttype), (yyvsp[0].ttype)), + MODULE_DEFPARAMS (current_module)); + } + break; + + case 153: +#line 1087 "parse.yy" + { + MODULE_DEFPARAMS (current_module) = chainon ( + build_stmt (ASSIGN_STMT, stmt_lineno, (yyvsp[-2].ttype), (yyvsp[0].ttype)), + MODULE_DEFPARAMS (current_module)); + } + break; + + case 155: +#line 1097 "parse.yy" + { yyerrok; + (yyval.ttype) = chainon ((yyvsp[0].ttype), (yyvsp[-2].ttype)); + } + break; + + case 158: +#line 1103 "parse.yy" + { yyerrok; } + break; + + case 160: +#line 1109 "parse.yy" + { (yyval.ttype) = make_decl (check_reg ((yyvsp[0].ttype)), current_spec, NULL_TREE, NULL_TREE); } + break; + + case 161: +#line 1111 "parse.yy" + { (yyval.ttype) = make_decl (check_reg ((yyvsp[-5].ttype)), current_spec, (yyvsp[-3].ttype), (yyvsp[-1].ttype)); + syn_warning ("REG/INTEGER arrays"); + } + break; + + case 162: +#line 1118 "parse.yy" + { (yyval.ttype) = make_decl (check_non_reg ((yyvsp[0].ttype)), current_spec, NULL_TREE, NULL_TREE); } + break; + + case 163: +#line 1120 "parse.yy" + { (yyval.ttype) = chainon (make_decl (check_non_reg ((yyvsp[0].ttype)), current_spec, NULL_TREE, NULL_TREE), (yyvsp[-2].ttype)); } + break; + + case 164: +#line 1125 "parse.yy" + { (yyval.ttype) = make_decl (check_net ((yyvsp[0].ttype)), current_spec, NULL_TREE, NULL_TREE); } + break; + + case 165: +#line 1127 "parse.yy" + { (yyval.ttype) = chainon (make_decl (check_net ((yyvsp[0].ttype)), current_spec, NULL_TREE, NULL_TREE), (yyvsp[-2].ttype)); } + break; + + case 166: +#line 1132 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 167: +#line 1134 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 168: +#line 1136 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 169: +#line 1138 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 170: +#line 1143 "parse.yy" + {} + break; + + case 171: +#line 1145 "parse.yy" + { +warning ("Strength specification is not supported and is ignored", NULL_CHAR, NULL_CHAR); + } + break; + + case 172: +#line 1153 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 173: +#line 1155 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 178: +#line 1179 "parse.yy" + { (yyval.ttype) = NULL_TREE;} + break; + + case 180: +#line 1185 "parse.yy" + { TREE_OPERAND (range_handle, 0) = (yyvsp[-3].ttype); + TREE_OPERAND (range_handle, 1) = (yyvsp[-1].ttype); + (yyval.ttype) = range_handle; + } + break; + + case 181: +#line 1201 "parse.yy" + { current_gatetype = (yyvsp[0].gtype); + in_instantiation = 1; + } + break; + + case 182: +#line 1205 "parse.yy" + { in_instantiation = 0; } + break; + + case 184: +#line 1214 "parse.yy" + { (yyval.gtype) = GATE_OR_TYPE; } + break; + + case 185: +#line 1216 "parse.yy" + { syn_warning ("Buffer gate"); } + break; + + case 186: +#line 1218 "parse.yy" + { syn_warning ("Bufif gate"); } + break; + + case 187: +#line 1220 "parse.yy" + { syn_warning ("CMOS gate"); } + break; + + case 188: +#line 1222 "parse.yy" + { syn_warning ("PULL gate"); } + break; + + case 189: +#line 1224 "parse.yy" + { syn_warning ("TRAN gate"); } + break; + + case 190: +#line 1237 "parse.yy" + { current_delay = NULL_TREE; } + break; + + case 192: +#line 1243 "parse.yy" + { current_delay = (yyvsp[0].ttype); } + break; + + case 196: +#line 1254 "parse.yy" + { (yyval.ttype) = build_gate_instance (current_gatetype, input_filename, lineno, + (yyvsp[-3].ttype), nreverse ((yyvsp[-1].ttype)), current_delay, NULL_TREE); + MODULE_INSTANCES (current_module) = chainon ((yyval.ttype), + MODULE_INSTANCES (current_module)); + } + break; + + case 197: +#line 1260 "parse.yy" + { (yyval.ttype) = build_gate_instance (current_gatetype, input_filename, lineno, + NULL_TREE, nreverse ((yyvsp[-1].ttype)), current_delay, NULL_TREE); + MODULE_INSTANCES (current_module) = chainon ((yyval.ttype), + MODULE_INSTANCES (current_module)); + } + break; + + case 198: +#line 1271 "parse.yy" + { current_instance_module = (yyvsp[-1].ttype); + current_instance_param = (yyvsp[0].ttype); + in_instantiation = 1; + } + break; + + case 199: +#line 1276 "parse.yy" + { current_instance_module = NULL_TREE; + current_instance_param = NULL_TREE; + in_instantiation = 0; + } + break; + + case 200: +#line 1307 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 201: +#line 1309 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[0].ttype), NULL_TREE); } + break; + + case 202: +#line 1311 "parse.yy" + { (yyval.ttype) = nreverse ((yyvsp[-1].ttype)); } + break; + + case 203: +#line 1313 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[-1].ttype), NULL_TREE); } + break; + + case 204: +#line 1315 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[-1].ttype), NULL_TREE); + (yyval.ttype) = tree_cons ((yyvsp[-3].ttype), NULL_TREE, (yyval.ttype)); + } + break; + + case 205: +#line 1319 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[-1].ttype), NULL_TREE); + (yyval.ttype) = tree_cons ((yyvsp[-3].ttype), NULL_TREE, (yyval.ttype)); + (yyval.ttype) = tree_cons ((yyvsp[-5].ttype), NULL_TREE, (yyval.ttype)); + } + break; + + case 206: +#line 1327 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[0].ttype), NULL_TREE); } + break; + + case 207: +#line 1329 "parse.yy" + { (yyval.ttype) = tree_cons ((yyvsp[0].ttype), NULL_TREE, (yyvsp[-2].ttype)); } + break; + + case 208: +#line 1356 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[0].ttype), NULL_TREE); } + break; + + case 209: +#line 1358 "parse.yy" + { (yyval.ttype) = tree_cons ((yyvsp[0].ttype), NULL_TREE, (yyvsp[-2].ttype)); yyerrok; } + break; + + case 212: +#line 1363 "parse.yy" + { yyerrok; } + break; + + case 215: +#line 1376 "parse.yy" + { yyerrok; } + break; + + case 218: +#line 1380 "parse.yy" + { yyerrok; } + break; + + case 220: +#line 1386 "parse.yy" + { (yyval.ttype) = build_stmt (INSTANCE_NODE, lineno, check_non_reg ((yyvsp[-3].ttype)), + current_instance_module, + nreverse ((yyvsp[-1].ttype)), current_instance_param); + MODULE_INSTANCES (current_module) = chainon ((yyval.ttype), + MODULE_INSTANCES (current_module)); + // make_block_decl ($1, current_module, NULL_TREE); + } + break; + + case 221: +#line 1394 "parse.yy" + { (yyval.ttype) = build_stmt (INSTANCE_NODE, lineno, NULL_TREE, + current_instance_module, + nreverse ((yyvsp[-1].ttype)), current_instance_param); + MODULE_INSTANCES (current_module) = chainon ((yyval.ttype), + MODULE_INSTANCES (current_module)); + } + break; + + case 225: +#line 1410 "parse.yy" + { yyerrok; + (yyval.ttype) = chainon ((yyvsp[0].ttype), (yyvsp[-2].ttype)); + } + break; + + case 228: +#line 1419 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[0].ttype), NULL_TREE); } + break; + + case 229: +#line 1421 "parse.yy" + { (yyval.ttype) = build_tree_list (NULL_TREE, NULL_TREE); } + break; + + case 231: +#line 1427 "parse.yy" + { (yyval.ttype) = chainon ((yyvsp[0].ttype), (yyvsp[-2].ttype)); } + break; + + case 232: +#line 1432 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[-1].ttype), (yyvsp[-3].ttype)); } + break; + + case 233: +#line 1434 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 234: +#line 1442 "parse.yy" + { (yyval.ltype) = stmt_lineno; + syn_warning ("INITIAL"); } + break; + + case 235: +#line 1445 "parse.yy" + { (yyval.ttype) = build_stmt (INITIAL_BLOCK, (yyvsp[-1].ltype), (yyvsp[0].ttype)); } + break; + + case 236: +#line 1449 "parse.yy" + { (yyval.ltype) = stmt_lineno; } + break; + + case 237: +#line 1451 "parse.yy" + { (yyval.ttype) = build_stmt (ALWAYS_BLOCK, (yyvsp[-1].ltype), (yyvsp[0].ttype)); } + break; + + case 239: +#line 1457 "parse.yy" + { (yyval.ttype) = build_stmt (NULL_STMT, lineno); } + break; + + case 241: +#line 1464 "parse.yy" + { (yyval.ltype) = stmt_lineno; } + break; + + case 242: +#line 1466 "parse.yy" + { (yyval.ttype) = build_stmt (IF_STMT, (yyvsp[-5].ltype), (yyvsp[-3].ttype), (yyvsp[-1].ttype), (yyvsp[0].ttype)); } + break; + + case 243: +#line 1468 "parse.yy" + { (yyval.ttype) = current_case; } + break; + + case 244: +#line 1470 "parse.yy" + { current_case = (yyvsp[0].ttype); } + break; + + case 245: +#line 1472 "parse.yy" + { STMT_CASE_EXPR ((yyvsp[-6].ttype)) = (yyvsp[-3].ttype); + STMT_CASE_LIST ((yyvsp[-6].ttype)) = nreverse ((yyvsp[-1].ttype)); + current_case = (yyvsp[-7].ttype); + (yyval.ttype) = (yyvsp[-6].ttype); + } + break; + + case 246: +#line 1479 "parse.yy" + { (yyval.ltype) = stmt_lineno; + syn_warning ("FOREVER"); } + break; + + case 247: +#line 1482 "parse.yy" + { (yyval.ttype) = build_stmt (FOREVER_STMT, (yyvsp[-1].ltype), (yyvsp[0].ttype)); } + break; + + case 248: +#line 1485 "parse.yy" + { (yyval.ltype) = stmt_lineno; + syn_warning ("REPEAT"); } + break; + + case 249: +#line 1488 "parse.yy" + { (yyval.ttype) = build_stmt (REPEAT_INIT_STMT, (yyvsp[-4].ltype), (yyvsp[0].ttype), (yyvsp[-2].ttype)); + tmp_tree = build_stmt (REPEAT_STMT, (yyvsp[-4].ltype), (yyval.ttype), (yyvsp[-2].ttype)); + chainon ((yyvsp[0].ttype), tmp_tree); + } + break; + + case 250: +#line 1494 "parse.yy" + { (yyval.ltype) = stmt_lineno; + syn_warning ("WHILE"); } + break; + + case 251: +#line 1497 "parse.yy" + { (yyval.ttype) = build_stmt (WHILE_STMT, (yyvsp[-4].ltype), (yyvsp[0].ttype), (yyvsp[-2].ttype)); } + break; + + case 252: +#line 1499 "parse.yy" + { (yyval.ltype) = stmt_lineno; } + break; + + case 253: +#line 1501 "parse.yy" + { stmt_lineno = (yyvsp[-8].ltype); + tmp_tree = build_stmt (FOR_STMT, (yyvsp[-8].ltype), (yyvsp[0].ttype), (yyvsp[-2].ttype), (yyvsp[-4].ttype)); + STMT_SURROGATE_ATTR (tmp_tree) = 1; + (yyval.ttype) = build_stmt (FOR_STMT, (yyvsp[-8].ltype), (yyvsp[0].ttype), (yyvsp[-6].ttype), (yyvsp[-4].ttype)); + TREE_CHAIN (tmp_tree) = (yyval.ttype); /* Fix this in pass 3 */ + chainon ((yyvsp[0].ttype), tmp_tree); /* at end of statement sequence */ + } + break; + + case 254: +#line 1510 "parse.yy" + { (yyval.ltype) = stmt_lineno; + syn_warning ("delay control"); + function_error; + } + break; + + case 255: +#line 1515 "parse.yy" + { (yyval.ttype) = build_stmt (DELAY_STMT, (yyvsp[-1].ltype), (yyvsp[0].ttype), (yyvsp[-2].ttype)); } + break; + + case 256: +#line 1518 "parse.yy" + { stmt_lineno = lineno; + function_error; + } + break; + + case 257: +#line 1522 "parse.yy" + { STMT_BODY ((yyvsp[-2].ttype)) = (yyvsp[0].ttype); + (yyval.ttype) = (yyvsp[-2].ttype); + } + break; + + case 258: +#line 1527 "parse.yy" + { (yyval.ltype) = stmt_lineno; + function_error; + } + break; + + case 259: +#line 1531 "parse.yy" + { (yyval.ttype) = build_stmt (ASSIGN_DELAY_STMT, (yyvsp[-3].ltype), (yyvsp[-5].ttype), + implicit_conversion ((yyvsp[-5].ttype), (yyvsp[-1].ttype)), + NULL_TREE, NULL_TREE, + build_stmt (DELAY_STMT, (yyvsp[-3].ltype), (yyvsp[-5].ttype), (yyvsp[-2].ttype))); + } + break; + + case 260: +#line 1538 "parse.yy" + { (yyval.ltype) = stmt_lineno; + function_error; + } + break; + + case 261: +#line 1542 "parse.yy" + { (yyval.ttype) = build_stmt (ASSIGN_EVENT_STMT, (yyvsp[-3].ltype), (yyvsp[-5].ttype), + implicit_conversion ((yyvsp[-5].ttype), (yyvsp[-1].ttype)), + NULL_TREE, NULL_TREE, (yyvsp[-2].ttype)); + } + break; + + case 262: +#line 1548 "parse.yy" + { (yyval.ltype) = stmt_lineno; + function_error; + } + break; + + case 263: +#line 1552 "parse.yy" + { (yyval.ttype) = build_stmt (ASSIGN_NONBLK_DELAY_STMT, (yyvsp[-2].ltype), (yyvsp[-4].ttype), + implicit_conversion ((yyvsp[-4].ttype), (yyvsp[-1].ttype)), + NULL_TREE, NULL_TREE, + build_stmt (DELAY_STMT, (yyvsp[-2].ltype), (yyvsp[-4].ttype), integer_zero_node)); + } + break; + + case 264: +#line 1559 "parse.yy" + { (yyval.ltype) = stmt_lineno; + function_error; + } + break; + + case 265: +#line 1563 "parse.yy" + { (yyval.ttype) = build_stmt (ASSIGN_NONBLK_DELAY_STMT, (yyvsp[-3].ltype), (yyvsp[-5].ttype), + implicit_conversion ((yyvsp[-5].ttype), (yyvsp[-1].ttype)), + NULL_TREE, NULL_TREE, + build_stmt (DELAY_STMT, (yyvsp[-3].ltype), (yyvsp[-5].ttype), (yyvsp[-2].ttype))); + } + break; + + case 266: +#line 1570 "parse.yy" + { (yyval.ltype) = stmt_lineno; + function_error; + } + break; + + case 267: +#line 1574 "parse.yy" + { (yyval.ttype) = build_stmt (ASSIGN_NONBLK_EVENT_STMT, (yyvsp[-3].ltype), (yyvsp[-5].ttype), + implicit_conversion ((yyvsp[-5].ttype), (yyvsp[-1].ttype)), + NULL_TREE, NULL_TREE, (yyvsp[-2].ttype)); + } + break; + + case 268: +#line 1586 "parse.yy" + { (yyval.ltype) = stmt_lineno; + syn_warning ("WAIT"); + function_error; + } + break; + + case 269: +#line 1591 "parse.yy" + { (yyval.ttype) = build_stmt (WAIT_STMT, (yyvsp[-4].ltype), (yyvsp[0].ttype), (yyvsp[-2].ttype)); } + break; + + case 270: +#line 1594 "parse.yy" + { (yyval.ltype) = stmt_lineno; + syn_warning ("Event trigger"); + function_error; + } + break; + + case 271: +#line 1599 "parse.yy" + { (yyval.ttype)= build_stmt (ARROW_STMT, (yyvsp[-2].ltype), check_named_event ((yyvsp[-1].ttype))); } + break; + + case 276: +#line 1605 "parse.yy" + { (yyval.ltype) = stmt_lineno; } + break; + + case 277: +#line 1607 "parse.yy" + { (yyval.ttype) = build_stmt (DISABLE_STMT, (yyvsp[-2].ltype), (yyvsp[-1].ttype)); + HIERARCHICAL_ATTR ((yyval.ttype)) = HIERARCHICAL_ATTR ((yyvsp[-1].ttype)); + } + break; + + case 278: +#line 1612 "parse.yy" + { (yyval.ltype) = stmt_lineno; } + break; + + case 279: +#line 1614 "parse.yy" + { (yyval.ttype) = build_stmt (ASSIGN_PROC_STMT, (yyvsp[-4].ltype), (yyvsp[-3].ttype), (yyvsp[-1].ttype), NULL_TREE, + NULL_TREE); } + break; + + case 280: +#line 1618 "parse.yy" + { (yyval.ltype) = stmt_lineno; } + break; + + case 281: +#line 1620 "parse.yy" + { (yyval.ttype) = build_stmt (DEASSIGN_STMT, (yyvsp[-2].ltype), (yyvsp[-1].ttype)); } + break; + + case 282: +#line 1622 "parse.yy" + { (yyval.ltype) = stmt_lineno; + lval_type = LVAL_REG_NET; } + break; + + case 283: +#line 1625 "parse.yy" + { syn_warning ("FORCE"); + (yyval.ttype) = build_stmt (FORCE_STMT, (yyvsp[-4].ltype), (yyvsp[-3].ttype), (yyvsp[-1].ttype), NULL_TREE, + NULL_TREE, NULL_TREE, NULL_TREE); + lval_type = LVAL_REG; + } + break; + + case 284: +#line 1631 "parse.yy" + { (yyval.ltype) = stmt_lineno; + lval_type = LVAL_REG_NET; } + break; + + case 285: +#line 1634 "parse.yy" + { syn_warning ("RELEASE"); + (yyval.ttype) = build_stmt (RELEASE_STMT, (yyvsp[-2].ltype), (yyvsp[-1].ttype)); + lval_type = LVAL_REG; + } + break; + + case 286: +#line 1644 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 287: +#line 1646 "parse.yy" + { (yyval.ttype) = (yyvsp[0].ttype); } + break; + + case 288: +#line 1651 "parse.yy" + { (yyval.ttype) = build_stmt (CASE_STMT, stmt_lineno, NULL_TREE, NULL_TREE, NULL_TREE); } + break; + + case 289: +#line 1653 "parse.yy" + { (yyval.ttype) = build_stmt (CASEZ_STMT, stmt_lineno, NULL_TREE, NULL_TREE, NULL_TREE); } + break; + + case 290: +#line 1655 "parse.yy" + { (yyval.ttype) = build_stmt (CASEX_STMT, stmt_lineno, NULL_TREE, NULL_TREE, NULL_TREE); } + break; + + case 291: +#line 1666 "parse.yy" + { (yyval.ltype) = stmt_lineno; } + break; + + case 292: +#line 1668 "parse.yy" + { (yyval.ttype) = build_stmt (ASSIGN_STMT, (yyvsp[-1].ltype), (yyvsp[-3].ttype), + implicit_conversion ((yyvsp[-3].ttype), (yyvsp[0].ttype))); } + break; + + case 294: +#line 1675 "parse.yy" + { yyerrok; + (yyval.ttype) = chainon ((yyvsp[0].ttype), (yyvsp[-1].ttype)); + } + break; + + case 297: +#line 1684 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 298: +#line 1687 "parse.yy" + { if (STMT_CASE_DEFAULT (current_case)) + error ("More than one 'DEFAULT' within CASE", NULL_CHAR, NULL_CHAR); + STMT_CASE_DEFAULT (current_case) = (yyvsp[0].ttype); + } + break; + + case 299: +#line 1692 "parse.yy" + { if (STMT_CASE_DEFAULT (current_case)) + error ("More than one 'DEFAULT' within CASE", NULL_CHAR, NULL_CHAR); + STMT_CASE_DEFAULT (current_case) = (yyvsp[0].ttype); + } + break; + + case 300: +#line 1700 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[0].ttype), NULL_TREE); } + break; + + case 301: +#line 1702 "parse.yy" + { (yyval.ttype) = tree_cons ((yyvsp[0].ttype), NULL_TREE, (yyvsp[-2].ttype)); } + break; + + case 304: +#line 1709 "parse.yy" + { if( (yyvsp[0].ttype) != NULL_TREE ) { + (yyval.ttype) = build_tree_list ((yyvsp[0].ttype), NULL_TREE); + } else { + (yyval.ttype) = (yyvsp[0].ttype); + } + } + break; + + case 305: +#line 1716 "parse.yy" + { (yyval.ttype) = tree_cons ((yyvsp[0].ttype), NULL_TREE, (yyvsp[-2].ttype)); } + break; + + case 306: +#line 1725 "parse.yy" + { (yyval.ttype) = NULL_TREE; } + break; + + case 308: +#line 1731 "parse.yy" + { (yyval.ttype) = build_stmt (BEGIN_STMT, stmt_lineno); } + break; + + case 309: +#line 1733 "parse.yy" + { STMT_BODY ((yyvsp[-2].ttype)) = nreverse + (chainon (build_stmt (END_STMT, stmt_lineno), (yyvsp[-1].ttype))); + (yyval.ttype) = (yyvsp[-2].ttype); + } + break; + + case 310: +#line 1738 "parse.yy" + { tmp_tree = make_node (NAMED_BLOCK); + BLOCK_DOWN (current_scope) = chainon (tmp_tree, BLOCK_DOWN (current_scope)); + BLOCK_UP (tmp_tree) = current_scope; + BLOCK_NAME (tmp_tree) = (yyvsp[0].ttype); + BLOCK_BODY (tmp_tree) = NULL_TREE; + BLOCK_CONTEXT_LIST (tmp_tree) = NULL; + make_block_decl (check_block ((yyvsp[0].ttype)), current_scope, tmp_tree); + current_scope = tmp_tree; + push_scope (); + (yyval.ttype) = build_stmt (BEGIN_NAMED_STMT, stmt_lineno, + NULL_TREE, tmp_tree); + } + break; + + case 311: +#line 1751 "parse.yy" + { tmp_tree = build_stmt (END_NAMED_STMT, stmt_lineno, + NULL_TREE, STMT_BLOCK ((yyvsp[-3].ttype))); + /* STMT_BEGIN_NAMED_END ($4) = tmp_tree; */ + STMT_BODY ((yyvsp[-3].ttype)) = nreverse (chainon (tmp_tree, (yyvsp[-1].ttype))); + current_scope = pop_scope (); + (yyval.ttype) = (yyvsp[-3].ttype); + } + break; + + case 312: +#line 1762 "parse.yy" + { (yyval.ttype) = build_stmt (FORK_STMT, stmt_lineno); } + break; + + case 313: +#line 1764 "parse.yy" + { STMT_BODY ((yyvsp[-2].ttype)) = chainon /* thread JOIN to BEGINNING */ + (build_stmt (JOIN_STMT, stmt_lineno, NULL_TREE), + nreverse ((yyvsp[-1].ttype))); + (yyval.ttype) = (yyvsp[-2].ttype); + } + break; + + case 314: +#line 1770 "parse.yy" + { tmp_tree = make_node (NAMED_BLOCK); + BLOCK_DOWN (current_scope) = chainon (tmp_tree, BLOCK_DOWN (current_scope)); + BLOCK_UP (tmp_tree) = current_scope; + BLOCK_NAME (tmp_tree) = (yyvsp[0].ttype); + BLOCK_BODY (tmp_tree) = NULL_TREE; + make_block_decl (check_block ((yyvsp[0].ttype)), current_scope, tmp_tree); + current_scope = tmp_tree; + push_scope (); + (yyval.ttype) = build_stmt (FORK_NAMED_STMT, stmt_lineno, + NULL_TREE, tmp_tree); + } + break; + + case 315: +#line 1782 "parse.yy" + { tmp_tree = build_stmt (JOIN_NAMED_STMT, stmt_lineno, + NULL_TREE, STMT_BLOCK ((yyvsp[-3].ttype))); + /* STMT_BEGIN_NAMED_END ($4) = tmp_tree; */ + STMT_BODY ((yyvsp[-3].ttype)) = chainon (tmp_tree, nreverse ((yyvsp[-1].ttype))); + current_scope = pop_scope (); + (yyval.ttype) = (yyvsp[-3].ttype); + } + break; + + case 316: +#line 1793 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 317: +#line 1795 "parse.yy" + { yyerrok; + (yyval.ttype) = chainon ((yyvsp[0].ttype), (yyvsp[-1].ttype)); + } + break; + + case 319: +#line 1803 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 320: +#line 1805 "parse.yy" + { yyerrok; + (yyval.ttype) = tree_cons ((yyvsp[0].ttype), NULL_TREE, (yyvsp[-1].ttype)); + } + break; + + case 322: +#line 1813 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 326: +#line 1824 "parse.yy" + { syn_warning ("task enable"); + function_error; + (yyval.ttype) = build_stmt (TASK_STMT, lineno, IDENTIFIER_POINTER ((yyvsp[-1].ttype)), NULL_TREE); + HIERARCHICAL_ATTR ((yyval.ttype)) = HIERARCHICAL_ATTR ((yyvsp[-1].ttype)); + } + break; + + case 327: +#line 1830 "parse.yy" + { syn_warning ("task enable"); + (yyval.ttype) = build_stmt (TASK_STMT, lineno, IDENTIFIER_POINTER ((yyvsp[-4].ttype)), nreverse ((yyvsp[-2].ttype))); + HIERARCHICAL_ATTR ((yyval.ttype)) = HIERARCHICAL_ATTR ((yyvsp[-4].ttype)); + } + break; + + case 328: +#line 1838 "parse.yy" + { (yyval.ttype) = build_stmt (SYSTASK_STMT, lineno, IDENTIFIER_POINTER ((yyvsp[-1].ttype)), NULL_TREE); } + break; + + case 329: +#line 1840 "parse.yy" + { in_systask = 1; } + break; + + case 330: +#line 1842 "parse.yy" + { (yyval.ttype) = build_stmt (SYSTASK_STMT, lineno, IDENTIFIER_POINTER ((yyvsp[-5].ttype)), nreverse ((yyvsp[-2].ttype))); + in_systask = 0; + } + break; + + case 331: +#line 1849 "parse.yy" + { stmt_lineno = lineno; } + break; + + case 332: +#line 1851 "parse.yy" + { stmt_lineno = lineno; } + break; + + case 333: +#line 1856 "parse.yy" + { (yyval.ttype) = check_lval ((yyvsp[0].ttype), lval_type, current_spec); } + break; + + case 334: +#line 1858 "parse.yy" + { (yyval.ttype) = build_bit_ref ( + check_lval_nocheck ((yyvsp[-3].ttype), lval_type, current_spec), (yyvsp[-1].ttype)); } + break; + + case 335: +#line 1861 "parse.yy" + { (yyval.ttype) = build_part_ref ( + check_lval_nocheck ((yyvsp[-5].ttype), lval_type, current_spec), (yyvsp[-3].ttype), (yyvsp[-1].ttype)); } + break; + + case 336: +#line 1871 "parse.yy" + { + } + break; + + case 337: +#line 1874 "parse.yy" + {} + break; + + case 338: +#line 1880 "parse.yy" + {} + break; + + case 339: +#line 1885 "parse.yy" + { (yyval.ttype) = NULL; } + break; + + case 340: +#line 1887 "parse.yy" + { yyerrok; + (yyval.ttype) = NULL; + // $$ = chainon ($2, $1); + } + break; + + case 344: +#line 1897 "parse.yy" + { + if( (yyvsp[0].ttype)!=NULL_TREE ) { + STMT_SOURCE_LINE((yyvsp[0].ttype)) = stmt_lineno; + STMT_SOURCE_FILE((yyvsp[0].ttype)) = input_filename; + MODULE_SPECDEFS(current_module) = + chainon(MODULE_SPECDEFS(current_module),(yyvsp[0].ttype)); + } + } + break; + + case 345: +#line 1915 "parse.yy" + { current_spec = make_param_spec (NULL_TREE); } + break; + + case 346: +#line 1917 "parse.yy" + { + specify_save_param_list( current_module, (yyvsp[-1].ttype) ); + } + break; + + case 347: +#line 1924 "parse.yy" + { + PATH_CONDITION((yyvsp[-3].ttype)) = (yyvsp[-4].ttype); + PATH_DELAYS((yyvsp[-3].ttype)) = (yyvsp[-1].ttype); + MODULE_SPECDEFS(current_module) = + chainon(MODULE_SPECDEFS(current_module),check_path((yyvsp[-3].ttype))); + } + break; + + case 348: +#line 1938 "parse.yy" + { + (yyval.ttype) = build_path( nreverse((yyvsp[-7].ttype)), nreverse((yyvsp[-4].ttype)), (yyvsp[-2].ttype), NULL_TREE, NULL_TREE, + (yyvsp[-6].integer), 0, 0 ); + } + break; + + case 349: +#line 1946 "parse.yy" + { + (yyval.ttype) = build_path( nreverse((yyvsp[-7].ttype)), nreverse((yyvsp[-4].ttype)), (yyvsp[-2].ttype), NULL_TREE, NULL_TREE, + (yyvsp[-6].integer), (yyvsp[-8].integer), 0 ); + } + break; + + case 350: +#line 1954 "parse.yy" + { + (yyval.ttype) = build_path( nreverse((yyvsp[-8].ttype)), nreverse((yyvsp[-5].ttype)), (yyvsp[-2].ttype), NULL_TREE, NULL_TREE, + (yyvsp[-7].integer), 0, (yyvsp[-4].integer) ); + } + break; + + case 351: +#line 1962 "parse.yy" + { + (yyval.ttype) = build_path( nreverse((yyvsp[-8].ttype)), nreverse((yyvsp[-5].ttype)), (yyvsp[-2].ttype), NULL_TREE, NULL_TREE, + (yyvsp[-7].integer), (yyvsp[-9].integer), (yyvsp[-4].integer) ); + } + break; + + case 352: +#line 1968 "parse.yy" + { + (yyval.ttype) = build_path( nreverse((yyvsp[-3].ttype)), nreverse((yyvsp[-1].ttype)), NULL_TREE, NULL_TREE, NULL_TREE, + (yyvsp[-2].integer), 0, 0 ); + } + break; + + case 353: +#line 1974 "parse.yy" + { + (yyval.ttype) = build_path( nreverse((yyvsp[-4].ttype)), nreverse((yyvsp[-1].ttype)), NULL_TREE, NULL_TREE, NULL_TREE, + (yyvsp[-2].integer), 0, (yyvsp[-3].integer) ); + } + break; + + case 355: +#line 1982 "parse.yy" + { yyerrok; + (yyval.ttype) = chainon ((yyvsp[0].ttype), (yyvsp[-2].ttype)); + } + break; + + case 357: +#line 1987 "parse.yy" + { yyerrok; } + break; + + case 360: +#line 1993 "parse.yy" + { yyerrok; + (yyval.ttype) = chainon ((yyvsp[0].ttype), (yyvsp[-2].ttype)); + } + break; + + case 362: +#line 1998 "parse.yy" + { yyerrok; } + break; + + case 364: +#line 2003 "parse.yy" + { + (yyval.ttype) = build_tree_list( check_input_port((yyvsp[0].ttype)), NULL_TREE ); + } + break; + + case 365: +#line 2007 "parse.yy" + { + (yyval.ttype) = build_tree_list( build_bit_ref (check_input_port((yyvsp[-3].ttype)), (yyvsp[-1].ttype)), NULL_TREE ); + } + break; + + case 366: +#line 2011 "parse.yy" + { + (yyval.ttype) = build_tree_list( build_part_ref (check_input_port((yyvsp[-5].ttype)), (yyvsp[-3].ttype), (yyvsp[-1].ttype)), NULL_TREE ); + } + break; + + case 367: +#line 2017 "parse.yy" + { + (yyval.ttype) = build_tree_list( check_output_port((yyvsp[0].ttype)), NULL_TREE ); + } + break; + + case 368: +#line 2021 "parse.yy" + { + (yyval.ttype) = build_tree_list( build_bit_ref (check_output_port((yyvsp[-3].ttype)), (yyvsp[-1].ttype)), NULL_TREE ); + } + break; + + case 369: +#line 2025 "parse.yy" + { + (yyval.ttype) = build_tree_list( build_part_ref (check_output_port((yyvsp[-5].ttype)), (yyvsp[-3].ttype), (yyvsp[-1].ttype)), NULL_TREE ); + } + break; + + case 371: +#line 2032 "parse.yy" + { + (yyval.ttype) = chainon( (yyvsp[-3].ttype), (yyvsp[-1].ttype) ); + } + break; + + case 372: +#line 2037 "parse.yy" + { + tree t; + t = chainon( (yyvsp[-5].ttype), (yyvsp[-3].ttype) ); + (yyval.ttype) = chainon( t, (yyvsp[-1].ttype) ); + } + break; + + case 373: +#line 2045 "parse.yy" + { + tree t; + t = chainon( (yyvsp[-11].ttype), (yyvsp[-9].ttype) ); + t = chainon( t, (yyvsp[-7].ttype) ); + t = chainon( t, (yyvsp[-5].ttype) ); + t = chainon( t, (yyvsp[-3].ttype) ); + (yyval.ttype) = chainon( t, (yyvsp[-1].ttype) ); + } + break; + + case 374: +#line 2056 "parse.yy" + { + (yyval.ttype) = build_tree_list((yyvsp[0].ttype),NULL_TREE); + } + break; + + case 375: +#line 2062 "parse.yy" + { + (yyval.integer) = 1; + } + break; + + case 376: +#line 2066 "parse.yy" + { + (yyval.integer) = -1; + } + break; + + case 377: +#line 2072 "parse.yy" + { + (yyval.integer) = FALSE; + } + break; + + case 378: +#line 2076 "parse.yy" + { + (yyval.integer) = TRUE; + } + break; + + case 381: +#line 2090 "parse.yy" + { + (yyval.integer) = 1; + } + break; + + case 382: +#line 2094 "parse.yy" + { + (yyval.integer) = -1; + } + break; + + case 383: +#line 2100 "parse.yy" + { + (yyval.ttype) = 0; + } + break; + + case 384: +#line 2104 "parse.yy" + { + (yyval.ttype) = (yyvsp[-1].ttype); + } + break; + + case 385: +#line 2112 "parse.yy" + { + (yyval.ttype) = build_timing_statement( SETUP, (yyvsp[-7].ttype), (yyvsp[-5].ttype), (yyvsp[-3].ttype), NULL_TREE, (yyvsp[-2].ttype) ); + } + break; + + case 386: +#line 2117 "parse.yy" + { + (yyval.ttype) = build_timing_statement( HOLD, (yyvsp[-7].ttype), (yyvsp[-5].ttype), (yyvsp[-3].ttype), NULL_TREE, (yyvsp[-2].ttype) ); + } + break; + + case 387: +#line 2122 "parse.yy" + { + (yyval.ttype) = build_timing_statement( PERIOD, (yyvsp[-5].ttype), NULL_TREE, (yyvsp[-3].ttype), NULL_TREE, (yyvsp[-2].ttype) ); + } + break; + + case 388: +#line 2127 "parse.yy" + { + (yyval.ttype) = build_timing_statement( WIDTH, (yyvsp[-4].ttype), NULL_TREE, (yyvsp[-2].ttype), NULL_TREE, NULL_TREE ); + } + break; + + case 389: +#line 2132 "parse.yy" + { + (yyval.ttype) = build_timing_statement( WIDTH, (yyvsp[-7].ttype), NULL_TREE, (yyvsp[-5].ttype), (yyvsp[-3].ttype), (yyvsp[-2].ttype) ); + } + break; + + case 390: +#line 2137 "parse.yy" + { + (yyval.ttype) = build_timing_statement( SKEW, (yyvsp[-7].ttype), (yyvsp[-5].ttype), (yyvsp[-3].ttype), NULL_TREE, (yyvsp[-2].ttype) ); + } + break; + + case 391: +#line 2142 "parse.yy" + { + (yyval.ttype) = build_timing_statement( RECOVERY, (yyvsp[-7].ttype), (yyvsp[-5].ttype), (yyvsp[-3].ttype), NULL_TREE, (yyvsp[-2].ttype) ); + } + break; + + case 392: +#line 2147 "parse.yy" + { + (yyval.ttype) = build_timing_statement( SETUPHOLD, (yyvsp[-9].ttype), (yyvsp[-7].ttype), (yyvsp[-5].ttype), (yyvsp[-3].ttype), (yyvsp[-2].ttype) ); + } + break; + + case 393: +#line 2152 "parse.yy" + { + (yyval.ttype) = NULL_TREE; + } + break; + + case 394: +#line 2158 "parse.yy" + { + (yyval.ttype) = 0; + } + break; + + case 395: +#line 2162 "parse.yy" + { + (yyval.ttype) = (yyvsp[0].ttype); + } + break; + + case 397: +#line 2171 "parse.yy" + { + (yyval.ttype) = build_timing_event( (yyvsp[-1].integer), (yyvsp[0].ttype), NULL_TREE ); + } + break; + + case 398: +#line 2176 "parse.yy" + { + (yyval.ttype) = build_timing_event( (yyvsp[-3].integer), (yyvsp[-2].ttype), (yyvsp[0].ttype) ); + } + break; + + case 399: +#line 2182 "parse.yy" + { + (yyval.ttype) = build_timing_event( (yyvsp[-1].integer), (yyvsp[0].ttype), NULL_TREE ); + } + break; + + case 400: +#line 2187 "parse.yy" + { + (yyval.ttype) = build_timing_event( (yyvsp[-3].integer), (yyvsp[-2].ttype), (yyvsp[0].ttype) ); + } + break; + + case 401: +#line 2193 "parse.yy" + { + extern unsigned int alledgeMask; + (yyval.integer) = alledgeMask; + } + break; + + case 402: +#line 2198 "parse.yy" + { + extern unsigned int posedgeMask; + (yyval.integer) = posedgeMask; + } + break; + + case 403: +#line 2203 "parse.yy" + { + extern unsigned int negedgeMask; + (yyval.integer) = negedgeMask; + } + break; + + case 404: +#line 2208 "parse.yy" + { extern int enable_edge_digit; + enable_edge_digit = TRUE; + } + break; + + case 405: +#line 2212 "parse.yy" + { + extern int enable_edge_digit; + enable_edge_digit = FALSE; + (yyval.integer) = (yyvsp[-1].integer); + } + break; + + case 406: +#line 2220 "parse.yy" + { + extern unsigned int posedgeMask; + (yyval.integer) = posedgeMask; + } + break; + + case 407: +#line 2225 "parse.yy" + { + extern unsigned int negedgeMask; + (yyval.integer) = negedgeMask; + } + break; + + case 408: +#line 2230 "parse.yy" + { extern int enable_edge_digit; + enable_edge_digit = TRUE; + } + break; + + case 409: +#line 2234 "parse.yy" + { + extern int enable_edge_digit; + enable_edge_digit = FALSE; + (yyval.integer) = (yyvsp[-1].integer); + } + break; + + case 410: +#line 2242 "parse.yy" + { + extern unsigned int edge_mask[4][4]; + (yyval.integer) = edge_mask[(yyvsp[0].double_digit)[0]][(yyvsp[0].double_digit)[1]]; + } + break; + + case 411: +#line 2247 "parse.yy" + { + extern unsigned int edge_mask[4][4]; + (yyval.integer) = (yyvsp[0].integer) | edge_mask[(yyvsp[-2].double_digit)[0]][(yyvsp[-2].double_digit)[1]]; + } + break; + + case 412: +#line 2252 "parse.yy" + { + (yyval.integer) = 0; + } + break; + + case 414: +#line 2259 "parse.yy" + { (yyval.ttype) = (yyvsp[-1].ttype); } + break; + + case 415: +#line 2261 "parse.yy" + { (yyval.ttype) = build_unary_op (BIT_NOT_EXPR, (yyvsp[0].ttype)); } + break; + + case 416: +#line 2263 "parse.yy" + { (yyval.ttype) = build_binary_op (EQ_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 417: +#line 2265 "parse.yy" + { (yyval.ttype) = build_binary_op (EQ_CASE_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 418: +#line 2267 "parse.yy" + { (yyval.ttype) = build_binary_op (NE_CASE_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 419: +#line 2269 "parse.yy" + { (yyval.ttype) = build_binary_op (NE_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 420: +#line 2273 "parse.yy" + { (yyval.ttype) = check_rval ((yyvsp[0].ttype)); } + break; + + case 421: +#line 2277 "parse.yy" + { + (yyval.ttype) = check_one_bit_constant((yyvsp[0].ttype)); + } + break; + + case 422: +#line 2281 "parse.yy" + { + (yyval.ttype) = check_one_bit_constant((yyvsp[0].ttype)); + } + break; + + case 423: +#line 2288 "parse.yy" + { + check_input_port((yyvsp[0].ttype)); + (yyval.ttype) = check_rval ((yyvsp[0].ttype)); + } + break; + + case 424: +#line 2293 "parse.yy" + { + check_input_port((yyvsp[-3].ttype)); + (yyval.ttype) = build_bit_ref ( check_rval_nocheck ((yyvsp[-3].ttype)), (yyvsp[-1].ttype)); + } + break; + + case 425: +#line 2298 "parse.yy" + { + check_input_port((yyvsp[-5].ttype)); + (yyval.ttype) = build_part_ref ( check_rval_nocheck ((yyvsp[-5].ttype)), (yyvsp[-3].ttype), (yyvsp[-1].ttype)); + } + break; + + case 426: +#line 2311 "parse.yy" + { (yyval.ttype) = make_node (CONCAT_REF); + CONCAT_LIST ((yyval.ttype)) = (yyvsp[-1].ttype); + concat_labels ((yyval.ttype)); + } + break; + + case 427: +#line 2319 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[0].ttype), NULL_TREE); } + break; + + case 428: +#line 2321 "parse.yy" + { (yyval.ttype) = build_tree_list ((yyvsp[0].ttype), NULL_TREE); } + break; + + case 429: +#line 2323 "parse.yy" + { (yyval.ttype) = tree_cons ((yyvsp[0].ttype), NULL_TREE, (yyvsp[-2].ttype)); } + break; + + case 430: +#line 2325 "parse.yy" + { (yyval.ttype) = tree_cons ((yyvsp[0].ttype), NULL_TREE, (yyvsp[-2].ttype)); } + break; + + case 437: +#line 2339 "parse.yy" + { if (!TREE_CONSTANT_ATTR ((yyvsp[0].ttype))) { + error ("Illegal non-constant expression", NULL_CHAR, NULL_CHAR); + (yyval.ttype) = error_mark_node; + } + else + (yyval.ttype) = (yyvsp[0].ttype); + } + break; + + case 439: +#line 2351 "parse.yy" + { switch (delay_type) { + case (MIN_DELAY): (yyval.ttype) = (yyvsp[-4].ttype); break; + case (TYP_DELAY): (yyval.ttype) = (yyvsp[-2].ttype); break; + case (MAX_DELAY): (yyval.ttype) = (yyvsp[0].ttype); break; + } + } + break; + + case 440: +#line 2361 "parse.yy" + { switch (delay_type) { + case (MIN_DELAY): (yyval.ttype) = (yyvsp[-4].ttype); break; + case (TYP_DELAY): (yyval.ttype) = (yyvsp[-2].ttype); break; + case (MAX_DELAY): (yyval.ttype) = (yyvsp[0].ttype); break; + } + } + break; + + case 442: +#line 2372 "parse.yy" + { (yyval.ttype) = (yyvsp[0].ttype); } + break; + + case 443: +#line 2374 "parse.yy" + { (yyval.ttype) = build_unary_op (NEGATE_EXPR, (yyvsp[0].ttype)); } + break; + + case 444: +#line 2376 "parse.yy" + { (yyval.ttype) = build_unary_op (TRUTH_NOT_EXPR, (yyvsp[0].ttype)); } + break; + + case 445: +#line 2378 "parse.yy" + { (yyval.ttype) = build_unary_op (BIT_NOT_EXPR, (yyvsp[0].ttype)); } + break; + + case 446: +#line 2380 "parse.yy" + { (yyval.ttype) = build_unary_op (AND_REDUCE_EXPR, (yyvsp[0].ttype)); } + break; + + case 447: +#line 2382 "parse.yy" + { (yyval.ttype) = build_unary_op (NAND_REDUCE_EXPR, (yyvsp[0].ttype)); } + break; + + case 448: +#line 2384 "parse.yy" + { (yyval.ttype) = build_unary_op (OR_REDUCE_EXPR, (yyvsp[0].ttype)); } + break; + + case 449: +#line 2386 "parse.yy" + { (yyval.ttype) = build_unary_op (NOR_REDUCE_EXPR, (yyvsp[0].ttype)); } + break; + + case 450: +#line 2388 "parse.yy" + { (yyval.ttype) = build_unary_op (XOR_REDUCE_EXPR, (yyvsp[0].ttype)); } + break; + + case 451: +#line 2390 "parse.yy" + { (yyval.ttype) = build_unary_op (XNOR_REDUCE_EXPR, (yyvsp[0].ttype)); } + break; + + case 452: +#line 2392 "parse.yy" + { (yyval.ttype) = build_binary_op (PLUS_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 453: +#line 2394 "parse.yy" + { (yyval.ttype) = build_binary_op (MINUS_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 454: +#line 2396 "parse.yy" + { (yyval.ttype) = build_binary_op (MULT_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 455: +#line 2398 "parse.yy" + { syn_warning ("Division operator"); } + break; + + case 456: +#line 2400 "parse.yy" + { (yyval.ttype) = build_binary_op (DIV_EXPR, (yyvsp[-3].ttype), (yyvsp[0].ttype)); } + break; + + case 457: +#line 2402 "parse.yy" + { syn_warning ("Modulus operator"); } + break; + + case 458: +#line 2404 "parse.yy" + { (yyval.ttype) = build_binary_op (MOD_EXPR, (yyvsp[-3].ttype), (yyvsp[0].ttype)); } + break; + + case 459: +#line 2406 "parse.yy" + { (yyval.ttype) = build_binary_op (EQ_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 460: +#line 2408 "parse.yy" + { (yyval.ttype) = build_binary_op (NE_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 461: +#line 2410 "parse.yy" + { syn_warning ("Case equality"); } + break; + + case 462: +#line 2412 "parse.yy" + { (yyval.ttype) = build_binary_op (EQ_CASE_EXPR, (yyvsp[-3].ttype), (yyvsp[0].ttype)); } + break; + + case 463: +#line 2414 "parse.yy" + { syn_warning ("Case inequality"); } + break; + + case 464: +#line 2416 "parse.yy" + { (yyval.ttype) = build_binary_op (NE_CASE_EXPR, (yyvsp[-3].ttype), (yyvsp[0].ttype)); } + break; + + case 465: +#line 2418 "parse.yy" + { (yyval.ttype) = build_binary_op (TRUTH_ANDIF_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 466: +#line 2420 "parse.yy" + { (yyval.ttype) = build_binary_op (TRUTH_ORIF_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 467: +#line 2422 "parse.yy" + { (yyval.ttype) = build_binary_op (LT_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 468: +#line 2424 "parse.yy" + { (yyval.ttype) = build_binary_op (LE_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 469: +#line 2426 "parse.yy" + { (yyval.ttype) = build_binary_op (GT_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 470: +#line 2428 "parse.yy" + { (yyval.ttype) = build_binary_op (GE_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 471: +#line 2430 "parse.yy" + { (yyval.ttype) = build_binary_op (BIT_AND_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 472: +#line 2432 "parse.yy" + { (yyval.ttype) = build_binary_op (BIT_OR_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 473: +#line 2434 "parse.yy" + { (yyval.ttype) = build_binary_op (BIT_XOR_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 474: +#line 2436 "parse.yy" + { (yyval.ttype) = build_binary_op (BIT_XNOR_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 475: +#line 2438 "parse.yy" + { (yyval.ttype) = build_binary_op (LSHIFT_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 476: +#line 2440 "parse.yy" + { (yyval.ttype) = build_binary_op (RSHIFT_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 477: +#line 2442 "parse.yy" + { (yyval.ttype) = build_cond_expr ((yyvsp[-4].ttype), (yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 481: +#line 2466 "parse.yy" + { (yyval.ttype) = check_rval ((yyvsp[0].ttype)); } + break; + + case 482: +#line 2468 "parse.yy" + { (yyval.ttype) = build_bit_ref (check_rval_nocheck ((yyvsp[-3].ttype)), (yyvsp[-1].ttype)); } + break; + + case 483: +#line 2470 "parse.yy" + { (yyval.ttype) = build_part_ref (check_rval_nocheck ((yyvsp[-5].ttype)), (yyvsp[-3].ttype), (yyvsp[-1].ttype)); } + break; + + case 486: +#line 2474 "parse.yy" + { (yyval.ttype) = (yyvsp[-1].ttype); } + break; + + case 487: +#line 2476 "parse.yy" + { (yyval.ttype) = error_mark_node; } + break; + + case 488: +#line 2509 "parse.yy" + { (yyval.ttype) = make_node (CONCAT_REF); + CONCAT_LIST ((yyval.ttype)) = (yyvsp[-1].ttype); + concat_labels ((yyval.ttype)); + } + break; + + case 489: +#line 2514 "parse.yy" + { (yyval.ttype) = make_node (CONCAT_REP_REF); + CONCAT_LIST ((yyval.ttype)) = (yyvsp[-2].ttype); + CONCAT_EXPR ((yyval.ttype)) = (yyvsp[-4].ttype); + concat_labels ((yyval.ttype)); + } + break; + + case 490: +#line 2523 "parse.yy" + { (yyval.ttype) = build_function_call ((yyvsp[-3].ttype), nreverse ((yyvsp[-1].ttype))); + HIERARCHICAL_ATTR ((yyval.ttype)) = HIERARCHICAL_ATTR ((yyvsp[-3].ttype)); + UNKNOWN_TYPE_ATTR ((yyval.ttype)) = 1; + } + break; + + case 491: +#line 2529 "parse.yy" + { (yyval.ttype) = build_nt (SYSFUNCTION_REF, IDENTIFIER_POINTER ((yyvsp[-3].ttype)), + nreverse ((yyvsp[-1].ttype)), NULL_TREE, NULL_TREE, lineno, input_filename); } + break; + + case 492: +#line 2533 "parse.yy" + { (yyval.ttype) = build_nt (SYSFUNCTION_REF, IDENTIFIER_POINTER ((yyvsp[0].ttype)), + NULL_TREE, NULL_TREE, NULL_TREE, lineno, input_filename); } + break; + + case 493: +#line 2543 "parse.yy" + { + syn_warning ("Hierachical name"); + /* hierarchical_list = link_tree_cons ($1, NULL_TREE, hierarchical_list); */ + HIERARCHICAL_ATTR ((yyvsp[0].ttype)) = 1; + UNKNOWN_TYPE_ATTR ((yyvsp[0].ttype)) = 1; + TREE_CONSTANT_ATTR ((yyvsp[0].ttype)) = 1; /* assume this is true for now */ + } + break; + + case 496: +#line 2557 "parse.yy" + { (yyval.ttype) = get_identifier ("or"); } + break; + + case 497: +#line 2576 "parse.yy" + { (yyval.ttype) = NULL_TREE; } + break; + + case 499: +#line 2582 "parse.yy" + { (yyval.ttype) = build_nt (DELAY_EXPR, (yyvsp[0].ttype), (yyvsp[0].ttype), NULL_TREE); + TREE_LABEL ((yyval.ttype)) = 1; + } + break; + + case 500: +#line 2586 "parse.yy" + { (yyval.ttype) = check_rval ((yyvsp[0].ttype)); + (yyval.ttype) = build_nt (DELAY_EXPR, (yyval.ttype), (yyval.ttype), NULL_TREE); + TREE_LABEL ((yyval.ttype)) = 1; + } + break; + + case 501: +#line 2591 "parse.yy" + { (yyval.ttype) = (yyvsp[-1].ttype); } + break; + + case 502: +#line 2600 "parse.yy" + { (yyval.ttype) = build_nt (DELAY_EXPR, (yyvsp[0].ttype), (yyvsp[0].ttype), NULL_TREE); + TREE_LABEL ((yyval.ttype)) = 1; + } + break; + + case 503: +#line 2604 "parse.yy" + { (yyval.ttype) = build_nt (DELAY_EXPR, (yyvsp[-2].ttype), (yyvsp[0].ttype), NULL_TREE); + TREE_LABEL ((yyval.ttype)) = 2; + } + break; + + case 504: +#line 2608 "parse.yy" + { (yyval.ttype) = build_nt (DELAY_EXPR, (yyvsp[-4].ttype), (yyvsp[-2].ttype), (yyvsp[0].ttype)); + TREE_LABEL ((yyval.ttype)) = 3; + } + break; + + case 505: +#line 2615 "parse.yy" + { (yyval.ttype) = (yyvsp[0].ttype); } + break; + + case 506: +#line 2617 "parse.yy" + { (yyval.ttype) = check_rval ((yyvsp[0].ttype)); } + break; + + case 507: +#line 2619 "parse.yy" + { (yyval.ttype) = (yyvsp[-1].ttype); } + break; + + case 508: +#line 2623 "parse.yy" + { in_event = 1; } + break; + + case 509: +#line 2625 "parse.yy" + {if (!HIERARCHICAL_ATTR ((yyvsp[0].ttype)) && + TREE_CODE (IDENT_CURRENT_DECL ((yyvsp[0].ttype))) == EVENT_DECL) + (yyval.ttype) = build_stmt (EVENT_STMT, lineno, NULL_TREE, + build_tree_list (IDENT_CURRENT_DECL ((yyvsp[0].ttype)), NULL_TREE)); + else + (yyval.ttype) = build_stmt (EVENT_STMT, lineno, NULL_TREE, + build_tree_list (build_unary_op + (ANYEDGE_EXPR, check_rval ((yyvsp[0].ttype))), NULL_TREE)); + in_event = 0; + } + break; + + case 510: +#line 2635 "parse.yy" + { in_event = 1; } + break; + + case 511: +#line 2637 "parse.yy" + { (yyval.ttype) = build_stmt (EVENT_STMT, lineno, NULL_TREE, (yyvsp[-1].ttype)); + in_event = 0; } + break; + + case 512: +#line 2643 "parse.yy" + { /*if (TREE_CODE ($1) == EVENT_DECL) + $$ = build_tree_list ($1, NULL_TREE); + else */ + (yyval.ttype) = build_tree_list + (build_unary_op (ANYEDGE_EXPR, (yyvsp[0].ttype)), NULL_TREE); + } + break; + + case 513: +#line 2650 "parse.yy" + { (yyval.ttype) = build_tree_list + (build_unary_op (POSEDGE_EXPR, (yyvsp[0].ttype)), NULL_TREE); } + break; + + case 514: +#line 2653 "parse.yy" + { (yyval.ttype) = build_tree_list + (build_unary_op (NEGEDGE_EXPR, (yyvsp[0].ttype)), NULL_TREE); } + break; + + case 515: +#line 2656 "parse.yy" + { (yyval.ttype) = chainon ((yyvsp[-2].ttype), (yyvsp[0].ttype)); } + break; + + case 516: +#line 2665 "parse.yy" + { yyerrok; } + break; + + case 517: +#line 2670 "parse.yy" + { yyerrok; } + break; + + case 518: +#line 2672 "parse.yy" + { yyerrok; } + break; + + case 519: +#line 2677 "parse.yy" + { yyerrok; } + break; + + + } + +/* Line 1037 of yacc.c. */ +#line 5270 "parse.cc" + + yyvsp -= yylen; + yyssp -= yylen; + + + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + + /* 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 + yyn = yypact[yystate]; + + if (YYPACT_NINF < yyn && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + int yytype = YYTRANSLATE (yychar); + const char* yyprefix; + char *yymsg; + int yyx; + + /* 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; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 0; + + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); + yycount += 1; + if (yycount == 5) + { + yysize = 0; + break; + } + } + yysize += (sizeof ("syntax error, unexpected ") + + yystrlen (yytname[yytype])); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + yyp = yystpcpy (yyp, yytname[yytype]); + + if (yycount < 5) + { + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + yyp = yystpcpy (yyp, yyprefix); + yyp = yystpcpy (yyp, yytname[yyx]); + yyprefix = " or "; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("syntax error; also virtual memory exhausted"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror ("syntax error"); + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* If at end of input, pop the error token, + then the rest of the stack, then return failure. */ + if (yychar == YYEOF) + for (;;) + { + + YYPOPSTACK; + if (yyssp == yyss) + YYABORT; + yydestruct ("Error: popping", + yystos[*yyssp], yyvsp); + } + } + else + { + yydestruct ("Error: discarding", yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + +#ifdef __GNUC__ + /* Pacify GCC when the user code never invokes YYERROR and the label + yyerrorlab therefore never appears in user code. */ + if (0) + goto yyerrorlab; +#endif + +yyvsp -= yylen; + yyssp -= yylen; + 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; + + + yydestruct ("Error: popping", yystos[yystate], yyvsp); + YYPOPSTACK; + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + if (yyn == YYFINAL) + YYACCEPT; + + *++yyvsp = yylval; + + + /* 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: + yydestruct ("Error: discarding lookahead", + yytoken, &yylval); + yychar = YYEMPTY; + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*----------------------------------------------. +| yyoverflowlab -- parser overflow comes here. | +`----------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; +} + + +#line 2680 "parse.yy" + +void +eat_block (short token) +{ + YYSTYPE lval; + + for (;;) + if (yylex (&lval) == token) + return; +} + + diff --git a/src/parse.h b/src/parse.h new file mode 100644 index 0000000..7a93be0 --- /dev/null +++ b/src/parse.h @@ -0,0 +1,284 @@ +/* A Bison parser, made by GNU Bison 2.0. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 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., 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. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + LOWEST = 258, + IF = 259, + ELSE = 260, + OROR = 261, + ANDAND = 262, + ANDANDAND = 263, + XNOR = 264, + CASE_INEQUALITY = 265, + CASE_EQUALITY = 266, + LOGICAL_INEQUALITY = 267, + LOGICAL_EQUALITY = 268, + GE = 269, + GT = 270, + LE = 271, + LT = 272, + RIGHT_SHIFT = 273, + LEFT_SHIFT = 274, + REDUCTION_NOR = 275, + REDUCTION_NAND = 276, + UNARY = 277, + IDENTIFIER = 278, + HIERARCHY_IDENTIFIER = 279, + STARARROW = 280, + EQUALARROW = 281, + SPECPARAM = 282, + SETUP = 283, + HOLD = 284, + PERIOD = 285, + WIDTH = 286, + SKEW = 287, + RECOVERY = 288, + SETUPHOLD = 289, + NOCHANGE = 290, + MODULE = 291, + MACROMODULE = 292, + ENDMODULE = 293, + SPECIFY = 294, + ENDSPECIFY = 295, + PRIMITIVE = 296, + ENDPRIMITIVE = 297, + TABLE = 298, + ENDTABLE = 299, + TASK = 300, + ENDTASK = 301, + FUNCTION = 302, + ENDFUNCTION = 303, + PARAMETER = 304, + INPUT = 305, + OUTPUT = 306, + INOUT = 307, + NETTYPE = 308, + TRIREG = 309, + SCALARED = 310, + VECTORED = 311, + REG = 312, + TIME = 313, + INTEGER = 314, + REAL = 315, + EVENT = 316, + ASSIGN = 317, + DEFPARAM = 318, + STRENGTH0 = 319, + STRENGTH1 = 320, + SUPPLY0 = 321, + SUPPLY1 = 322, + LOGIC = 323, + BUFFER = 324, + BUFIF = 325, + CMOS = 326, + PULL = 327, + TRAN = 328, + INITIAL = 329, + ALWAYS = 330, + CASE = 331, + CASEZ = 332, + CASEX = 333, + ENDCASE = 334, + FOREVER = 335, + REPEAT = 336, + WHILE = 337, + FOR = 338, + WAIT_ = 339, + ARROW_ = 340, + DISABLE = 341, + DEASSIGN = 342, + FORCE = 343, + RELEASE = 344, + DEFAULT = 345, + BEGIN = 346, + END = 347, + FORK = 348, + JOIN = 349, + SYSTEM_IDENTIFIER = 350, + STRING = 351, + NUMBER = 352, + BASE_NUMBER = 353, + POSEDGE = 354, + NEGEDGE = 355, + OR = 356, + SMALL = 357, + MEDIUM = 358, + LARGE = 359, + EDGE = 360, + DOUBLE_DIGIT = 361, + UDP_CHAR = 362, + UDP_ONE = 363, + UDP_ZERO = 364, + UDP_X = 365, + UDP_B = 366, + UDP_HOOK = 367, + EOF_ = 368 + }; +#endif +#define LOWEST 258 +#define IF 259 +#define ELSE 260 +#define OROR 261 +#define ANDAND 262 +#define ANDANDAND 263 +#define XNOR 264 +#define CASE_INEQUALITY 265 +#define CASE_EQUALITY 266 +#define LOGICAL_INEQUALITY 267 +#define LOGICAL_EQUALITY 268 +#define GE 269 +#define GT 270 +#define LE 271 +#define LT 272 +#define RIGHT_SHIFT 273 +#define LEFT_SHIFT 274 +#define REDUCTION_NOR 275 +#define REDUCTION_NAND 276 +#define UNARY 277 +#define IDENTIFIER 278 +#define HIERARCHY_IDENTIFIER 279 +#define STARARROW 280 +#define EQUALARROW 281 +#define SPECPARAM 282 +#define SETUP 283 +#define HOLD 284 +#define PERIOD 285 +#define WIDTH 286 +#define SKEW 287 +#define RECOVERY 288 +#define SETUPHOLD 289 +#define NOCHANGE 290 +#define MODULE 291 +#define MACROMODULE 292 +#define ENDMODULE 293 +#define SPECIFY 294 +#define ENDSPECIFY 295 +#define PRIMITIVE 296 +#define ENDPRIMITIVE 297 +#define TABLE 298 +#define ENDTABLE 299 +#define TASK 300 +#define ENDTASK 301 +#define FUNCTION 302 +#define ENDFUNCTION 303 +#define PARAMETER 304 +#define INPUT 305 +#define OUTPUT 306 +#define INOUT 307 +#define NETTYPE 308 +#define TRIREG 309 +#define SCALARED 310 +#define VECTORED 311 +#define REG 312 +#define TIME 313 +#define INTEGER 314 +#define REAL 315 +#define EVENT 316 +#define ASSIGN 317 +#define DEFPARAM 318 +#define STRENGTH0 319 +#define STRENGTH1 320 +#define SUPPLY0 321 +#define SUPPLY1 322 +#define LOGIC 323 +#define BUFFER 324 +#define BUFIF 325 +#define CMOS 326 +#define PULL 327 +#define TRAN 328 +#define INITIAL 329 +#define ALWAYS 330 +#define CASE 331 +#define CASEZ 332 +#define CASEX 333 +#define ENDCASE 334 +#define FOREVER 335 +#define REPEAT 336 +#define WHILE 337 +#define FOR 338 +#define WAIT_ 339 +#define ARROW_ 340 +#define DISABLE 341 +#define DEASSIGN 342 +#define FORCE 343 +#define RELEASE 344 +#define DEFAULT 345 +#define BEGIN 346 +#define END 347 +#define FORK 348 +#define JOIN 349 +#define SYSTEM_IDENTIFIER 350 +#define STRING 351 +#define NUMBER 352 +#define BASE_NUMBER 353 +#define POSEDGE 354 +#define NEGEDGE 355 +#define OR 356 +#define SMALL 357 +#define MEDIUM 358 +#define LARGE 359 +#define EDGE 360 +#define DOUBLE_DIGIT 361 +#define UDP_CHAR 362 +#define UDP_ONE 363 +#define UDP_ZERO 364 +#define UDP_X 365 +#define UDP_B 366 +#define UDP_HOOK 367 +#define EOF_ 368 + + + + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 132 "parse.yy" +typedef union YYSTYPE { + tree ttype; /* pointer to a tree node */ + int integer; /* used for integers */ +// inst ctype; /* pointer to an instruction node (code) */ +// Datum *dtype; /* pointer to a bit string for returning NUMBERs */ + lineno_t ltype; /* for passing line numbers */ + enum tree_code code; /* for operators */ + enum tree_type gtype; /* for gates */ + enum tree_type ntype; /* for nets (same as gtype, buy more readable) */ + char double_digit[2]; /* structure for parsing edges */ + char c; /* char used in udp parsing */ +} YYSTYPE; +/* Line 1318 of yacc.c. */ +#line 276 "parse.h" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + + + diff --git a/src/parse.yy b/src/parse.yy new file mode 100644 index 0000000..d64773b --- /dev/null +++ b/src/parse.yy @@ -0,0 +1,2690 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* PARSE.Y - BISON/YACC parser for program input */ + +%{ +#define yyparse prog_parse +#define YYERROR_VERBOSE +#define YYDEBUG 2 + +#include +#include +#include +#include +#include +#include "glue.h" +#include "vtypes.h" +#include "tree.h" +#include "decl.h" +#include "flags.h" +#include "io.h" +#include "specify.h" +#include "gates.h" +#include "udp.h" +#include "lex.h" +#include "scope.h" +#include "veriwell.h" + + +#define syn_warning(TEXT) \ + if (synopsys_flag) \ + synopsys_warn(TEXT); + +#define function_error \ + if (in_function) \ + error ("Statement not allowed in a function", NULL_CHAR, NULL_CHAR) + +/* Used in BISON.SIM */ +extern char *token_buffer; + +void eat_block (short token); + +#ifdef __cplusplus + union YYSTYPE; + int yylex (YYSTYPE *); +#endif // __cplusplus + +/* list of parsed modules (exported in tree.h) */ +tree module_list = NULL_TREE; + +/* tree list of hierarchical references to be resolved at pass3 */ +tree hierarchical_list; + +/* The spec of the current declaration */ +tree current_spec; + +tree current_module; +tree current_case; +tree current_delay; +enum tree_type current_gatetype; + + +tree current_instance_module = NULL_TREE; +tree current_instance_param = NULL_TREE; +tree current_udp_string = NULL_TREE; + +tree interactive_statement; + +tree tmp_tree; + +/* Defined in decl.c */ +extern tree current_scope; + +/* Defined in verilog.c */ +extern int is_interactive; + + +/* Certain constructs are not allowed while inside a function. Also, ports + are treated differently in functions and tasks than for modules. */ +int in_function = 0; +int in_tf = 0; +int in_systask = 0; + +/* If inside continuous assignment, handle lval differently */ +enum lval_type lval_type = LVAL_REG; + +/* If inside instantiation port list, allow implicit net declarations. */ +int in_instantiation = 0; + +/* If inside event statement, accept event types. */ +int in_event = 0; + +void init_parse() +{ + current_instance_module = NULL_TREE; + current_instance_param = NULL_TREE; + current_udp_string = NULL_TREE; + in_function = 0; + in_tf = 0; + in_systask = 0; + lval_type = LVAL_REG; + in_instantiation = 0; + module_list = NULL_TREE; + hierarchical_list = NULL_TREE; + current_spec = NULL_TREE; + current_module = NULL_TREE; + current_case = NULL_TREE; + current_delay = NULL_TREE; + interactive_statement = NULL_TREE; + tmp_tree = NULL_TREE; +} + +%} +%pure_parser + +%union { + tree ttype; /* pointer to a tree node */ + int integer; /* used for integers */ +// inst ctype; /* pointer to an instruction node (code) */ +// Datum *dtype; /* pointer to a bit string for returning NUMBERs */ + lineno_t ltype; /* for passing line numbers */ + enum tree_code code; /* for operators */ + enum tree_type gtype; /* for gates */ + enum tree_type ntype; /* for nets (same as gtype, buy more readable) */ + char double_digit[2]; /* structure for parsing edges */ + char c; /* char used in udp parsing */ +}; + +%nonassoc LOWEST +%nonassoc IF +%nonassoc ELSE + +%right '?' ':' +%left OROR +%left ANDAND +%left ANDANDAND +%left '|' +%left '^' XNOR +%left '&' +%left LOGICAL_EQUALITY LOGICAL_INEQUALITY CASE_EQUALITY CASE_INEQUALITY +%left LT LE GT GE +%left LEFT_SHIFT RIGHT_SHIFT +%left '+' '-' +%left '*' '/' '%' +%left '(' '[' +%right '!' '~' +%right REDUCTION_NOR +%right REDUCTION_NAND +%right UNARY + +%token IDENTIFIER +%token HIERARCHY_IDENTIFIER +%token STARARROW +%token EQUALARROW +%token SPECPARAM +%token SETUP +%token HOLD +%token PERIOD +%token WIDTH +%token SKEW +%token RECOVERY +%token SETUPHOLD +%token NOCHANGE +%token MODULE +%token MACROMODULE +%token ENDMODULE +%token SPECIFY +%token ENDSPECIFY +%token PRIMITIVE +%token ENDPRIMITIVE +%token TABLE +%token ENDTABLE +%token TASK +%token ENDTASK +%token FUNCTION +%token ENDFUNCTION +%token PARAMETER +%token INPUT +%token OUTPUT +%token INOUT +%token NETTYPE +%token TRIREG +%token SCALARED +%token VECTORED +%token REG +%token TIME +%token INTEGER +%token REAL +%token EVENT +%token ASSIGN +%token DEFPARAM +%token STRENGTH0 STRENGTH1 SUPPLY0 SUPPLY1 +%token LOGIC +%token BUFFER +%token BUFIF +%token CMOS +%token PULL +%token TRAN +%token INITIAL +%token ALWAYS +%token IF +/*%left ELSE */ +%token CASE +%token CASEZ +%token CASEX +%token ENDCASE +%token FOREVER +%token REPEAT +%token WHILE +%token FOR +%token WAIT_ +%token ARROW_ +%token DISABLE +/*%token ASSIGN*/ +%token DEASSIGN +%token FORCE +%token RELEASE +%token DEFAULT +%token BEGIN +%token END +%token FORK +%token JOIN +%token SYSTEM_IDENTIFIER +%token STRING +%token NUMBER +%token BASE_NUMBER +%token POSEDGE +%token NEGEDGE +%left OR +%token SMALL +%token MEDIUM +%token LARGE +/* %token STOP_STMT */ +%token EDGE +%token DOUBLE_DIGIT +%token UDP_CHAR +%token UDP_ONE +%token UDP_ZERO +%token UDP_X +%token UDP_B +%token UDP_HOOK + + +%token EOF_ + +%type source_text +%type description_list +%type description +%type module +/* %type module_item_list */ +/* %type module_item */ +%type list_of_ports_o +%type port_clist +%type port +%type port_expression_o +%type port_reference_clist +%type port_reference +%type UDP +%type task +%type function function_type +%type tf_declaration_list +%type tf_declaration + +%type specify_stuff +%type specify_items +%type specify_item +%type specparam_declaration +%type path_declaration +%type path_description +%type path_delay_value +%type specify_input_terminal_descriptor +%type specify_output_terminal_descriptor +%type list_of_path_inputs +%type list_of_path_outputs +%type path_delay_expression +%type path_operator +%type polarity_operator +%type conditional_port_expression +%type data_source_expression +%type edge_identifier +%type specify_if_clause +%type timing_input_terminal_descriptor + +%type parameter_declaration +%type list_of_param_assignments +%type param_assignment +%type setspec setnetspec static_declaration port_declaration port_spec +%type port_decl_identifiers +%type reg_spec event_spec reg_decl_identifiers reg_decl_identifier +%type real_spec +%type non_reg_decl_identifiers +%type decl_identifiers + +%type net_declaration net_spec trireg_spec +%type nettype +%type expandrange_o +%type continuous_assign assign_spec list_of_assignments +%type cont_assignment +%type net_assignment list_of_net_assignments +%type parameter_override list_of_param_overrides +%type charge_strength_o +%type drive_strength drive_strength_o +%type strength0 strength1 +%type xrange +%type range +/* %type gate_declaration */ +/* %type gate_description */ +%type gatetype +%type gate_instance_clist +%type gate_instance +%type UDP_or_module_instantiation +%type xparameter_value_assignment constant_expression_clist +/* %type UDP_instance_clist */ +/* %type UDP_instance */ +/* %type xterminal_clist */ +%type terminal_clist +/*%type module_instantiation */ +%type module_instance_clist +%type module_instance +%type list_of_module_connections_o +%type module_port_connection_clist +%type module_port_connection +%type named_port_connection_clist +%type named_port_connection +%type system_timing_check +%type notify_clause +%type notify_register +%type timing_check_event +%type controlled_timing_check_event +%type timing_check_event_control +%type timing_check_event_control_no_empty +%type timing_check_condition +%type scalar_expression +%type scalar_constant + +%type specify_block + +%type initial_statement +%type always_statement +%type statement_or_null +%type statement +%type elsepart +%type case +/* %type delay_or_event_control */ +%type assignment +%type case_item_plist +%type case_expr +%type expression_clist xexpression_clist xexpression +%type seq_block +%type par_block +%type statement_list +%type statement_tree_list +%type block_declaration_list +%type block_declaration +%type task_enable +%type system_task_enable + +%type lvalue +%type lval_normal +%type lval_concat +%type lval_clist +%type conditional_expression +%type constant_expression +%type mintypmax_expression +%type mintypmax_expression_triplet +%type expression +%type primary +%type concatenation +%type function_call +%type identifier +%type IDENTIFIER_or_OR +%type delay_o +%type delay +%type mintypmax_clist +%type delay_control +%type event_control +%type event_expression +%type edge_list + +%type rp +%type sc + +%type UDP_declarations +%type UDP_declaration +%type UDP_reg_statement +%type UDP_initial_statement +%type UDP_table_definition +%type table_entry_list +%type table_entry +%type table_digit_list +%type table_digit +%type table_digit1 + +/* +%type interactive_command +%type execute_command +%type disable_command +%type continue +%type step_no_trace +%type step_trace +%type where +*/ + +%type error + +%% + +source_text + : statement { if (!is_interactive) + YYFAIL; +#if VDEBUG != 0 + if (vdebug) + printf_error_V ("interactive statement\n"); +#endif + interactive_statement = $1; + fix_lastchar(); + YYACCEPT;} + | description_list EOF_ + | error + { +#if VDEBUG != 0 +if (vdebug) + printf ("source error\n"); +#endif + if (is_interactive) + YYABORT; + } + | EOF_ { +#if VDEBUG != 0 +if (vdebug) + printf_error_V ("EOF\n"); +#endif + $$ = NULL; } + ; + +description_list + : description + | description_list description + { yyerrok; +#if VDEBUG != 0 +if (vdebug) + printf ("description_list\n"); +#endif + } +/* | error */ +/* | description_list error */ + ; + +description + : module + | UDP + ; + +module + : MODULE + { if (is_interactive) { + YYFAIL; + } + } + IDENTIFIER_or_OR + { + current_module = current_scope = build_module ($3); + push_scope (); + /* list of parse modules */ + module_list = tree_cons (current_module, NULL_TREE, module_list); + /* for now, assume all to be at lop level */ +// top_level = chainon (current_module, top_level); + } + list_of_ports_o sc + { MODULE_PORT_LIST (current_module) = nreverse ($5); } + module_item_list ENDMODULE + { + current_scope = pop_scope (); + BLOCK_BODY (current_module) = nreverse (BLOCK_BODY (current_module)); + BLOCK_DECL (current_module) = nreverse (BLOCK_DECL (current_module)); + end_module (current_module); + } + +/* | MACROMODULE IDENTIFIER list_of_ports_o sc module_item_list ENDMODULE */ + ; + +module_item_list + : /* empty */ + | module_item_list module_item + { yyerrok; } + | module_item_list error + ; + +list_of_ports_o + : '(' port_clist rp + { $$ = $2; } + | /* empty */ + { $$ = NULL; } + ; + +port_clist + : port + | port_clist ',' port + { yyerrok; + $$ = chainon ($3, $1); + } + | error +/* + | port_clist error + | port_clist error port + { yyerrok; } +*/ + | port_clist ',' error + ; + +port + : port_expression_o + { if ($1) + $$ = build_tree_list ($1, NULL_TREE); + else + $$ = NULL_TREE; + } + | '.' IDENTIFIER '(' port_expression_o rp + { $$ = build_tree_list ($4, $2); } + ; + +port_expression_o + : port_reference + | '{' port_reference_clist '}' + { $$ = $2; + sorry ("Port concatenations not supported in this version"); + } + | /* empty */ + { $$ = NULL_TREE; } + ; + +port_reference_clist + : port_reference + { $$ = build_tree_list ($1, NULL_TREE); } + | port_reference_clist ',' port_reference + { $$ = tree_cons ($3, NULL_TREE, $1); } + ; + +port_reference + : IDENTIFIER + { set_decl ($1, $1); } /* point to itself to mark as port */ + | IDENTIFIER '[' constant_expression ']' + { $$ = build_bit_ref ($1, $3); + set_decl ($1, $$); +// sorry ("Port bit-select not supported in this version"); + } + | IDENTIFIER '[' constant_expression ':' constant_expression ']' + { $$ = build_part_ref ($1, $3, $5); + set_decl ($1, $$); +// sorry ("Port part-selects not supported in this version"); + } + ; + +module_item + : parameter_declaration + | port_declaration + | net_declaration + | static_declaration + | gate_declaration + | UDP_or_module_instantiation +/* | UDP_instantiation */ +/* | module_instantiation */ + | parameter_override + | continuous_assign + | specify_block + | initial_statement + { BLOCK_BODY (current_module) = tree_cons ($1, + (tree)INITIAL_CODE, BLOCK_BODY (current_module)); + } + | always_statement + { BLOCK_BODY (current_module) = tree_cons ($1, + (tree)ALWAYS_CODE, BLOCK_BODY (current_module)); + } + | task + | function + ; +/* +UDP + : PRIMITIVE IDENTIFIER + { syn_warning ("primitive definition"); + sorry ("User-defined primitives not supported in this version"); + eat_block (ENDPRIMITIVE); + $$ = NULL; + } + ; +*/ + +UDP + : PRIMITIVE + { if (is_interactive) { + YYFAIL; + } + } + IDENTIFIER + { + current_module = current_scope = build_udp ($3); + push_scope (); + /* list of parse modules */ + module_list = tree_cons (current_module, NULL_TREE, module_list); + } + list_of_ports_o sc + { UDP_PORT_LIST (current_module) = nreverse ($5); } + UDP_declarations UDP_initial_statement UDP_table_definition ENDPRIMITIVE + { + current_scope = pop_scope (); + UDP_STRING_LIST (current_module) = nreverse (UDP_STRING_LIST (current_module)); + end_primitive (current_module); + } + ; +UDP_declarations + : /* empty */ + { $$ = NULL_TREE; } + | UDP_declarations UDP_declaration + { yyerrok; } + | UDP_declarations error + ; + +UDP_declaration + : port_declaration + | UDP_reg_statement + ; + +UDP_reg_statement + : REG IDENTIFIER sc + { + if( strcmp( IDENT($2), + IDENT(DECL_NAME(TREE_PURPOSE(MODULE_PORT_LIST(current_module)))) )!=0 ) { + error( "only the first declared port in a udp can be a reg", + NULL_CHAR, NULL_CHAR ); + } else { + UDP_REG_NAME(current_module) = $2; + } + $$ = NULL_TREE; + } + ; +UDP_initial_statement + : /* NULL */ + { $$ = NULL_TREE; } + | INITIAL IDENTIFIER '=' scalar_constant sc + { + if( UDP_REG_NAME(current_module)==NULL_TREE ) { + error( "initial statement is no allowed in combinatorial udp's", + NULL_CHAR, NULL_CHAR ); + } else if( strcmp(IDENT($2),IDENT(UDP_REG_NAME(current_module)))!=0 ) { + error( "initial statement does not reference port output", + NULL_CHAR, NULL_CHAR ); + } else { + UDP_INITIAL_VALUE(current_module) = $4; + } + $$ = NULL_TREE; + } + ; + + + +UDP_table_definition + : TABLE + { extern int enable_udp_parse; + enable_udp_parse = TRUE; + current_udp_string = NULL_TREE; + } + table_entry_list ENDTABLE + { + UDP_STRING_LIST(current_module) = $3; + $$ = NULL_TREE; + } + ; +table_entry_list + : table_entry + | table_entry_list table_entry + { + $$ = chainon ($2, $1); + } + ; +table_entry + : table_digit_list sc + { + validate_udp_string( current_module, current_udp_string ); + $$ = current_udp_string; + current_udp_string = NULL_TREE; + } + ; +table_digit_list + : /* NULL */ + { $$ = NULL; } + | table_digit_list table_digit + { $$ = NULL; } + ; +table_digit + : UDP_CHAR + { + append_udp_digits( ¤t_udp_string, $1, $1 ); + $$ = NULL; + } + | UDP_HOOK + { + append_udp_digits( ¤t_udp_string,'?','?' ); + $$ = NULL; + } + | UDP_ZERO + { + append_udp_digits( ¤t_udp_string,'0','0' ); + $$ = NULL; + } + | UDP_ONE + { + append_udp_digits( ¤t_udp_string,'1','1' ); + $$ = NULL; + } + | UDP_B + { + append_udp_digits( ¤t_udp_string,'b','b' ); + $$ = NULL; + } + | UDP_X + { + append_udp_digits( ¤t_udp_string,'x','x' ); + $$ = NULL; + } + | '(' table_digit1 table_digit1 rp + { + /* ? and b must be convert different but equivilent characters + otherwise edges cannot be distinguished from levels */ + + if( $2=='?' ) { + $2 = '!'; + } else if( $2=='b' ) { + $2 = '%'; + } + append_udp_digits( ¤t_udp_string,$2, $3 ); + $$ = NULL; + } + ; +table_digit1 + : UDP_X + | UDP_ZERO + | UDP_ONE + | UDP_B + | UDP_HOOK + ; + +task + : TASK IDENTIFIER sc + { syn_warning ("Task definition"); + tmp_tree = build_task (check_task ($2)); + make_block_decl ($3, current_scope, tmp_tree); + current_scope = tmp_tree; + BLOCK_DOWN (current_module) = chainon (current_scope, BLOCK_DOWN (current_module)); + BLOCK_UP (current_scope) = current_module; + push_scope (); + in_tf = 1; + } + tf_declaration_list statement_or_null ENDTASK + { BLOCK_BODY (current_scope) = $6; + in_tf = 0; + BLOCK_PORTS (current_scope) = nreverse (BLOCK_PORTS (current_scope)); + BLOCK_DECL (current_scope) = nreverse (BLOCK_DECL (current_scope)); + current_scope = pop_scope (); + } + ; + +function + : FUNCTION function_type IDENTIFIER sc + { current_scope = build_function (check_function ($3)); + make_block_decl ($3, current_module, current_scope); + push_scope (); /* funct name becomes var inside of funct */ + FUNCT_DECL (current_scope) = make_decl ($3, $2, NULL_TREE, NULL_TREE); + BLOCK_DOWN (current_module) = chainon (current_scope, BLOCK_DOWN (current_module)); + BLOCK_UP (current_scope) = current_module; + in_tf = in_function = 1; + } + tf_declaration_list statement_or_null ENDFUNCTION + { BLOCK_BODY (current_scope) = $7; + in_tf = in_function = 0; + BLOCK_PORTS (current_scope) = nreverse (BLOCK_PORTS (current_scope)); + BLOCK_DECL (current_scope) = nreverse (BLOCK_DECL (current_scope)); + current_scope = pop_scope (); + } + ; + +function_type + : /* empty */ + { $$ = make_reg_spec (NULL_TREE); } + | range + { $$ = make_reg_spec ($1); } + | INTEGER + { $$ = make_integer_spec (NULL_TREE); } + | REAL + { $$ = make_real_spec (NULL_TREE); } + ; + +tf_declaration_list + : /* empty */ + {} + | tf_declaration_list tf_declaration + ; + +tf_declaration + : parameter_declaration + | port_declaration + | static_declaration + ; + +/* +A.2 Declarations +*/ + +parameter_declaration + : PARAMETER xrange + { current_spec = make_param_spec ($2); } + list_of_param_assignments sc + { BLOCK_DECL (current_scope) = + chainon ($4, BLOCK_DECL (current_scope)); + } + ; + +list_of_param_assignments + : param_assignment + | list_of_param_assignments ',' param_assignment + { yyerrok; + $$ = chainon ($3, $1); + } + | error + | list_of_param_assignments error param_assignment + { yyerrok; } + | list_of_param_assignments ',' error + ; + +param_assignment + : IDENTIFIER '=' constant_expression + { $$ = make_param_decl (check_non_reg ($1), current_spec, $3); + } + | IDENTIFIER '=' mintypmax_expression_triplet + { $$ = make_param_decl (check_non_reg ($1), current_spec, $3); + } + ; + +setspec + : /* empty */ + {} + ; + +static_declaration + : reg_spec setspec reg_decl_identifiers sc + { BLOCK_DECL (current_scope) = + chainon ($3, BLOCK_DECL (current_scope)); } + | event_spec setspec non_reg_decl_identifiers sc + { BLOCK_DECL (current_scope) = + chainon ($3, BLOCK_DECL (current_scope)); } + | real_spec setspec decl_identifiers sc + { BLOCK_DECL (current_scope) = + chainon ($3, BLOCK_DECL (current_scope)); } + ; + +/* Used for ports and arguments to tasks and functions. */ +port_declaration + : port_spec setspec port_decl_identifiers sc + { BLOCK_PORTS (current_scope) = + chainon ($3, BLOCK_PORTS (current_scope)); } + ; + +/* If inside a module, ports are nets by default, so make them so. Inside + of a task or function, ports are REGs. */ +port_spec + : INPUT xrange + { if (in_tf) + $$ = current_spec = make_reg_spec ($2); + else + $$ = current_spec = make_net_spec (default_net_type, $2, NULL_TREE); + PORT_INPUT_ATTR ($$) = 1; + } + | OUTPUT xrange + { function_error; + if (in_tf) + $$ = current_spec = make_reg_spec ($2); + else + $$ = current_spec = make_net_spec (default_net_type, $2, NULL_TREE); + PORT_OUTPUT_ATTR ($$) = 1; + } + | INOUT xrange + { function_error; + if (in_tf) + $$ = current_spec = make_reg_spec ($2); + else + $$ = current_spec = make_net_spec (default_net_type, $2, NULL_TREE); + PORT_INPUT_ATTR ($$) = 1; + PORT_OUTPUT_ATTR ($$) = 1; + } + ; + +port_decl_identifiers + : IDENTIFIER + { $$ = make_decl (check_port ($1), current_spec, NULL_TREE, NULL_TREE); } + | port_decl_identifiers ',' IDENTIFIER + { yyerrok; + $$ = chainon (make_decl (check_port ($3), current_spec, NULL_TREE, NULL_TREE), $1); + } + | error + | port_decl_identifiers error + | port_decl_identifiers error IDENTIFIER + { yyerrok; } + | port_decl_identifiers ',' error + ; + +reg_spec + : REG xrange + { current_spec = make_reg_spec ($2); } + | INTEGER xrange + { if (!$2) + syn_warning ("Integer Range"); + current_spec = make_integer_spec ($2); + } + | TIME xrange + { syn_warning ("TIME"); + current_spec = make_time_spec ($2); + } + ; + +real_spec + : REAL + { current_spec = make_real_spec (NULL_TREE); } + ; + +event_spec + : EVENT + { syn_warning ("EVENT"); + current_spec = make_event_spec (); } + ; + +setnetspec + : /* empty */ + { lval_type = LVAL_NEW_NET; } + ; + +net_declaration + : net_spec setnetspec decl_identifiers sc + { BLOCK_DECL (current_scope) = + chainon ($3, BLOCK_DECL (current_scope)); + lval_type = LVAL_REG; + current_delay = NULL_TREE; + } + | trireg_spec setspec decl_identifiers sc + | net_spec setnetspec list_of_net_assignments sc + { lval_type = LVAL_REG; + MODULE_ASSIGNMENTS (current_module) = + chainon ($3, MODULE_ASSIGNMENTS (current_module)); + current_delay = NULL_TREE; + } + ; + +net_spec + : nettype expandrange_o delay_o + { $$ = current_spec = make_net_spec ($1, $2, $3); + current_delay = $3; + } + ; + +trireg_spec + : TRIREG + { syn_warning ("TRIREG net"); + sorry ("TRIREG net type is not supported in this version"); + } + charge_strength_o expandrange_o delay_o + { $$ = error_mark_node; } + ; + +nettype + : NETTYPE + | SUPPLY0 + { syn_warning ("SUPPLY0 net"); } + | SUPPLY1 + { syn_warning ("SUPPLY1 net"); } + ; + +/* +NETTYPE is one of the following keywords + wire tri tri1 supply0 + wand triand tri0 supply1 + wor trior trireg +*/ + +expandrange_o + : range + | SCALARED range + { sorry ("SCALARED keyword not supported; all nets treated as vectored"); + NET_SCALARED_ATTR ($2) = 1; + $$ = $2; + } + | VECTORED range + { sorry ("VECTORED keyword is not supported; all nets treated as vectored"); + NET_VECTORED_ATTR ($2) = 1; + $$ = $2; + } + | /* empty */ + { $$ = NULL_TREE; } + ; + +continuous_assign + : assign_spec setspec + { lval_type = LVAL_NET; } + list_of_assignments sc + { lval_type = LVAL_REG; + MODULE_ASSIGNMENTS (current_module) = + chainon ($4, MODULE_ASSIGNMENTS (current_module)); + } + ; + +assign_spec + : ASSIGN drive_strength_o delay_o + { current_delay = $3; /* strength not supported */ + $$ = NULL; + } + ; + +list_of_net_assignments + : net_assignment + { $$ = build_tree_list ($1, NULL_TREE); } + | list_of_net_assignments ',' net_assignment + { yyerrok; + $$ = tree_cons ($3, NULL_TREE, $1); + } + | error + | list_of_net_assignments error + | list_of_net_assignments error net_assignment + { yyerrok; } + | list_of_net_assignments ',' error + ; + +net_assignment + : IDENTIFIER '=' { $$ = stmt_lineno; } + expression + { $$ = build_cont_assign ( + check_lval ($1, lval_type, current_spec), + $4, $3, current_delay, current_delay!=0); + } + + ; + +list_of_assignments + : cont_assignment + { $$ = build_tree_list ($1, NULL_TREE); } + | list_of_assignments ',' cont_assignment + { yyerrok; + $$ = tree_cons ($3, NULL_TREE, $1); + } + | error + | list_of_assignments error + | list_of_assignments error cont_assignment + { yyerrok; } + | list_of_assignments ',' error + ; + +cont_assignment + : lvalue '=' { $$ = stmt_lineno; } + expression + { $$ = build_cont_assign ($1, $4, $3, current_delay, + current_delay!=0); } + ; +parameter_override + : DEFPARAM list_of_param_overrides sc + { syn_warning ("DEFPARAM"); } + ; + +list_of_param_overrides + : identifier '=' constant_expression + { MODULE_DEFPARAMS (current_module) = chainon ( + build_stmt (ASSIGN_STMT, stmt_lineno, $1, $3), + MODULE_DEFPARAMS (current_module)); + } + | list_of_param_overrides ',' identifier '=' constant_expression + { + MODULE_DEFPARAMS (current_module) = chainon ( + build_stmt (ASSIGN_STMT, stmt_lineno, $3, $5), + MODULE_DEFPARAMS (current_module)); + } + ; + +reg_decl_identifiers + : reg_decl_identifier + | reg_decl_identifiers ',' reg_decl_identifier + { yyerrok; + $$ = chainon ($3, $1); + } + | error + | reg_decl_identifiers error + | reg_decl_identifiers error reg_decl_identifier + { yyerrok; } + | reg_decl_identifiers ',' error + ; + +reg_decl_identifier + : IDENTIFIER + { $$ = make_decl (check_reg ($1), current_spec, NULL_TREE, NULL_TREE); } + | IDENTIFIER '[' constant_expression ':' constant_expression ']' + { $$ = make_decl (check_reg ($1), current_spec, $3, $5); + syn_warning ("REG/INTEGER arrays"); + } + ; + +non_reg_decl_identifiers + : IDENTIFIER + { $$ = make_decl (check_non_reg ($1), current_spec, NULL_TREE, NULL_TREE); } + | non_reg_decl_identifiers ',' IDENTIFIER + { $$ = chainon (make_decl (check_non_reg ($3), current_spec, NULL_TREE, NULL_TREE), $1); } + ; + +decl_identifiers + : IDENTIFIER + { $$ = make_decl (check_net ($1), current_spec, NULL_TREE, NULL_TREE); } + | decl_identifiers ',' IDENTIFIER + { $$ = chainon (make_decl (check_net ($3), current_spec, NULL_TREE, NULL_TREE), $1); } + ; + +charge_strength_o + : /* empty */ + { $$ = NULL; } + | '(' SMALL rp + { $$ = NULL; } + | '(' MEDIUM rp + { $$ = NULL; } + | '(' LARGE rp + { $$ = NULL; } + ; + +drive_strength_o + : /* empty */ + {} + | drive_strength + { +warning ("Strength specification is not supported and is ignored", NULL_CHAR, NULL_CHAR); + } + + ; + +drive_strength + : '(' strength0 ',' strength1 rp + { $$ = NULL; } + | '(' strength1 ',' strength0 rp + { $$ = NULL; } + ; + +strength0 + : STRENGTH0 + | SUPPLY0 /* Should be part of STRENGTH0, but used as keyword elsewhere */ + ; + +strength1 + : STRENGTH1 + | SUPPLY1 /* Should be part of STRENGTH0, but used as keyword elsewhere */ + ; + +/* +STRENGTH0 is one of the following keywords: + supply0 strong0 pull0 weak0 highz0 + +STRENGTH1 is one of the following keywords: + supply1 strong1 pull1 weak1 highz1 + +*/ + +xrange + : /* empty */ + { $$ = NULL_TREE;} + | range + ; + +range + : '[' constant_expression ':' constant_expression rb + { TREE_OPERAND (range_handle, 0) = $2; + TREE_OPERAND (range_handle, 1) = $4; + $$ = range_handle; + } +/* | '[' constant_expression ':' constant_expression error + { TREE_OPERAND (range_handle, 0) = $2; + TREE_OPERAND (range_handle, 1) = $4; + $$ = range_handle; + } */ + ; + +/* +A.3 Primitive instances +*/ +gate_declaration + : gatetype + { current_gatetype = $1; + in_instantiation = 1; + } + gate_description + { in_instantiation = 0; } + ; + +/* The keywords have been removed (except OR) while gate support is + done externally. Reenable them when gate support is brought in. */ +gatetype + : LOGIC + /* is a LOGIC but is also a keyword for event expressions */ + | OR + { $$ = GATE_OR_TYPE; } + | BUFFER + { syn_warning ("Buffer gate"); } + | BUFIF + { syn_warning ("Bufif gate"); } + | CMOS + { syn_warning ("CMOS gate"); } + | PULL + { syn_warning ("PULL gate"); } + | TRAN + { syn_warning ("TRAN gate"); } + ; +/* +GATETYPE is one of the following keywords + and buf nmos pullup tran + nand not pmos pulldown tranif0 + nor bufif0 cmos tranif1 + or bufif1 rnmos rtran + xor notif0 rpmos rtranif0 + xnor notif1 rcmos rtranif1 +*/ + +gate_description + : { current_delay = NULL_TREE; } + gate_instance_clist sc +/* | drive_strength delay_o + { current_delay = $2; } + gate_instance_clist sc */ + | delay + { current_delay = $1; } + gate_instance_clist sc + ; + +gate_instance_clist + : gate_instance + | gate_instance_clist ',' gate_instance + ; + +gate_instance + : IDENTIFIER '(' terminal_clist rp + { $$ = build_gate_instance (current_gatetype, input_filename, lineno, + $1, nreverse ($3), current_delay, NULL_TREE); + MODULE_INSTANCES (current_module) = chainon ($$, + MODULE_INSTANCES (current_module)); + } + | '(' terminal_clist rp + { $$ = build_gate_instance (current_gatetype, input_filename, lineno, + NULL_TREE, nreverse ($2), current_delay, NULL_TREE); + MODULE_INSTANCES (current_module) = chainon ($$, + MODULE_INSTANCES (current_module)); + } + ; + + + +UDP_or_module_instantiation + : IDENTIFIER /* drive_strength_o */ xparameter_value_assignment + { current_instance_module = $1; + current_instance_param = $2; + in_instantiation = 1; + } + module_instance_clist sc + { current_instance_module = NULL_TREE; + current_instance_param = NULL_TREE; + in_instantiation = 0; + } + + /* OR is a keyword, treat it seperately */ +/* | OR xparameter_value_assignment + { current_instance_module = get_identifier ("or"); + current_instance_param = $2; + } + module_instance_clist sc + { current_instance_module = NULL_TREE; + current_instance_param = NULL_TREE; + } +*/ +/* | IDENTIFIER drive_strength_o delay_o UDP_instance_clist sc */ + ; +/* : IDENTIFIER UDP_instance_clist sc + { drive[0] = drive[1] = 0; + $$ = 0; + } + | IDENTIFIER delay UDP_instance_clist sc + { drive[0] = drive[1] = 0; + $$ = 0; + } + : IDENTIFIER drive_strength_o delay_o UDP_instance_clist sc + { $$ = 0; } + ; */ + +xparameter_value_assignment + : /* empty */ + { $$ = NULL; } + | '#' constant_expression + { $$ = build_tree_list ($2, NULL_TREE); } + | '#' '(' constant_expression_clist ')' + { $$ = nreverse ($3); } + | '#' '(' mintypmax_expression ')' + { $$ = build_tree_list ($3, NULL_TREE); } + | '#' '(' mintypmax_expression ',' mintypmax_expression')' + { $$ = build_tree_list ($5, NULL_TREE); + $$ = tree_cons ($3, NULL_TREE, $$); + } + | '#' '(' mintypmax_expression ',' mintypmax_expression ',' mintypmax_expression ')' + { $$ = build_tree_list ($7, NULL_TREE); + $$ = tree_cons ($5, NULL_TREE, $$); + $$ = tree_cons ($3, NULL_TREE, $$); + } + ; + +constant_expression_clist + : constant_expression + { $$ = build_tree_list ($1, NULL_TREE); } + | constant_expression_clist ',' constant_expression + { $$ = tree_cons ($3, NULL_TREE, $1); } + ; + +/* +UDP_instance_clist + : UDP_instance + | UDP_instance_clist ',' UDP_instance + ; +*/ + +/* UDP_instance + : IDENTIFIER '(' xterminal_clist rp + | '(' terminal_clist rp + { $$ = $2; } + ; +*/ + +/* +xterminal_clist + : + { $$ = NULL_TREE; } + | terminal_clist + ; +*/ + +terminal_clist + : expression + { $$ = build_tree_list ($1, NULL_TREE); } + | terminal_clist ',' expression + { $$ = tree_cons ($3, NULL_TREE, $1); yyerrok; } + + | error + | terminal_clist error + | terminal_clist error expression + { yyerrok; } + | terminal_clist ',' error + ; + +/* +module_instantiation + : name_of_module module_instance_clist sc + ; +*/ + +module_instance_clist + : module_instance + | module_instance_clist ',' module_instance + { yyerrok; } + | error + | module_instance_clist error + | module_instance_clist error module_instance + { yyerrok; } + | module_instance_clist ',' error + ; + +module_instance + : IDENTIFIER '(' list_of_module_connections_o rp + { $$ = build_stmt (INSTANCE_NODE, lineno, check_non_reg ($1), + current_instance_module, + nreverse ($3), current_instance_param); + MODULE_INSTANCES (current_module) = chainon ($$, + MODULE_INSTANCES (current_module)); + // make_block_decl ($1, current_module, NULL_TREE); + } + | '(' list_of_module_connections_o rp + { $$ = build_stmt (INSTANCE_NODE, lineno, NULL_TREE, + current_instance_module, + nreverse ($2), current_instance_param); + MODULE_INSTANCES (current_module) = chainon ($$, + MODULE_INSTANCES (current_module)); + } + ; + +list_of_module_connections_o + : module_port_connection_clist + | named_port_connection_clist + ; + +module_port_connection_clist + : module_port_connection + | module_port_connection_clist ',' module_port_connection + { yyerrok; + $$ = chainon ($3, $1); + } + | error + | module_port_connection_clist ',' error + ; + +module_port_connection + : expression + { $$ = build_tree_list ($1, NULL_TREE); } + | /* empty */ + { $$ = build_tree_list (NULL_TREE, NULL_TREE); } + ; + +named_port_connection_clist + : named_port_connection + | named_port_connection_clist ',' named_port_connection + { $$ = chainon ($3, $1); } + ; + +named_port_connection + : '.' IDENTIFIER '(' expression rp + { $$ = build_tree_list ($4, $2); } + + | '.' IDENTIFIER '(' rp { $$ = NULL; } + ; +/* +A.5 Behavioral Statements +*/ + +initial_statement + : INITIAL + { $$ = stmt_lineno; + syn_warning ("INITIAL"); } + statement + { $$ = build_stmt (INITIAL_BLOCK, $2, $3); } + ; + +always_statement + : ALWAYS { $$ = stmt_lineno; } + statement + { $$ = build_stmt (ALWAYS_BLOCK, $2, $3); } + ; + +statement_or_null + : statement + | sc + { $$ = build_stmt (NULL_STMT, lineno); } + ; + +statement + : assignment sc +/* | STOP_STMT sc */ + + | IF { $$ = stmt_lineno; } + '(' expression rp statement_or_null elsepart + { $$ = build_stmt (IF_STMT, $2, $4, $6, $7); } + + | { $$ = current_case; } + case + { current_case = $2; } + '(' expression rp case_item_plist ENDCASE + { STMT_CASE_EXPR ($2) = $5; + STMT_CASE_LIST ($2) = nreverse ($7); + current_case = $1; + $$ = $2; + } + + | FOREVER + { $$ = stmt_lineno; + syn_warning ("FOREVER"); } + statement + { $$ = build_stmt (FOREVER_STMT, $2, $3); } + + | REPEAT + { $$ = stmt_lineno; + syn_warning ("REPEAT"); } + '(' expression rp statement + { $$ = build_stmt (REPEAT_INIT_STMT, $2, $6, $4); + tmp_tree = build_stmt (REPEAT_STMT, $2, $$, $4); + chainon ($6, tmp_tree); + } + + | WHILE + { $$ = stmt_lineno; + syn_warning ("WHILE"); } + '(' expression rp statement + { $$ = build_stmt (WHILE_STMT, $2, $6, $4); } + + | FOR { $$ = stmt_lineno; } + '(' assignment sc expression sc assignment rp statement + { stmt_lineno = $2; + tmp_tree = build_stmt (FOR_STMT, $2, $10, $8, $6); + STMT_SURROGATE_ATTR (tmp_tree) = 1; + $$ = build_stmt (FOR_STMT, $2, $10, $4, $6); + TREE_CHAIN (tmp_tree) = $$; /* Fix this in pass 3 */ + chainon ($10, tmp_tree); /* at end of statement sequence */ + } + + | delay_control + { $$ = stmt_lineno; + syn_warning ("delay control"); + function_error; + } + statement_or_null + { $$ = build_stmt (DELAY_STMT, $2, $3, $1); } + + | event_control + { stmt_lineno = lineno; + function_error; + } + statement_or_null + { STMT_BODY ($1) = $3; + $$ = $1; + } + + | lvalue '=' + { $$ = stmt_lineno; + function_error; + } + delay_control expression sc + { $$ = build_stmt (ASSIGN_DELAY_STMT, $3, $1, + implicit_conversion ($1, $5), + NULL_TREE, NULL_TREE, + build_stmt (DELAY_STMT, $3, $1, $4)); + } + + | lvalue '=' + { $$ = stmt_lineno; + function_error; + } + event_control expression sc + { $$ = build_stmt (ASSIGN_EVENT_STMT, $3, $1, + implicit_conversion ($1, $5), + NULL_TREE, NULL_TREE, $4); + } + + | lvalue LE + { $$ = stmt_lineno; + function_error; + } + expression sc + { $$ = build_stmt (ASSIGN_NONBLK_DELAY_STMT, $3, $1, + implicit_conversion ($1, $4), + NULL_TREE, NULL_TREE, + build_stmt (DELAY_STMT, $3, $1, integer_zero_node)); + } + + | lvalue LE + { $$ = stmt_lineno; + function_error; + } + delay_control expression sc + { $$ = build_stmt (ASSIGN_NONBLK_DELAY_STMT, $3, $1, + implicit_conversion ($1, $5), + NULL_TREE, NULL_TREE, + build_stmt (DELAY_STMT, $3, $1, $4)); + } + + | lvalue LE + { $$ = stmt_lineno; + function_error; + } + event_control expression sc + { $$ = build_stmt (ASSIGN_NONBLK_EVENT_STMT, $3, $1, + implicit_conversion ($1, $5), + NULL_TREE, NULL_TREE, $4); + } + +/* | lvalue LE delay_control expression sc + { $$ = build_stmt (ASSIGN_NOBLOCK_STMT, $1, $4, $3); } + + | lvalue LE event_control expression sc + { $$ = build_stmt (ASSIGN_NOBLOCK_STMT, $1, $4, $3); } +*/ + | WAIT_ + { $$ = stmt_lineno; + syn_warning ("WAIT"); + function_error; + } + '(' conditional_expression rp statement_or_null + { $$ = build_stmt (WAIT_STMT, $2, $6, $4); } + + | ARROW_ + { $$ = stmt_lineno; + syn_warning ("Event trigger"); + function_error; + } + identifier sc + { $$= build_stmt (ARROW_STMT, $2, check_named_event ($3)); } + + | seq_block + | par_block + | task_enable + | system_task_enable + | DISABLE { $$ = stmt_lineno; } + identifier sc + { $$ = build_stmt (DISABLE_STMT, $2, $3); + HIERARCHICAL_ATTR ($$) = HIERARCHICAL_ATTR ($3); + } + + | ASSIGN + { $$ = stmt_lineno; } + lvalue '=' expression sc + { $$ = build_stmt (ASSIGN_PROC_STMT, $2, $3, $5, NULL_TREE, + NULL_TREE); } + + | DEASSIGN + { $$ = stmt_lineno; } + lvalue sc + { $$ = build_stmt (DEASSIGN_STMT, $2, $3); } + + | FORCE { $$ = stmt_lineno; + lval_type = LVAL_REG_NET; } + lvalue '=' expression sc + { syn_warning ("FORCE"); + $$ = build_stmt (FORCE_STMT, $2, $3, $5, NULL_TREE, + NULL_TREE, NULL_TREE, NULL_TREE); + lval_type = LVAL_REG; + } + + | RELEASE { $$ = stmt_lineno; + lval_type = LVAL_REG_NET; } + lvalue sc + { syn_warning ("RELEASE"); + $$ = build_stmt (RELEASE_STMT, $2, $3); + lval_type = LVAL_REG; + } + + /* | error sc { printf("error sc \n"); } */ + ; + +elsepart + : /* empty */ %prec IF + { $$ = NULL; } + | ELSE statement_or_null + { $$ = $2; } + ; + +case + : CASE + { $$ = build_stmt (CASE_STMT, stmt_lineno, NULL_TREE, NULL_TREE, NULL_TREE); } + | CASEZ + { $$ = build_stmt (CASEZ_STMT, stmt_lineno, NULL_TREE, NULL_TREE, NULL_TREE); } + | CASEX + { $$ = build_stmt (CASEX_STMT, stmt_lineno, NULL_TREE, NULL_TREE, NULL_TREE); } + ; + +/* +delay_or_event_control + : delay_control + | event_control + ; +*/ + +assignment + : lvalue '=' { $$ = stmt_lineno; } + expression + { $$ = build_stmt (ASSIGN_STMT, $3, $1, + implicit_conversion ($1, $4)); } + ; + +case_item_plist + : case_expr + | case_item_plist case_expr + { yyerrok; + $$ = chainon ($2, $1); + } + | error + | case_item_plist error + ; + +case_expr + : expression_clist ':' statement_or_null + { $$ = build_tree_list ($1, $3); } + + | DEFAULT ':' statement_or_null + { if (STMT_CASE_DEFAULT (current_case)) + error ("More than one 'DEFAULT' within CASE", NULL_CHAR, NULL_CHAR); + STMT_CASE_DEFAULT (current_case) = $3; + } + | DEFAULT statement_or_null + { if (STMT_CASE_DEFAULT (current_case)) + error ("More than one 'DEFAULT' within CASE", NULL_CHAR, NULL_CHAR); + STMT_CASE_DEFAULT (current_case) = $2; + } + ; + +expression_clist + : expression + { $$ = build_tree_list ($1, NULL_TREE); } + | expression_clist ',' expression + { $$ = tree_cons ($3, NULL_TREE, $1); } + | error + | expression_clist ',' error + ; + +xexpression_clist + : xexpression + { if( $1 != NULL_TREE ) { + $$ = build_tree_list ($1, NULL_TREE); + } else { + $$ = $1; + } + } + | xexpression_clist ',' xexpression + { $$ = tree_cons ($3, NULL_TREE, $1); } +/* | error +* | xexpression_clist error +* | xexpression_clist error xexpression +* | xexpression_clist ',' error */ + ; + +xexpression + : /* empty */ + { $$ = NULL_TREE; } + | expression + ; + +seq_block + : BEGIN + { $$ = build_stmt (BEGIN_STMT, stmt_lineno); } + statement_list END + { STMT_BODY ($2) = nreverse + (chainon (build_stmt (END_STMT, stmt_lineno), $3)); + $$ = $2; + } + | BEGIN ':' IDENTIFIER + { tmp_tree = make_node (NAMED_BLOCK); + BLOCK_DOWN (current_scope) = chainon (tmp_tree, BLOCK_DOWN (current_scope)); + BLOCK_UP (tmp_tree) = current_scope; + BLOCK_NAME (tmp_tree) = $3; + BLOCK_BODY (tmp_tree) = NULL_TREE; + BLOCK_CONTEXT_LIST (tmp_tree) = NULL; + make_block_decl (check_block ($3), current_scope, tmp_tree); + current_scope = tmp_tree; + push_scope (); + $$ = build_stmt (BEGIN_NAMED_STMT, stmt_lineno, + NULL_TREE, tmp_tree); + } + block_declaration_list statement_list END + { tmp_tree = build_stmt (END_NAMED_STMT, stmt_lineno, + NULL_TREE, STMT_BLOCK ($4)); + /* STMT_BEGIN_NAMED_END ($4) = tmp_tree; */ + STMT_BODY ($4) = nreverse (chainon (tmp_tree, $6)); + current_scope = pop_scope (); + $$ = $4; + } + ; + +par_block + : FORK + { $$ = build_stmt (FORK_STMT, stmt_lineno); } + statement_tree_list JOIN + { STMT_BODY ($2) = chainon /* thread JOIN to BEGINNING */ + (build_stmt (JOIN_STMT, stmt_lineno, NULL_TREE), + nreverse ($3)); + $$ = $2; + } + | FORK ':' IDENTIFIER + { tmp_tree = make_node (NAMED_BLOCK); + BLOCK_DOWN (current_scope) = chainon (tmp_tree, BLOCK_DOWN (current_scope)); + BLOCK_UP (tmp_tree) = current_scope; + BLOCK_NAME (tmp_tree) = $3; + BLOCK_BODY (tmp_tree) = NULL_TREE; + make_block_decl (check_block ($3), current_scope, tmp_tree); + current_scope = tmp_tree; + push_scope (); + $$ = build_stmt (FORK_NAMED_STMT, stmt_lineno, + NULL_TREE, tmp_tree); + } + block_declaration_list statement_tree_list JOIN + { tmp_tree = build_stmt (JOIN_NAMED_STMT, stmt_lineno, + NULL_TREE, STMT_BLOCK ($4)); + /* STMT_BEGIN_NAMED_END ($4) = tmp_tree; */ + STMT_BODY ($4) = chainon (tmp_tree, nreverse ($6)); + current_scope = pop_scope (); + $$ = $4; + } + ; + +statement_list + : /* empty */ + { $$ = NULL; } + | statement_list statement + { yyerrok; + $$ = chainon ($2, $1); + } + | statement_list error + ; + +statement_tree_list + : /* empty */ + { $$ = NULL; } + | statement_tree_list statement + { yyerrok; + $$ = tree_cons ($2, NULL_TREE, $1); + } + | statement_tree_list error + ; + +block_declaration_list + : /* empty */ + { $$ = NULL; } + | block_declaration_list block_declaration + ; + +block_declaration + : parameter_declaration + | static_declaration + ; + +task_enable + : identifier sc + { syn_warning ("task enable"); + function_error; + $$ = build_stmt (TASK_STMT, lineno, IDENTIFIER_POINTER ($1), NULL_TREE); + HIERARCHICAL_ATTR ($$) = HIERARCHICAL_ATTR ($1); + } + | identifier '(' expression_clist rp sc + { syn_warning ("task enable"); + $$ = build_stmt (TASK_STMT, lineno, IDENTIFIER_POINTER ($1), nreverse ($3)); + HIERARCHICAL_ATTR ($$) = HIERARCHICAL_ATTR ($1); + } + ; + +system_task_enable + : SYSTEM_IDENTIFIER sc + { $$ = build_stmt (SYSTASK_STMT, lineno, IDENTIFIER_POINTER ($1), NULL_TREE); } + | SYSTEM_IDENTIFIER + { in_systask = 1; } + '(' xexpression_clist rp sc + { $$ = build_stmt (SYSTASK_STMT, lineno, IDENTIFIER_POINTER ($1), nreverse ($4)); + in_systask = 0; + } + ; + +lvalue + : lval_normal + { stmt_lineno = lineno; } + | lval_concat + { stmt_lineno = lineno; } + ; + +lval_normal + : identifier + { $$ = check_lval ($1, lval_type, current_spec); } + | identifier '[' expression ']' + { $$ = build_bit_ref ( + check_lval_nocheck ($1, lval_type, current_spec), $3); } + | identifier '[' expression ':' expression ']' + { $$ = build_part_ref ( + check_lval_nocheck ($1, lval_type, current_spec), $3, $5); } + ; + +/* +A.6 Specify Section +*/ + +specify_block + : SPECIFY + { + } + specify_stuff + {} + ; + +/* If specify blocks are disabled, The rest will be eaten by the parser */ +specify_stuff + : specify_items ENDSPECIFY + {} + ; + +specify_items + : /* empty */ + { $$ = NULL; } + | specify_items specify_item + { yyerrok; + $$ = NULL; + // $$ = chainon ($2, $1); + } + | specify_items error + ; +specify_item + : specparam_declaration + | path_declaration + | system_timing_check + { + if( $1!=NULL_TREE ) { + STMT_SOURCE_LINE($1) = stmt_lineno; + STMT_SOURCE_FILE($1) = input_filename; + MODULE_SPECDEFS(current_module) = + chainon(MODULE_SPECDEFS(current_module),$1); + } + } +/* + These are implemented using the path_declaration + + | level_sensitive_path_declaration + | edge_sensitive_path_declaration + | sdpd +*/ + ; +specparam_declaration + : SPECPARAM + { current_spec = make_param_spec (NULL_TREE); } + list_of_param_assignments sc + { + specify_save_param_list( current_module, $3 ); + } + ; + +path_declaration + : specify_if_clause path_description '=' path_delay_value sc + { + PATH_CONDITION($2) = $1; + PATH_DELAYS($2) = $4; + MODULE_SPECDEFS(current_module) = + chainon(MODULE_SPECDEFS(current_module),check_path($2)); + } + ; +path_description + /* all types of path descriptors are bundled together - its was the + only way I could get bision to parse correctly */ + : '(' + list_of_path_inputs path_operator '(' + list_of_path_outputs ':' + data_source_expression rp rp + { + $$ = build_path( nreverse($2), nreverse($5), $7, NULL_TREE, NULL_TREE, + $3, 0, 0 ); + } + | '(' edge_identifier + list_of_path_inputs path_operator '(' + list_of_path_outputs ':' + data_source_expression rp rp + { + $$ = build_path( nreverse($3), nreverse($6), $8, NULL_TREE, NULL_TREE, + $4, $2, 0 ); + } + | '(' + list_of_path_inputs path_operator '(' + list_of_path_outputs polarity_operator ':' + data_source_expression rp rp + { + $$ = build_path( nreverse($2), nreverse($5), $8, NULL_TREE, NULL_TREE, + $3, 0, $6 ); + } + | '(' edge_identifier + list_of_path_inputs path_operator '(' + list_of_path_outputs polarity_operator ':' + data_source_expression rp rp + { + $$ = build_path( nreverse($3), nreverse($6), $9, NULL_TREE, NULL_TREE, + $4, $2, $7 ); + } + | '(' list_of_path_inputs path_operator + list_of_path_outputs rp + { + $$ = build_path( nreverse($2), nreverse($4), NULL_TREE, NULL_TREE, NULL_TREE, + $3, 0, 0 ); + } + | '(' list_of_path_inputs polarity_operator path_operator + list_of_path_outputs rp + { + $$ = build_path( nreverse($2), nreverse($5), NULL_TREE, NULL_TREE, NULL_TREE, + $4, 0, $3 ); + } + ; +list_of_path_inputs + : specify_input_terminal_descriptor + | list_of_path_inputs ','specify_input_terminal_descriptor + { yyerrok; + $$ = chainon ($3, $1); + } + | error + | list_of_path_inputs error specify_input_terminal_descriptor + { yyerrok; } + | list_of_path_inputs ',' error + ; +list_of_path_outputs + : specify_output_terminal_descriptor + | list_of_path_outputs ','specify_output_terminal_descriptor + { yyerrok; + $$ = chainon ($3, $1); + } + | error + | list_of_path_outputs error specify_output_terminal_descriptor + { yyerrok; } + | list_of_path_outputs ',' error + ; +specify_input_terminal_descriptor + : IDENTIFIER + { + $$ = build_tree_list( check_input_port($1), NULL_TREE ); + } + | IDENTIFIER '[' constant_expression rb + { + $$ = build_tree_list( build_bit_ref (check_input_port($1), $3), NULL_TREE ); + } + | IDENTIFIER '[' constant_expression ':' constant_expression rb + { + $$ = build_tree_list( build_part_ref (check_input_port($1), $3, $5), NULL_TREE ); + } + ; +specify_output_terminal_descriptor + : IDENTIFIER + { + $$ = build_tree_list( check_output_port($1), NULL_TREE ); + } + | IDENTIFIER '[' constant_expression rb + { + $$ = build_tree_list( build_bit_ref (check_output_port($1), $3), NULL_TREE ); + } + | IDENTIFIER '[' constant_expression ':' constant_expression rb + { + $$ = build_tree_list( build_part_ref (check_output_port($1), $3, $5), NULL_TREE ); + } + ; +path_delay_value + : path_delay_expression + | '(' path_delay_expression ',' path_delay_expression rp + { + $$ = chainon( $2, $4 ); + } + | '(' path_delay_expression ',' path_delay_expression ',' + path_delay_expression rp + { + tree t; + t = chainon( $2, $4 ); + $$ = chainon( t, $6 ); + } + | '(' path_delay_expression ',' path_delay_expression ',' + path_delay_expression ',' path_delay_expression ',' + path_delay_expression ',' path_delay_expression rp + { + tree t; + t = chainon( $2, $4 ); + t = chainon( t, $6 ); + t = chainon( t, $8 ); + t = chainon( t, $10 ); + $$ = chainon( t, $12 ); + } + ; +path_delay_expression + : mintypmax_expression + { + $$ = build_tree_list($1,NULL_TREE); + } + ; +polarity_operator + : '+' + { + $$ = 1; + } + | '-' + { + $$ = -1; + } + ; +path_operator + : STARARROW + { + $$ = FALSE; + } + | EQUALARROW + { + $$ = TRUE; + } + ; +conditional_port_expression + : expression /* according to the BNF this should be more elaborate */ + /* if further checking for conformance is required it + could be done in a later pass */ + ; +data_source_expression + : expression + ; +edge_identifier + : POSEDGE + { + $$ = 1; + } + | NEGEDGE + { + $$ = -1; + } + ; +specify_if_clause + : /* empty */ + { + $$ = 0; + } + | IF '(' conditional_port_expression rp + { + $$ = $3; + } + ; + +system_timing_check + : SETUP '(' timing_check_event ',' timing_check_event ',' + expression notify_clause rp sc + { + $$ = build_timing_statement( SETUP, $3, $5, $7, NULL_TREE, $8 ); + } + | HOLD '(' timing_check_event ',' timing_check_event ',' + expression notify_clause rp sc + { + $$ = build_timing_statement( HOLD, $3, $5, $7, NULL_TREE, $8 ); + } + | PERIOD '(' controlled_timing_check_event ',' + expression notify_clause rp sc + { + $$ = build_timing_statement( PERIOD, $3, NULL_TREE, $5, NULL_TREE, $6 ); + } + | WIDTH '(' controlled_timing_check_event ',' + expression rp sc + { + $$ = build_timing_statement( WIDTH, $3, NULL_TREE, $5, NULL_TREE, NULL_TREE ); + } + | WIDTH '(' controlled_timing_check_event ',' + expression ',' expression notify_clause rp sc + { + $$ = build_timing_statement( WIDTH, $3, NULL_TREE, $5, $7, $8 ); + } + | SKEW '(' timing_check_event ',' timing_check_event ',' + expression notify_clause rp sc + { + $$ = build_timing_statement( SKEW, $3, $5, $7, NULL_TREE, $8 ); + } + | RECOVERY '(' controlled_timing_check_event ',' timing_check_event ',' + expression notify_clause rp sc + { + $$ = build_timing_statement( RECOVERY, $3, $5, $7, NULL_TREE, $8 ); + } + | SETUPHOLD '(' timing_check_event ',' timing_check_event ',' + expression ',' expression notify_clause rp sc + { + $$ = build_timing_statement( SETUPHOLD, $3, $5, $7, $9, $10 ); + } + | NOCHANGE '(' controlled_timing_check_event ',' timing_check_event ',' + expression ',' expression rp sc + { + $$ = NULL_TREE; + } + ; +notify_clause + : /* EMPTY */ + { + $$ = 0; + } + | ',' notify_register + { + $$ = $2; + } + ; +notify_register + : IDENTIFIER + ; +timing_check_event + : timing_check_event_control timing_input_terminal_descriptor + { + $$ = build_timing_event( $1, $2, NULL_TREE ); + } + | timing_check_event_control timing_input_terminal_descriptor + ANDANDAND timing_check_condition + { + $$ = build_timing_event( $1, $2, $4 ); + } + ; +controlled_timing_check_event + : timing_check_event_control_no_empty timing_input_terminal_descriptor + { + $$ = build_timing_event( $1, $2, NULL_TREE ); + } + | timing_check_event_control_no_empty timing_input_terminal_descriptor + ANDANDAND timing_check_condition + { + $$ = build_timing_event( $1, $2, $4 ); + } + ; +timing_check_event_control + : /* EMPTY */ + { + extern unsigned int alledgeMask; + $$ = alledgeMask; + } + | POSEDGE + { + extern unsigned int posedgeMask; + $$ = posedgeMask; + } + | NEGEDGE + { + extern unsigned int negedgeMask; + $$ = negedgeMask; + } + | EDGE '[' + { extern int enable_edge_digit; + enable_edge_digit = TRUE; + } + edge_list rb + { + extern int enable_edge_digit; + enable_edge_digit = FALSE; + $$ = $4; + } + ; +timing_check_event_control_no_empty + : POSEDGE + { + extern unsigned int posedgeMask; + $$ = posedgeMask; + } + | NEGEDGE + { + extern unsigned int negedgeMask; + $$ = negedgeMask; + } + | EDGE '[' + { extern int enable_edge_digit; + enable_edge_digit = TRUE; + } + edge_list rb + { + extern int enable_edge_digit; + enable_edge_digit = FALSE; + $$ = $4; + } + ; +edge_list + : DOUBLE_DIGIT + { + extern unsigned int edge_mask[4][4]; + $$ = edge_mask[$1[0]][$1[1]]; + } + | DOUBLE_DIGIT ',' edge_list + { + extern unsigned int edge_mask[4][4]; + $$ = $3 | edge_mask[$1[0]][$1[1]]; + } + | error + { + $$ = 0; + } + ; +timing_check_condition + : scalar_expression + | '(' timing_check_condition ')' + { $$ = $2; } + | '~' scalar_expression %prec UNARY + { $$ = build_unary_op (BIT_NOT_EXPR, $2); } + | scalar_expression LOGICAL_EQUALITY scalar_constant + { $$ = build_binary_op (EQ_EXPR, $1, $3); } + | scalar_expression CASE_EQUALITY scalar_constant + { $$ = build_binary_op (EQ_CASE_EXPR, $1, $3); } + | scalar_expression CASE_INEQUALITY scalar_constant + { $$ = build_binary_op (NE_CASE_EXPR, $1, $3); } + | scalar_expression LOGICAL_INEQUALITY scalar_constant + { $$ = build_binary_op (NE_EXPR, $1, $3); } + ; +scalar_expression /* expression must be a Scalar Net */ + : IDENTIFIER + { $$ = check_rval ($1); } + ; +scalar_constant + : BASE_NUMBER + { + $$ = check_one_bit_constant($1); + } + | NUMBER + { + $$ = check_one_bit_constant($1); + } + ; + +timing_input_terminal_descriptor + : identifier + { + check_input_port($1); + $$ = check_rval ($1); + } + | identifier '[' expression ']' + { + check_input_port($1); + $$ = build_bit_ref ( check_rval_nocheck ($1), $3); + } + | identifier '[' constant_expression ':' constant_expression ']' + { + check_input_port($1); + $$ = build_part_ref ( check_rval_nocheck ($1), $3, $5); + } + ; + + +/* +A.7 Expressions +*/ + +lval_concat + : '{' lval_clist '}' + { $$ = make_node (CONCAT_REF); + CONCAT_LIST ($$) = $2; + concat_labels ($$); + } + ; + +lval_clist + : lval_normal + { $$ = build_tree_list ($1, NULL_TREE); } + | lval_concat + { $$ = build_tree_list ($1, NULL_TREE); } + | lval_clist ',' lval_normal + { $$ = tree_cons ($3, NULL_TREE, $1); } + | lval_clist ',' lval_concat + { $$ = tree_cons ($3, NULL_TREE, $1); } + | error + | lval_clist error + | lval_clist error lval_normal + | lval_clist error lval_concat + | lval_clist ',' error + ; + +conditional_expression + : expression + ; + +constant_expression + : expression + { if (!TREE_CONSTANT_ATTR ($1)) { + error ("Illegal non-constant expression", NULL_CHAR, NULL_CHAR); + $$ = error_mark_node; + } + else + $$ = $1; + } + ; + +mintypmax_expression + : expression + | expression ':' expression ':' expression + { switch (delay_type) { + case (MIN_DELAY): $$ = $1; break; + case (TYP_DELAY): $$ = $3; break; + case (MAX_DELAY): $$ = $5; break; + } + } + ; + +mintypmax_expression_triplet + : expression ':' expression ':' expression + { switch (delay_type) { + case (MIN_DELAY): $$ = $1; break; + case (TYP_DELAY): $$ = $3; break; + case (MAX_DELAY): $$ = $5; break; + } + } + ; + +expression + : primary + | '+' primary %prec UNARY + { $$ = $2; } + | '-' primary %prec UNARY + { $$ = build_unary_op (NEGATE_EXPR, $2); } + | '!' primary %prec UNARY + { $$ = build_unary_op (TRUTH_NOT_EXPR, $2); } + | '~' primary %prec UNARY + { $$ = build_unary_op (BIT_NOT_EXPR, $2); } + | '&' primary %prec UNARY + { $$ = build_unary_op (AND_REDUCE_EXPR, $2); } + | REDUCTION_NAND primary %prec UNARY + { $$ = build_unary_op (NAND_REDUCE_EXPR, $2); } + | '|' primary %prec UNARY + { $$ = build_unary_op (OR_REDUCE_EXPR, $2); } + | REDUCTION_NOR primary %prec UNARY + { $$ = build_unary_op (NOR_REDUCE_EXPR, $2); } + | '^' primary %prec UNARY + { $$ = build_unary_op (XOR_REDUCE_EXPR, $2); } + | XNOR primary %prec UNARY + { $$ = build_unary_op (XNOR_REDUCE_EXPR, $2); } + | expression '+' expression + { $$ = build_binary_op (PLUS_EXPR, $1, $3); } + | expression '-' expression + { $$ = build_binary_op (MINUS_EXPR, $1, $3); } + | expression '*' expression + { $$ = build_binary_op (MULT_EXPR, $1, $3); } + | expression '/' + { syn_warning ("Division operator"); } + expression + { $$ = build_binary_op (DIV_EXPR, $1, $4); } + | expression '%' + { syn_warning ("Modulus operator"); } + expression + { $$ = build_binary_op (MOD_EXPR, $1, $4); } + | expression LOGICAL_EQUALITY expression + { $$ = build_binary_op (EQ_EXPR, $1, $3); } + | expression LOGICAL_INEQUALITY expression + { $$ = build_binary_op (NE_EXPR, $1, $3); } + | expression CASE_EQUALITY + { syn_warning ("Case equality"); } + expression + { $$ = build_binary_op (EQ_CASE_EXPR, $1, $4); } + | expression CASE_INEQUALITY + { syn_warning ("Case inequality"); } + expression + { $$ = build_binary_op (NE_CASE_EXPR, $1, $4); } + | expression ANDAND expression + { $$ = build_binary_op (TRUTH_ANDIF_EXPR, $1, $3); } + | expression OROR expression + { $$ = build_binary_op (TRUTH_ORIF_EXPR, $1, $3); } + | expression LT expression + { $$ = build_binary_op (LT_EXPR, $1, $3); } + | expression LE expression + { $$ = build_binary_op (LE_EXPR, $1, $3); } + | expression GT expression + { $$ = build_binary_op (GT_EXPR, $1, $3); } + | expression GE expression + { $$ = build_binary_op (GE_EXPR, $1, $3); } + | expression '&' expression + { $$ = build_binary_op (BIT_AND_EXPR, $1, $3); } + | expression '|' expression + { $$ = build_binary_op (BIT_OR_EXPR, $1, $3); } + | expression '^' expression + { $$ = build_binary_op (BIT_XOR_EXPR, $1, $3); } + | expression XNOR expression + { $$ = build_binary_op (BIT_XNOR_EXPR, $1, $3); } + | expression LEFT_SHIFT expression + { $$ = build_binary_op (LSHIFT_EXPR, $1, $3); } + | expression RIGHT_SHIFT expression + { $$ = build_binary_op (RSHIFT_EXPR, $1, $3); } + | expression '?' expression ':' expression + { $$ = build_cond_expr ($1, $3, $5); } + | STRING + ; + +/* +UNARY_OPERATOR is one of the following tokens: + + - ! ~ + & ~& | ^| ^ ~^ + +BINARY_OPERATOR is one of the following tokens: + + - * / % + == != === !== + && || + < <= > >= + & | ^ ^~ + >> << + +STRING is text enclosed in "" and contained on one line +*/ + +primary + : NUMBER + | BASE_NUMBER + | identifier %prec LOWEST + { $$ = check_rval ($1); } + | identifier '[' expression ']' + { $$ = build_bit_ref (check_rval_nocheck ($1), $3); } + | identifier '[' constant_expression ':' constant_expression ']' + { $$ = build_part_ref (check_rval_nocheck ($1), $3, $5); } + | concatenation + | function_call + | '(' mintypmax_expression rp + { $$ = $2; } + | '(' error rp + { $$ = error_mark_node; } + ; + +/* +NUMBER + Numbers can be specified in decimal, hexadecimal, octal or + binary, may optionally start with a + or -, and can be given + in one of two forms. One form is a normal decimal number + specified as a sequence of the digits 0 to 9. The other takes + the form + + ss..s 'f nn..n + + where the characters ss..s are decimal digits and specify the + size of the constant in terms of the exact number of bits + that make up the constant. The size specification is + optional. The character f represents the base format and + must be one of d, h, o, or b, for the bases decimal, + hexadecimal, octal and binary respectively. The characters + nn..n represent the constants value, and must follow the base + specification and be one of the following characters + + 0123456789abcdefABCDEFxXzZ + + White space is allowed between ss..s and the characters 'f, + and between 'f and nn..n. + +BASE is one of the following tokens: + 'b 'B 'o 'O 'd 'D 'h 'H +*/ + +concatenation + : '{' expression_clist '}' + { $$ = make_node (CONCAT_REF); + CONCAT_LIST ($$) = $2; + concat_labels ($$); + } + | '{' constant_expression '{' expression_clist '}' '}' + { $$ = make_node (CONCAT_REP_REF); + CONCAT_LIST ($$) = $4; + CONCAT_EXPR ($$) = $2; + concat_labels ($$); + } + ; + +function_call + : identifier '(' xexpression_clist rp + { $$ = build_function_call ($1, nreverse ($3)); + HIERARCHICAL_ATTR ($$) = HIERARCHICAL_ATTR ($1); + UNKNOWN_TYPE_ATTR ($$) = 1; + } + | SYSTEM_IDENTIFIER '(' xexpression_clist rp +/* { $$ = build_function_call ($1, nreverse ($3)); } */ + { $$ = build_nt (SYSFUNCTION_REF, IDENTIFIER_POINTER ($1), + nreverse ($3), NULL_TREE, NULL_TREE, lineno, input_filename); } + | SYSTEM_IDENTIFIER %prec LOWEST +/* { $$ = build_function_call ($1, NULL_TREE); } */ + { $$ = build_nt (SYSFUNCTION_REF, IDENTIFIER_POINTER ($1), + NULL_TREE, NULL_TREE, NULL_TREE, lineno, input_filename); } + ; + +/* +A.8 General +*/ + +identifier + : HIERARCHY_IDENTIFIER + { + syn_warning ("Hierachical name"); + /* hierarchical_list = link_tree_cons ($1, NULL_TREE, hierarchical_list); */ + HIERARCHICAL_ATTR ($1) = 1; + UNKNOWN_TYPE_ATTR ($1) = 1; + TREE_CONSTANT_ATTR ($1) = 1; /* assume this is true for now */ + } + + | IDENTIFIER + ; + +IDENTIFIER_or_OR + : IDENTIFIER + | OR + { $$ = get_identifier ("or"); } + ; +/* +IDENTIFIER + An identifier is any sequence of letters, digits and the + underscore (_) symbol, except that the first must be a letter + or the underscore. Upper and lower case letters are + considered to be different (unless the upper case option is + used when compiling). Identifiers may be of any size, i.e. + all characters are significant. + Escaped identifiers start with the \ character and provide a + means of including any of the printable ascii characters in + an identifier. An escaped identifier ends with white space. + The leading \ character is not considered to be part of the + identifier. +*/ + +delay_o + : /* empty */ + { $$ = NULL_TREE; } + | delay + ; + +delay + : '#' NUMBER + { $$ = build_nt (DELAY_EXPR, $2, $2, NULL_TREE); + TREE_LABEL ($$) = 1; + } + | '#' identifier + { $$ = check_rval ($2); + $$ = build_nt (DELAY_EXPR, $$, $$, NULL_TREE); + TREE_LABEL ($$) = 1; + } + | '#' '(' mintypmax_clist rp + { $$ = $3; } +/* | '#' '(' mintypmax_clist rp + { $$ = build_nt (DELAY_EXPR, $3, $3, NULL_TREE); + TREE_LABEL ($$) = 1; + } +*/ ; + +mintypmax_clist + : mintypmax_expression + { $$ = build_nt (DELAY_EXPR, $1, $1, NULL_TREE); + TREE_LABEL ($$) = 1; + } + | mintypmax_expression ',' mintypmax_expression + { $$ = build_nt (DELAY_EXPR, $1, $3, NULL_TREE); + TREE_LABEL ($$) = 2; + } + | mintypmax_expression ',' mintypmax_expression ',' mintypmax_expression + { $$ = build_nt (DELAY_EXPR, $1, $3, $5); + TREE_LABEL ($$) = 3; + } + ; + +delay_control + : '#' NUMBER + { $$ = $2; } + | '#' identifier + { $$ = check_rval ($2); } + | '#' '(' mintypmax_expression rp + { $$ = $3; } + ; + +event_control + : '@' { in_event = 1; } + identifier /* statement_or_null */ + {if (!HIERARCHICAL_ATTR ($3) && + TREE_CODE (IDENT_CURRENT_DECL ($3)) == EVENT_DECL) + $$ = build_stmt (EVENT_STMT, lineno, NULL_TREE, + build_tree_list (IDENT_CURRENT_DECL ($3), NULL_TREE)); + else + $$ = build_stmt (EVENT_STMT, lineno, NULL_TREE, + build_tree_list (build_unary_op + (ANYEDGE_EXPR, check_rval ($3)), NULL_TREE)); + in_event = 0; + } + | '@' '(' { in_event = 1; } + event_expression rp /* statement_or_null */ + { $$ = build_stmt (EVENT_STMT, lineno, NULL_TREE, $4); + in_event = 0; } + ; + +event_expression + : expression + { /*if (TREE_CODE ($1) == EVENT_DECL) + $$ = build_tree_list ($1, NULL_TREE); + else */ + $$ = build_tree_list + (build_unary_op (ANYEDGE_EXPR, $1), NULL_TREE); + } + | POSEDGE expression + { $$ = build_tree_list + (build_unary_op (POSEDGE_EXPR, $2), NULL_TREE); } + | NEGEDGE expression + { $$ = build_tree_list + (build_unary_op (NEGEDGE_EXPR, $2), NULL_TREE); } + | event_expression OR event_expression + { $$ = chainon ($1, $3); } + ; + +/* +"Important" terminals +*/ + +rp + : ')' + { yyerrok; } + ; + +rb + : ']' + { yyerrok; } + | error + { yyerrok; } + ; + +sc + : ';' + { yyerrok; } + ; + +%% +void +eat_block (short token) +{ + YYSTYPE lval; + + for (;;) + if (yylex (&lval) == token) + return; +} + diff --git a/src/pass2.cc b/src/pass2.cc new file mode 100644 index 0000000..9df9e2e --- /dev/null +++ b/src/pass2.cc @@ -0,0 +1,957 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* PASS2.C - Generate hierarchy, allocate variables, propigate parameters */ + +#define PASS2_C + +#include "glue.h" +#include +#include +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "schedule.h" +#include "obstack.h" +#include "runtime.h" +#include "decl.h" +#include "scope.h" +#include "macro.h" +#include "io.h" +#include "store.h" +#include "udp.h" +#include "pass3.h" +#include "eval.h" +#include "copy.h" +#include "check.h" +#include "pass2.h" +#include "veriwell.h" +#include "flags.h" +#include "lex.h" + +static void parse_at_top_scope(tree scope); + + +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free + + +/* This obstack contains pointers to expression/ref/decl nodes in the + order that they should be evaluated (postfix). */ +extern struct obstack inst_obstack; +extern struct obstack alt_inst_obstack; + +/* This is some global information that needs to be kept around for + when markers need to be generated for references inside event + expressions. Perhaps this is a grungy way of doing it. */ + +extern struct Marker_info marker_info; +extern LibPath_t *ypathList; + +/* TREE_LIST of continuous assignments that are port connections */ +tree port_connections = NULL_TREE; + + +/* Memory allocation routines for pass3_decl. Allocate the memory and + initialize to all Xs. */ + +Group *malloc_X(ngroups_t ngroups) +{ + ngroups_t i; + Group *tmp, *tmp1; + + tmp1 = tmp = (Group *) xmalloc(ngroups * sizeof(Group)); + if (tmp) + for (i = 0; i < ngroups; i++, tmp++) + BVAL(tmp) = AVAL(tmp) = (Bit) - 1; + + return tmp1; +} + +Group *realloc_X(Group * g, ngroups_t ngroups) +{ + ngroups_t i; + Group *tmp, *tmp1; + + tmp1 = tmp = (Group *) xrealloc((char*)g, ngroups * sizeof(Group)); + if (tmp) + for (i = 0; i < ngroups; i++, tmp++) + BVAL(tmp) = AVAL(tmp) = (Bit) - 1; + + return tmp1; +} + +/* Memory allocation routines for pass3_decl. Allocate the memory and + initialize to all Zs for Nets. */ + +Group *malloc_Z(ngroups_t ngroups) +{ + ngroups_t i; + Group *tmp, *tmp1; + + tmp1 = tmp = (Group *) xmalloc(ngroups * sizeof(Group)); + if (tmp) + for (i = 0; i < ngroups; i++, tmp++) { + BVAL(tmp) = (Bit) - 1; + AVAL(tmp) = 0; + } + + return tmp1; +} + +Group *realloc_Z(Group * g, ngroups_t ngroups) +{ + ngroups_t i; + Group *tmp, *tmp1; + + tmp1 = tmp = (Group *) xrealloc((char*)g, ngroups * sizeof(Group)); + if (tmp) + for (i = 0; i < ngroups; i++) { + BVAL(tmp) = (Bit) - 1; + AVAL(tmp) = 0; + } + + return tmp1; +} + +static ngroups_t do_vector_stuff(tree decl) +{ + nbits_t nbits; + ngroups_t ngroups; + + MSB(decl) = + get_range(DECL_MSB(decl), IDENTIFIER_POINTER(DECL_NAME(decl))); + LSB(decl) = + get_range(DECL_LSB(decl), IDENTIFIER_POINTER(DECL_NAME(decl))); + nbits = ABS(MSB(decl) - LSB(decl)) + 1; + VECTOR_DIRECTION_ATTR(decl) = (MSB(decl) >= LSB(decl)); + ngroups = bits_to_groups(nbits); + if (ngroups > MAX_GROUPS) + sorry1("Maximum vector size is %d", (char *) MAX_BITS); + TREE_NBITS(decl) = nbits; + return ngroups; +} + +/* Allocate storage for declaration block after evaluating and checking + LSB and MSBs. */ + +void pass3_decl(tree decl) +{ + enum tree_type code = (enum tree_type) TREE_CODE(decl); + nbits_t nbits; + ngroups_t ngroups; + ngroups_t array_size; + + lineno = DECL_SOURCE_LINE(decl); + input_filename = DECL_SOURCE_FILE(decl); + INITIALIZED_ATTR(decl) = 1; + SET_DECL_STATE(decl, X); /* By default; nest will change this to Z */ + switch (code) { + + case NET_SCALAR_DECL: + SET_DECL_STATE(decl, Z); + pass3_delay(NET_DELAY(decl)); + + if (STMT_SURROGATE_ATTR(decl)) { + /* copy stuff from original; TREE_CHAIN points to original */ + TREE_NBITS(decl) = 1; + DECL_STORAGE(decl) = (Group *) malloc_Z((ngroups_t) 1); + marker_info.first = NULL; + marker_info.last = NULL; + marker_info.flags = (enum marker_flags) (M_NET + M_FIXED); +// if (/*PORT_INPUT_ATTR (decl) ||*/ PORT_OUTPUT_ATTR (decl)) + if (PORT_IMMEDIATE_ATTR(decl)) // || PORT_COLLAPSED_ATTR (decl)) + marker_info.flags = + (enum marker_flags) (M_PORT + marker_info.flags); + marker_info.delay = NET_DELAY(decl); + if (!NET_ASSIGN_ATTR(decl) + || PORT_COLLAPSED_ATTR(TREE_CHAIN(decl)) + || NET_DELAY(TREE_CHAIN(decl))) + BuildMarker(decl, &marker_info); + break; + } /* if not surrogate, do the rest the same as for regs */ + DECL_STORAGE(decl) = (Group *) malloc_Z((ngroups_t) 1); + TREE_NBITS(decl) = 1; + break; + + case REG_SCALAR_DECL: + DECL_STORAGE(decl) = (Group *) malloc_X((ngroups_t) 1); + TREE_NBITS(decl) = 1; + break; + + case INTEGER_DECL: + MSB(decl) = 31; + LSB(decl) = 0; + VECTOR_DIRECTION_ATTR(decl) = 1; + DECL_STORAGE(decl) = (Group *) malloc_X((ngroups_t) 1); + TREE_NBITS(decl) = 32; + break; + + case REAL_DECL: + MSB(decl) = 31; + LSB(decl) = 0; + VECTOR_DIRECTION_ATTR(decl) = 1; + DECL_STORAGE(decl) = (Group *) malloc_X((ngroups_t) 1); + REAL_(DECL_STORAGE(decl)) = 0; + TREE_NBITS(decl) = 32; + break; + + case ARRAY_DECL: + ARRAY_HI(decl) = get_range(ARRAY_HI_EXPR(decl), + IDENT(DECL_NAME(decl))); + ARRAY_LO(decl) = get_range(ARRAY_LO_EXPR(decl), + IDENT(DECL_NAME(decl))); + + switch (ARRAY_CODE(decl)) { + case REG_VECTOR_DECL: + ngroups = do_vector_stuff(decl); + break; + + case INTEGER_DECL: + TREE_NBITS(decl) = 32; + ngroups = 0; + break; + + case TIME_DECL: + TREE_NBITS(decl) = 64; + ngroups = 1; + break; + + case REG_SCALAR_DECL: + TREE_NBITS(decl) = 1; + ngroups = 0; + break; + + default: + fatal("Internal error: unknown array type", NULL); + } + { + nbits_t tmp_array_size; + tmp_array_size = ABS(ARRAY_HI(decl) - ARRAY_LO(decl)) + 1; + if (tmp_array_size > MAX_ARRAY + || tmp_array_size * (ngroups + 1) > MAX_ARRAY) { + error("Maximum array size exceeded in array '%s'", + IDENT(DECL_NAME(decl)), NULL_CHAR); + array_size = 1; + } else + array_size = tmp_array_size; + } /* Allocate pointers to array elements */ + DECL_STORAGE(decl) = + (Group *) malloc_X(array_size * (ngroups + 1)); + + VECTOR_DIRECTION_ATTR(decl) = (ARRAY_HI(decl) >= ARRAY_LO(decl)); + break; + + case NET_VECTOR_DECL: + SET_DECL_STATE(decl, Z); + pass3_delay(NET_DELAY(decl)); + + if (STMT_SURROGATE_ATTR(decl)) { + if (TREE_CODE(TREE_CHAIN(decl)) == NET_SCALAR_DECL) + fatal("Scalar converted to vector", NULL); + /* copy stuff from original; TREE_CHAIN points to original */ + MSB(decl) = MSB(TREE_CHAIN(decl)); + LSB(decl) = LSB(TREE_CHAIN(decl)); + VECTOR_DIRECTION_ATTR(decl) = + VECTOR_DIRECTION_ATTR(TREE_CHAIN(decl)); + TREE_NBITS(decl) = TREE_NBITS(TREE_CHAIN(decl)); + ngroups = bits_to_groups(TREE_NBITS(decl)); + DECL_STORAGE(decl) = (Group *) malloc_Z(ngroups + 1); + marker_info.first = NULL; + marker_info.last = NULL; + marker_info.flags = (enum marker_flags) (M_NET + M_FIXED); +// if (/*PORT_INPUT_ATTR (decl) ||*/ PORT_OUTPUT_ATTR (decl)) + if (PORT_IMMEDIATE_ATTR(decl)) // || NET_ASSIGN_ATTR (decl)) + marker_info.flags = + (enum marker_flags) (M_PORT + marker_info.flags); + marker_info.delay = NET_DELAY(decl); + if (!NET_ASSIGN_ATTR(decl) + || PORT_COLLAPSED_ATTR(TREE_CHAIN(decl))) + BuildMarker(decl, &marker_info); + break; + } + /* if not surrogate, do the rest the same as for regs */ + ngroups = do_vector_stuff(decl); + DECL_STORAGE(decl) = (Group *) malloc_Z(ngroups + 1); + break; + + case TIME_DECL: + MSB(decl) = 0; + LSB(decl) = 0; + TREE_NBITS(decl) = 64; + DECL_STORAGE(decl) = (Group *) malloc_X((ngroups_t) 2); + break; + + case REG_VECTOR_DECL: + ngroups = do_vector_stuff(decl); + DECL_STORAGE(decl) = (Group *) malloc_X(ngroups + 1); + break; + + case TMP_DECL: + TREE_NBITS(decl) = TREE_NBITS(TREE_CHAIN(decl)); /* inherit bits */ + ngroups = bits_to_groups(TREE_NBITS(decl)); + DECL_STORAGE(decl) = (Group *) malloc_Z(ngroups + 1); + break; + + case EVENT_DECL: + case BLOCK_DECL: + TREE_NBITS(decl) = 1; + break; + + case SPECPARAM_DECL: + case PARAM_DECL: + if (!DECL_PARAM_REDIRECT(decl)) { + DECL_PARAM_RVAL_CODE(decl) = pass3_expr(DECL_PARAM_RVAL(decl)); + nbits = TREE_NBITS(DECL_PARAM_RVAL(decl)); + TREE_REAL_ATTR(decl) = TREE_REAL_ATTR(DECL_PARAM_RVAL(decl)); + TREE_INTEGER_ATTR(decl) = + TREE_INTEGER_ATTR(DECL_PARAM_RVAL(decl)); + } else { + DECL_PARAM_RVAL_CODE(decl) = + pass3_expr(DECL_PARAM_REDIRECT(decl)); + nbits = TREE_NBITS(DECL_PARAM_REDIRECT(decl)); + TREE_REAL_ATTR(decl) = + TREE_REAL_ATTR(DECL_PARAM_REDIRECT(decl)); + TREE_INTEGER_ATTR(decl) = + TREE_INTEGER_ATTR(DECL_PARAM_REDIRECT(decl)); + } + ngroups = bits_to_groups(nbits); + if (ngroups > MAX_GROUPS) + sorry1("Maximum vector size is %d", (char *) MAX_BITS); + if (DECL_MSB(decl)) { + do_vector_stuff(decl); +// MSB (decl) = get_range (DECL_MSB (decl), IDENTIFIER_POINTER (DECL_NAME (decl))); +// LSB (decl) = get_range (DECL_LSB (decl), IDENTIFIER_POINTER (DECL_NAME (decl))); +// VECTOR_DIRECTION_ATTR (decl) = (MSB (decl) >= LSB (decl)); + } else { + VECTOR_DIRECTION_ATTR(decl) = 1; /* default to msb>lsb */ + LSB(decl) = 0; + MSB(decl) = nbits - 1; + } + + TREE_NBITS(decl) = nbits; + if (bits_to_groups(nbits) > MAX_GROUPS) + sorry1("Maximum vector size is %d", (char *) MAX_BITS); + DECL_STORAGE(decl) = (Group *) malloc_X(ngroups + 1); + INITIALIZED_ATTR(decl) = 1; + { + /* need to allocate space for expressions; these are defined in + pass3.c */ + extern ngroups_t stack_size; + extern int max_label; + + if (!R_alloc(max_label, stack_size)) + fatal + ("Not enough memory to evaluate parameter expression of '%s'", + IDENT(DECL_NAME(decl))); + } + eval(DECL_PARAM_RVAL_CODE(decl)); + store(decl, decl); + break; + + default: + error("Don't know how to allocate for %s (%s)", + tree_code_name[code], IDENT(DECL_NAME(decl))); + } + + if ((enum tree_code)code != EVENT_DECL && (enum tree_code)code != BLOCK_DECL) + if (DECL_STORAGE(decl) == 0) +// if ((code != ARRAY_DECL && DECL_STORAGE (decl) == 0) +// || (code == ARRAY_DECL && DECL_STORAGE (decl) == 0)) + fatal("Not enough memory to allocate storage for '%s'", + IDENTIFIER_POINTER(DECL_NAME(decl))); + +} + + +/* A module wasn't found in the hierarchy; look for a library using the + -y option and the +libext options if they are supplied */ + +tree check_library(char *name) +{ + char *ytmp; + char *p; + char *pathend; + char path[256]; + LibPath_t *ypath; + File *f; + tree tmp_module_list, tmp_module; + tree saved_scope; + + + + for (ypath = ypathList; ypath != NULL; ypath = ypath->next) { + strcpy(path, ypath->path); /* copy the library path */ + strcat(path, PATHSEP); /* Add trailing "/" (or "\" or ":") */ + strcat(path, name); /* Add name of module */ + pathend = &path[strlen(path)]; + + if (ylibext) { /* +libext option supplied */ + ytmp = (char *) xmalloc(strlen(ylibext) + 1); + strcpy(ytmp, ylibext); + + /* loop through all the extensions given in the option */ + for (p = strtok(ytmp, "+"); p; p = strtok(NULL, "+")) { + strcpy(pathend, p); /* append various extensions */ +// printf ("Attempting to open %s\n", path); + f = File::fopen(path, "rt"); /* try it */ + if (f) { + goto foundit; + } + } + } + } + + return NULL_TREE; + + foundit: + + push_stream(fin, 2); + fin = f; + input_filename = xmalloc(strlen(path) + 1); + lineno = 1; + + strcpy(input_filename, path); + tmp_module_list = module_list; /* Start new module list for... */ + module_list = NULL_TREE; /* ...library file */ + +/* We have to be at the top module level for an instance to happen. Pop + this scope level so that all idents have no current value. Now, the + parse can happen in a clean environment. Else, the parse will pick up + idents used in the parent module. */ + +#if 0 + saved_scope = current_scope; + pop_scope(); /* free up idents */ + current_scope = NULL_TREE; /* incase timescale is used */ + prog_parse(); /* Parse the library file */ + module_list = nreverse(module_list); /* put first mod first */ + tmp_module = TREE_PURPOSE(module_list); /* get first one */ + module_list = chainon(tmp_module_list, module_list); /* reassemble */ + + fin = pop_stream(); + set_scope(saved_scope); /* restore parent scope */ +#endif + + parse_at_top_scope(current_scope); + + module_list = nreverse(module_list); /* put first mod first */ + tmp_module = TREE_PURPOSE(module_list); /* get first one */ + module_list = chainon(tmp_module_list, module_list); /* reassemble */ + + fin = pop_stream(); + LIB_MODULE_ATTR(tmp_module) = 1; + return tmp_module; +} + +/* unwind the stack and then parse the library at the top level scope; + restore the state of the scope stack after */ + +void parse_at_top_scope(tree scope) +{ + tree new_scope; + + new_scope = pop_scope(); + if (new_scope) + parse_at_top_scope(new_scope); /* recursively unwind */ + + else { /* at top, now parse */ + + current_scope = NULL_TREE; /* incase timescale is used */ + prog_parse(); /* Parse the library file */ + } + set_scope(scope); /* unwind recursion */ +} + + + +static tree copy_module(tree node) +{ + return copy_block(node); +} + +/* Lookup the module being instantiated. If the module found is a library + module, compare number of ports to make sure that another library module + isn't needed. + Later, this could be converted to use hashing, esp after gates are + supported */ + +static tree module_lookup(tree instance) +{ + tree t; + char *name = IDENT(INSTANCE_MODULE_NAME(instance)); + + for (t = module_list; t; t = TREE_CHAIN(t)) { + if (!strcmp(name, (MODULE_NAME(TREE_PURPOSE(t))))) { + if (UDP_ATTR(TREE_PURPOSE(t))) { /* this is a udp instantiation */ + return (TREE_PURPOSE(t)); + } + + + if (LIB_MODULE_ATTR(TREE_PURPOSE(t))) { + if (list_length(INSTANCE_PORTS(instance)) != + list_length(BLOCK_PORTS(TREE_PURPOSE(t)))) + continue; + } + return (TREE_PURPOSE(t)); + } + } + return check_library(name); +} + +/* Actually connect the ports; emulate collapsing if necessary. Pass in + the module port, the instance port argument, and the instance node for + line number info */ + +static void do_connect_ports(tree terminal, tree arg_tree, tree instance) +{ + enum tree_code port_code; + tree arg = TREE_PURPOSE(arg_tree); + enum tree_code arg_code = TREE_CODE(arg); + int collapse; + tree assign; + tree port; + + port = TREE_PURPOSE(terminal); + port_code = TREE_CODE(port); + //PORT_TERMINAL_HICONN( terminal ) = arg; + + if (PORT_REDEFINED_ATTR(port)) { + port = DECL_THREAD(port); + port_code = TREE_CODE(port); + } + +/* Loosely emulate port collapsing by making it so that "collapsed ports" + propigate immediately. This will happen is both ports are scalar nets + or both are vector nets. (The legality of the ports has already been + determined and one must already be a net, so it is sufficient to test + only for type equality.) Note that collapsed port forces it to be + an INOUT type, but that fact won't be explicitly mentioned in traces. */ + +/* [Some explaination is necessary: is both arg and port are net vectors + or both are net scalars, then collapse, regardless of whether the + port is input, output, or inout. This is because some models + (particularly sio85) rely on the fact that collapsed ports propigate + immediately. However, don't collapse when the arg is a part-select, + bit-select, or concat. Unless the port is an INOUT. This is because + we didn't want to slow down models that were already running reasonably + fast before this change (collapsing part/bit/concats on INOUT) went in. + If the part-selects, etc were collapsed, some models slowed 100%.] + */ + +// if (arg_code == port_code) + if ((is_net_code(arg_code) && arg_code == port_code) + || PORT_INPUT_ATTR(port) && PORT_OUTPUT_ATTR(port)) +// if (is_all_net (arg) && is_all_net (port))// && PORT_INPUT_ATTR (port) && PORT_OUTPUT_ATTR (port)) + collapse = 1; + else + collapse = 0; + +/* If port was copied (multiple module instantiation), then this + would be non-zero which would screw up output ports. So, make sure + it is NULL. */ + + TREE_3RD(arg_tree) = NULL_TREE; + + if (PORT_INPUT_ATTR(port)) // || collapse) + { + assign = build_cont_assign(check_lval_port(port), + arg, DECL_SOURCE_LINE(port), NULL_TREE, + 0); +// assign = build_cont_assign (check_lval (DECL_NAME (port), 4, port), +// arg, DECL_SOURCE_LINE (port), NULL_TREE, 0); + PORT_INPUT_ATTR(STMT_ASSIGN_LVAL(assign)) = PORT_INPUT_ATTR(port); + PORT_OUTPUT_ATTR(STMT_ASSIGN_LVAL(assign)) = + PORT_OUTPUT_ATTR(port); + PORT_COLLAPSED_ATTR(STMT_ASSIGN_LVAL(assign)) = collapse; + PORT_IMMEDIATE_ATTR(STMT_ASSIGN_LVAL(assign)) = collapse; + /* save port connection in 3rd node og arg's tree_list */ + TREE_3RD(arg_tree) = build_tree_list(assign, NULL_TREE); + } + if (PORT_OUTPUT_ATTR(port)) // || collapse) + { + if (!is_all_net(arg)) { + error("Illegal output port specification: '%s'", + IDENT(DECL_NAME(arg)), NULL_CHAR); + return; + } else if (port_code == NET_VECTOR_DECL + || port_code == NET_SCALAR_DECL) { + tree tmp_decl = copy_node(port); +// tree tmp_decl = make_net_source (port); + + DECL_THREAD(port) = tmp_decl; + DECL_THREAD(tmp_decl) = port; + DECL_NAME(tmp_decl) = DECL_NAME(port); + + assign = build_cont_assign(check_lval_port(arg), + tmp_decl, INSTANCE_LINE(instance), + NULL_TREE, 0); + } else { + assign = build_cont_assign(check_lval_port(arg), + port, INSTANCE_LINE(instance), + NULL_TREE, 0); + } +// PORT_INPUT_ATTR (STMT_ASSIGN_LVAL (assign)) = PORT_INPUT_ATTR (port); +// PORT_OUTPUT_ATTR (STMT_ASSIGN_LVAL (assign)) = PORT_OUTPUT_ATTR (port); +// PORT_COLLAPSED_ATTR (STMT_ASSIGN_LVAL (assign)) = collapse; + +// PORT_IMMEDIATE_ATTR (STMT_ASSIGN_LVAL (assign)) = collapse;// | PORT_OUTPUT_ATTR (port); + set_immediate_attr(STMT_ASSIGN_LVAL(assign), collapse); + PORT_COLLAPSED_ATTR(port) = collapse; + /* If this is bi-directional, then TREE_LIST will already have been + created */ + if (TREE_3RD(arg_tree)) + TREE_VALUE(TREE_3RD(arg_tree)) = assign; + else + TREE_3RD(arg_tree) = build_tree_list(NULL_TREE, assign); + } +} + +static void connect_ports(tree inside, tree outside) +{ + tree port, arg; + + arg = INSTANCE_PORTS(outside); + + /* named ports match in one of two conditions: if the name matches the + name of the decl of the port (if it is a decl and not a concat, + part-select, etc), or if the port is also named and the names match. + Note that matching is determined if the IDENTIFIER_NODEs are the + same since there is one hash table for an entire model. */ + + if (TREE_VALUE(arg)) { + for (; arg; arg = TREE_CHAIN(arg)) { + for (port = MODULE_PORT_LIST(inside); port; + port = TREE_CHAIN(port)) { + if ((*tree_code_type[TREE_CODE(TREE_PURPOSE(port))] == 'd' + && TREE_VALUE(arg) == DECL_NAME(TREE_PURPOSE(port))) + || TREE_VALUE(arg) == TREE_VALUE(port)) { + if (NAMED_PORT_ATTR(port)) + error("More than one connection to a port", + NULL_CHAR, NULL_CHAR); + NAMED_PORT_ATTR(port) = 1; + do_connect_ports(port, arg, outside); + break; + } + } + if (!port) + error("No port named '%s'", IDENT(TREE_VALUE(arg)), + NULL_CHAR); + } + + /* reset named port markers */ + for (port = MODULE_PORT_LIST(inside); port; + port = TREE_CHAIN(port)) + NAMED_PORT_ATTR(port) = 0; + } + +/* Ordered list of ports */ + else + for (port = MODULE_PORT_LIST(inside); port && arg; + port = TREE_CHAIN(port), arg = TREE_CHAIN(arg)) + if (TREE_PURPOSE(arg)) + do_connect_ports(port, arg, outside); + + if (arg && TREE_PURPOSE(arg)) + warning("Too many instance ports", NULL, NULL); + else if (port) + warning("Too few instance ports", NULL, NULL); + +} + +/* If there are any defparams in the module, they are chained in + MODULE_DEFPARAMS. Make sure lval exists, then redirect its parameter + to our lval. Only call this for modules. */ + +static void resolve_defparams(tree scope) +{ + tree t, param, lval; + tree resolve_hierarchical_name(tree); + tree search_up_decl(char *, tree); + + for (t = MODULE_DEFPARAMS(scope); t; t = TREE_CHAIN(t)) { + lval = STMT_ASSIGN_LVAL(t); + if (HIERARCHICAL_ATTR(lval)) + param = resolve_hierarchical_name(lval); + else + param = search_up_decl(IDENT(lval), scope); + if (param == error_mark_node) + return; + if (!param) { + error("Parameter '%s' not declared", IDENT(lval), NULL_CHAR); + return; + } + DECL_PARAM_REDIRECT(param) = STMT_ASSIGN_RVAL(t); + } +} + +/* Initialize all decls in the current scope and all others below. These + will be task, functions, and named blocksm and, of course, modules. */ + +static void initialize_decls(tree scope) +{ + tree t, t1; + + current_scope = scope; + + if (TREE_CODE(scope) == MODULE_BLOCK) { + resolve_defparams(scope); + + for (t = MODULE_SPECDEFS(scope); t; t = TREE_CHAIN(t)) { + if (TREE_CODE(t) == SPECPARAM_DECL && !INITIALIZED_ATTR(t)) { + pass3_decl(t); + } + } + } + + for (t = BLOCK_DECL(scope); t; t = TREE_CHAIN(t)) { + pass3_decl(t); + /* process other sources to a net */ + if (TREE_CODE(t) == NET_VECTOR_DECL || + TREE_CODE(t) == NET_SCALAR_DECL) { + marker_info.current_scb = BuildSCB(t, NOLIST); + if (PORT_OUTPUT_ATTR(t) || PORT_COLLAPSED_ATTR(t)) + if (DECL_THREAD(t)) + pass3_decl(DECL_THREAD(t)); + + for (t1 = NET_SOURCE(t); t1; t1 = NET_SOURCE(t1)) { + if (strcmp(IDENTIFIER_POINTER(DECL_NAME(t1)), + IDENTIFIER_POINTER(DECL_NAME(t)))) + fatal("Line %lu Driver names to not agree\n", + (char *) lineno); + pass3_decl(t1); + } + } + } + + for (t = BLOCK_PORTS(scope); t; t = TREE_CHAIN(t)) { + if (PORT_REDEFINED_ATTR(t)) + continue; + pass3_decl(t); + /* process other sources to a net */ + if (TREE_CODE(t) == NET_VECTOR_DECL || + TREE_CODE(t) == NET_SCALAR_DECL) { + marker_info.current_scb = BuildSCB(t, NOLIST); + if (PORT_OUTPUT_ATTR(t) || PORT_COLLAPSED_ATTR(t)) + if (DECL_THREAD(t)) + pass3_decl(DECL_THREAD(t)); + + for (t1 = NET_SOURCE(t); t1; t1 = NET_SOURCE(t1)) + pass3_decl(t1); + } + } + + /* Allocate return variable */ + if (TREE_CODE(scope) == FUNCTION_BLOCK) { + pass3_decl(FUNCT_DECL(scope)); + TREE_NBITS(scope) = TREE_NBITS(FUNCT_DECL(scope)); + } + + + /* do this for everyone below us */ + for (t = BLOCK_DOWN(scope); t; t = TREE_CHAIN(t)) + initialize_decls(t); + +} + +/* recursively link module together hierarchically */ + +static void do_instantiation(tree node) +{ + tree t, instance; + int had_to_copy; + +/* Allocate space for declared vars */ + +#if VDEBUG != 0 + if (vdebug) + printf_V("****** PASS2: Module '%s', instance '%s'\n", + MODULE_NAME(node), IDENT(BLOCK_NAME(node))); +#endif + + INITIALIZED_ATTR(node) = 1; + + /* scan all instantiations within this module */ + for (t = MODULE_INSTANCES(node); t; t = TREE_CHAIN(t)) { + HEAPTEST("In do_instantiation"); + if (TREE_CODE(t) != INSTANCE_NODE) + continue; + /* get line and file info in case of errors */ + lineno = STMT_SOURCE_LINE(t); + input_filename = STMT_SOURCE_FILE(t); + + /* first, look for module name */ +// instance = module_lookup (IDENTIFIER_POINTER (INSTANCE_MODULE_NAME (t))); + instance = module_lookup(t); +//printf_V (" Examining instance '%s', line %lu\n", IDENT (INSTANCE_MODULE_NAME (t)), lineno); + if (!instance) { + error("Module '%s' not defined", + IDENT(INSTANCE_MODULE_NAME(t)), NULL_CHAR); + continue; +// break; + } + + /* if module instance is really a udp, handle here */ + + if (UDP_ATTR(instance)) { + if (UDP_ATTR(t) == TRUE) /* already set; must have been copied... */ + continue; /* ...copy already build the gate instance */ + UDP_ATTR(t) = TRUE; + instantiate_udp(node, t, instance); + continue; + } + + + /* Next, if the module is not top-level, the we need to make a copy */ + if (BLOCK_UP(instance)) { +//printf_V ("Starting Copy...."); + instance = copy_module(instance); +//printf_V ("Ending Copy\n"); + had_to_copy = 1; + if (!instance) + break; + } else + had_to_copy = 0; + + if (!INSTANCE_NAME(t) && !LIB_MODULE_ATTR(instance)) { + error("No module name given in instantiation", NULL_CHAR, + NULL_CHAR); +// return; + } +/// ehm 3/7/97 else if (!LIB_MODULE_ATTR (instance)) +/// { +// if (!IDENT_CURRENT_DECL (INSTANCE_NAME (t))) +// fatal ("Instance name isn't in decl list: '%s'", IDENT (INSTANCE_NAME (t))); + +// DECL_THREAD (IDENT_CURRENT_DECL (INSTANCE_NAME (t))) = instance; +// make_block_decl (INSTANCE_NAME (t), node, instance); +// if (had_to_copy) + make_block_decl(INSTANCE_NAME(t), node, instance); +// ehm 3/7/97 } +// " else +// " { +// " INSTANCE_NAME (t) = INSTANCE_MODULE_NAME (t); +//" } + + /* Thread the module in */ + TREE_CHAIN(instance) = BLOCK_DOWN(node); + BLOCK_DOWN(node) = instance; + BLOCK_UP(instance) = node; + BLOCK_NAME(instance) = INSTANCE_NAME(t); + + INSTANCE_BLOCK(t) = instance; + + /* resolve module parameter overrides #(...) */ + if (INSTANCE_PARAMS(t)) { + tree decl, param_list = INSTANCE_PARAMS(t); + + /* scan decl list for a parameter */ + for (decl = BLOCK_DECL(instance); decl; + decl = TREE_CHAIN(decl)) { + if (TREE_CODE(decl) != PARAM_DECL) + continue; + DECL_PARAM_REDIRECT(decl) = TREE_PURPOSE(param_list); + if ((param_list = TREE_CHAIN(param_list)) == 0) + break; + } + if (param_list) + error("Too many module instance parameter assignments", + NULL_CHAR, NULL_CHAR); + } + + connect_ports(instance, t); + + /* Recursively instantiate modules inside the instance (if not already + done). */ + if (!INITIALIZED_ATTR(instance)) { + set_scope(instance); + do_instantiation(instance); + current_scope = pop_scope(); + } + } +} + +/* Main entrypoint */ + +void build_hierarchy() +{ + tree t, t1; + extern tree scope0; /* defined in decl.c */ + + obstack_init(&inst_obstack); + obstack_init(&alt_inst_obstack); + + initialize_scope(NULL_TREE); + + for (t1 = module_list; t1; t1 = TREE_CHAIN(t1)) { + t = TREE_PURPOSE(t1); + if (!BLOCK_UP(t) && !UDP_ATTR(t)) { /* don't do anything if not top_level or udp */ + set_scope(t); + do_instantiation(t); + current_scope = pop_scope(); + } + } + scope0 = make_node(SUPER_BLOCK); + BLOCK_DECL(scope0) = NULL; + +//printf_V ("Allocating variable storage\n"); + for (t1 = module_list; t1; t1 = TREE_CHAIN(t1)) { + t = TREE_PURPOSE(t1); + if (!BLOCK_UP(t) && !UDP_ATTR(t)) { /* don't do anything if not top_level or udp */ + TREE_CHAIN(t) = top_level; + top_level = t; + make_block_decl(BLOCK_NAME(t), scope0, t); +// initialize_decls (t); + } + } + /* Do this after all top-levels are resolved so that hierarchical defparams + can be accurately located */ + for (t = top_level; t; t = TREE_CHAIN(t)) + initialize_decls(t); + + BLOCK_DOWN(scope0) = top_level; + BLOCK_UP(scope0) = NULL; + BLOCK_NAME(scope0) = NULL; +} + + +void print_top_modules() +{ + tree t; + + /* for any module that has not moved, thread it onto the top_level list */ + printf_V("Top-level modules:\n"); + for (t = top_level; t; t = TREE_CHAIN(t)) + printf_V(" %s\n", IDENT(BLOCK_NAME(t))); + printf_V("\n"); +} + +/************************************************************** + * + * init_pass2 + * - initializes global and static variables in pass2.c + * + ************************************************************** + */ + +void init_pass2() +{ + port_connections = NULL_TREE; +} diff --git a/src/pass2.h b/src/pass2.h new file mode 100644 index 0000000..178e243 --- /dev/null +++ b/src/pass2.h @@ -0,0 +1,54 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* PASS2.H - Pass2 routine prototypes */ + +#ifndef PASS2_H +#define PASS2_H + +// public methods + +Group *malloc_X(ngroups_t ngroups); +Group *realloc_X(Group * g, ngroups_t ngroups); +Group *malloc_Z(ngroups_t ngroups); +Group *realloc_Z(Group * g, ngroups_t ngroups); +void pass3_decl(tree decl); +void build_hierarchy(void); +void print_top_modules(void); +void build_hierarchy(void); +void print_top_modules(void); +void init_pass2(); +tree check_library(char *name); + +// private methods + +#ifdef PASS2_C + +static ngroups_t do_vector_stuff(tree decl); +static tree copy_module(tree node); +static tree module_lookup(tree instance); +static void do_connect_ports(tree port, tree arg_tree, tree instance); +static void connect_ports(tree inside, tree outside); +static void resolve_defparams(tree scope); +static void initialize_decls(tree scope); +static void do_instantiation(tree node); + +#endif // PASS2_C + +#endif // PASS2_H diff --git a/src/pass3.cc b/src/pass3.cc new file mode 100644 index 0000000..d4af3cd --- /dev/null +++ b/src/pass3.cc @@ -0,0 +1,2000 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* PASS3.C - Snap forward pointers, resolve hierarchical names, expr lengths */ + +#define PASS3_C + +#include +#include +#include "glue.h" +#include "vtypes.h" +#include "tree.h" +#include "schedule.h" +#include "obstack.h" +#include "acc_user.h" +#include "pli.h" +#include "systask.h" +#include "decl.h" +#include "multdiv.h" +#include "pass3.h" +#include "scope.h" +#include "specify.h" +#include "gates.h" +#include "eval.h" +#include "pass2.h" +#include "timescal.h" +#include "veriwell.h" +#if VDEBUG != 0 +#include +#include "flags.h" +#endif + +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free + +extern tree current_scope; + +tree *debug_; +tree debug_tree; + +static int in_lval = 0; /* set if processing lvalue (used in concat) */ +static int in_connect_ports = 0; /* set if building port connections */ +#define INSERT_PTR(NODE) obstack_ptr_grow (&inst_obstack, (tree) NODE) + +/* This obstack contains pointers to expression/ref/decl nodes in the + order that they should be evaluated (postfix). */ +struct obstack inst_obstack; +struct obstack alt_inst_obstack; + +/* This is some global information that needs to be kept around for + when markers need to be generated for references inside event + expressions. Perhaps this is a grungy way of doing it. */ + +struct Marker_info marker_info; + +/* save the number of instructions for the last expression + processed in case bit_ref needs it */ +static int last_inst_length; + +/* this is used as a temp stack fro saving stack size */ +extern struct obstack linkage_obstack; + +/* In fixup_nbits, while the tree is being walked, use the following + variables to keep track of the space required to execute the + expression. */ +ngroups_t have_for_push, have_for_pad, stack_size = 0, stack_extension = 0; +int stack_lineno; +char *stack_filename; + +tree debug_node; + +/* Lets NET lvals point to its source */ +tree global_cont_assign; + +/* Keep track of the largest number of regsisters required thus far. */ +int max_label = 0; + +/* The instruction obstack may be interrupted so that part-select references + and other constants can be evaluated. When something needs to be + evaluated, push the current state of the obstack, and start a new one. + When the evaluation is complete, pop the obstack and restore the state + so that new stuff can be added to the old stuff. */ + +struct inst_level { + struct inst_level *prev; /* where to pop to */ + void *base; + void *finish; +}; + +static struct inst_level *inst_stack; + + +void push_inst() +{ + void *finish = obstack_next_free(&inst_obstack); /* mark temporary end */ + void *base = obstack_finish(&inst_obstack); + struct inst_level *tem = + (struct inst_level *) obstack_alloc(&inst_obstack, + sizeof(struct inst_level)); + tem->prev = inst_stack; + tem->base = base; /* save the base */ + tem->finish = finish; /* save the current end */ + inst_stack = tem; +} + +void pop_inst() +{ + struct inst_level *tem = inst_stack; + void *base; + + inst_stack = tem->prev; + base = tem->base; + obstack_free(&inst_obstack, tem->finish); /* unwind to end of prev stack */ + obstack_set_base(&inst_obstack, base); /* restore prev stack base */ + return; +} + +/* Certain instructions need to keep track of the size of subexpressions. + In doing so, it will push the current stack size settings and reset + them. It will pop the saved setting at the end of its operation. */ + +struct stack_size_level { + struct stack_size_level *prev; /* where to pop to */ + ngroups_t have_for_push; + ngroups_t have_for_pad; +}; + +static struct stack_size_level *stack_size_stack; + +void push_stack_size() +{ + struct stack_size_level *tem + = (struct stack_size_level *) obstack_alloc(&linkage_obstack, + sizeof(struct + stack_size_level)); + tem->prev = stack_size_stack; + tem->have_for_push = have_for_push; + tem->have_for_pad = have_for_pad; + stack_size_stack = tem; + have_for_pad = have_for_push = 0; +} + +void pop_stack_size() +{ + struct stack_size_level *tem = stack_size_stack; + + stack_size_stack = tem->prev; + have_for_push = tem->have_for_push; + have_for_pad = tem->have_for_pad; + obstack_free(&linkage_obstack, (char *) tem); + return; +} + +/* At the end of pass 3, stack_allocate is called to allocate space + for the stack */ + +void stack_allocate() +{ + if (!R_alloc(max_label, stack_size)) { + lineno = stack_lineno; + input_filename = stack_filename; + fatal("Out of memory", NULL); + } +} + +/* Make sure there is enough space on the stack for an expression that + will be evaluated in the middle of another expression. Eg shift count + and conditional operator. */ +/* Note that this code is very similar to pass3_expr() and perhaps should + be merged someday. */ + +static nbits_t ensure_stack_space(tree node) +{ + nbits_t nbits; + ngroups_t tmp_pad; + char *type = tree_code_type[TREE_CODE(node)]; + + push_stack_size(); /* suspend current stack count */ + nbits = fixup_nbits(node); /* generate instructions & shift cnt */ + adjust_nbits(nbits, &node, (tree *) obstack_base(&inst_obstack)); + if (*type != 'e' || (*++type != '1' && *type != 'r')) + reserve_stack_space(TREE_SUB_LABEL(node), nbits, nbits); + tmp_pad = have_for_push + have_for_pad; /* treat all as padding */ + pop_stack_size(); /* get back current count */ + have_for_pad = max(tmp_pad, have_for_pad); /* account for the extra padding */ + return nbits; +} + +/* reserve space on the expression stack. Most of the space in needed to + push datum, but some is for the result which would be included + in the calculation for the parent expression, if any, so it is + treated as temporary padding. */ + +static void +reserve_stack_space(int number, nbits_t nbits_push, nbits_t nbits_pad) +{ + ngroups_t need_for_push = number * (bits_to_groups(nbits_push) + 1); + ngroups_t need_for_pad = bits_to_groups(nbits_pad) + 1; + + have_for_push += need_for_push; /* add to the stack */ + if (need_for_push >= have_for_pad) /* take away from the padding */ + have_for_pad = 0; + else + have_for_pad -= need_for_push; + have_for_pad = max(have_for_pad, need_for_pad); /* incread pad if nec. */ +} + +/* Return the module containing the given scope */ +tree module_of(tree scope) +{ + if (TREE_CODE(scope) == MODULE_BLOCK) + return scope; + else + return (module_of(BLOCK_UP(scope))); +} + +tree lookdown_scope(char *ident, tree scope) +{ + tree t; + + // ??? mdh - also look in parent scopes + do { + for (t = BLOCK_DOWN(scope); t; t = TREE_CHAIN(t)) { + if (!strcmp(IDENT(BLOCK_NAME(t)), ident)) + return t; + } + scope = BLOCK_UP(scope); + } + while (scope); + return NULL_TREE; +} + +/* Build a marker if the reference is inside an even expression */ + +void maybe_build_marker(tree decl) +{ + if (decl == error_mark_node) { + return; + } + if (marker_info.in_event) + BuildMarker(decl, &marker_info); +} + +void adjust_nbits(nbits_t nbits, tree * tree_addr, tree * code_base) +{ + tree node = *tree_addr; + ngroups_t ngroups; + char *tree_type_ptr = tree_code_type[TREE_CODE(node)]; + + /* Always make sure there is space on the stack */ + if ((ngroups = bits_to_groups(nbits)) >= stack_size) + stack_size = ngroups + 1; +// if (stack_size > 50) +// fatal ("Big stack size at line %lu\n", lineno); + + if (TREE_NBITS(node) >= nbits) + return; + switch (*tree_type_ptr) { + case ('e'): + switch (*++tree_type_ptr) { + case ('1'): /* binary condition */ + TREE_NBITS(node) = nbits; + return; + + case ('x'): /* binary context-dependent */ + TREE_NBITS(node) = nbits; + adjust_nbits(nbits, &TREE_OPERAND(node, 0), code_base); + adjust_nbits(nbits, &TREE_OPERAND(node, 1), code_base); + return; + + case ('u'): /* unary context-dependent */ + TREE_NBITS(node) = nbits; + adjust_nbits(nbits, &TREE_OPERAND(node, 0), code_base); + return; + + case ('r'): /* unary reduction */ + case ('c'): /* unary type conversion */ + TREE_NBITS(node) = nbits; + return; + + case ('s'): /* shift */ + TREE_NBITS(node) = nbits; + /* pass on to operand, not to shift count */ + adjust_nbits(nbits, &TREE_OPERAND(node, 0), code_base); + return; + + case ('3'): /* conditional */ + TREE_NBITS(node) = nbits; + adjust_nbits(nbits, &COND_TRUE(node), COND_TRUE_CODE(node)); + adjust_nbits(nbits, &COND_FALSE(node), COND_FALSE_CODE(node)); + return; + } + + case ('r'): + case ('c'): + TREE_NBITS(node) = nbits; + return; + case ('d'): + { + tree t = make_node(SHADOW_REF); + TREE_CHAIN(t) = node; + TREE_REAL_ATTR(t) = TREE_REAL_ATTR(node); + TREE_INTEGER_ATTR(t) = TREE_INTEGER_ATTR(node); + *tree_addr = t; + /* go back through code pointers and change decl pointer to + ref pointer */ + { + tree *p; + for (p = code_base; *p != node; p++); + *p = t; + } + TREE_NBITS(t) = nbits; + return; + } + } +} + +static struct part_info *cook_part_ref(nbits_t offset_high, + nbits_t offset_low, int concat) +{ + struct part_info *info = + (struct part_info *) xmalloc(sizeof(struct part_info)); + int rel_offset_low = offset_low % BITS_IN_GROUP; + int rel_offset_high = offset_high % BITS_IN_GROUP; + int length = offset_high - offset_low + 1; + + /* Case 1: within one group */ + if (offset_high / BITS_IN_GROUP == offset_low / BITS_IN_GROUP) { + PART_ALIGNED(info) = 1; + + PART_LMASK1(info) = + ~(mask_right[rel_offset_low] ^ + mask_right[rel_offset_high + 1]); + PART_RMASK(info) = + mask_right[rel_offset_high - rel_offset_low + 1]; + PART_NGROUPS(info) = 0; + PART_SHIFT(info) = rel_offset_low; + if (rel_offset_high == BITS_IN_GROUP - 1) + PART_NEXT(info) = 1; /* next avail group in concat */ + else + PART_NEXT(info) = 0; /* still room in this group */ + } else { + PART_NGROUPS(info) = bits_to_groups(length); + PART_ALIGNED(info) = rel_offset_high >= rel_offset_low; + PART_RMASK(info) = + mask_right[rel_offset_high - rel_offset_low + 1]; + PART_LMASK1(info) = mask_right[rel_offset_low]; + if (!PART_ALIGNED(info)) + PART_LMASK2(info) = ~mask_right[rel_offset_high + 1]; + else + PART_LMASK2(info) = + ~(mask_right[rel_offset_low] ^ + mask_right[rel_offset_high + 1]); + PART_SHIFT(info) = rel_offset_low; + PART_NEXT(info) = bits_to_groups(length + rel_offset_low + 1); + } + return info; +} + +/* Evaluate LSB or MSB of DECL or part-select reference. Must scan + expression tree (see fixup_nbits) and generate code. Then evaluate + expression checking for legal range limits. */ + +nbits_t get_range(tree node, char *ident) +{ + tree *expr_code; + nbits_t index; + + push_inst(); /* Push the code obstack since we're prob in the middle of something */ + expr_code = pass3_expr(node); + /* + * allow things to continue even if errors exist + */ +// if( max_label == 0 ) { +// return 0; +// } + if (TREE_NBITS(node) > MAX_BITS_IN_NUMBER) + error("Range expression must be within 32 bits", NULL_CHAR, + NULL_CHAR); + if (!R_alloc(max_label, stack_size)) + fatal("Not enough memory to evaluate range expression of %s", + IDENTIFIER_POINTER(DECL_NAME(node))); + index = eval_range(expr_code, ident); + pop_inst(); + return index; +} + +/* Evaluate 32-bit constant */ + +Group *get_const(tree node, nbits_t * nbits_ptr) +{ + tree *expr_code; + Group *val; + + push_inst(); /* Push the code obstack since we're prob in the middle of something */ + expr_code = pass3_expr(node); + if (!R_alloc(max_label, stack_size)) + fatal("Not enough memory to evaluate constant expression", + NULL_CHAR); + val = eval_(expr_code, nbits_ptr); +// if (TREE_NBITS (node) > MAX_BITS_IN_NUMBER) +// error ("Constant expression must be within 32 bits", NULL_CHAR, NULL_CHAR); + pop_inst(); + return val; +} + +/* Evaluate 32-bit scaled delay */ + +Bit get_delay(tree node) +{ + tree *expr_code; + Group *val; + nbits_t nbits_ptr; + + push_inst(); /* Push the code obstack since we're prob in the middle of something */ + expr_code = timescale_scale(node); + if (!R_alloc(max_label, stack_size)) + fatal("Not enough memory to evaluate constant expression", + NULL_CHAR); + val = eval_(expr_code, &nbits_ptr); +// if (TREE_NBITS (node) > MAX_BITS_IN_NUMBER) +// error ("Constant expression must be within 32 bits", NULL_CHAR, NULL_CHAR); +// ASSERT( nbits_ptr <= 32 ); + pop_inst(); + return AVAL(val); +} + +/* resolve the hierarchical name and build a shadow for the decl node */ + +static nbits_t pass3_hierarchy(tree node) +{ + tree t1 = resolve_hierarchical_name(node); + tree t = make_node(SHADOW_REF); + + REF_NAME(t) = node; + TREE_CHAIN(t) = t1; + TREE_NBITS(t) = TREE_NBITS(t1); + HIERARCHICAL_ATTR(t) = 1; + INSERT_PTR(t); + maybe_build_marker(t1); /* Marker to original decl */ + return TREE_NBITS(t); +} + +static nbits_t fixup_reference(tree node) +{ + enum tree_code code = TREE_CODE(node); + nbits_t msb, lsb, msb_decl, lsb_decl; + nbits_t nbits, nbits1, nbits_decl, prev_nbits; + Group *val; + tree t; + + switch (code) { + case BIT_REF: + BIT_EXPR_CODE(node) = pass3_expr_intrude(BIT_EXPR(node), 1); + TREE_LABEL(node) = TREE_LABEL(BIT_EXPR(node)); + TREE_SUB_LABEL(node) = TREE_SUB_LABEL(BIT_EXPR(node)); + if (TREE_NBITS(*BIT_EXPR_CODE(node)) > MAX_BITS_IN_NUMBER) + error("Bit-select index expression must be within 32 bits", + NULL_CHAR, NULL_CHAR); + +/* If this is a hierarchical reference, then there was no way to + determine if this was a bit reference or an array reference. + Once we know, make sure the reference is set correctly. Since + bit and array references look identical, then all that need to + be dome is to set the code correctly so that eval() will + do the right thing. */ + + if (HIERARCHICAL_ATTR(node)) { + BIT_REF_DECL(node) = + resolve_hierarchical_name(BIT_REF_NAME(node)); + if (TREE_CODE(BIT_REF_DECL(node)) == ARRAY_DECL) + TREE_SET_CODE(node, ARRAY_REF); + } + maybe_build_marker(BIT_REF_DECL(node)); + if (TREE_CODE(node) == ARRAY_REF) + TREE_NBITS(node) = TREE_NBITS(BIT_REF_DECL(node)); + else + TREE_NBITS(node) = 1; + break; + + case ARRAY_REF: + ARRAY_EXPR_CODE(node) = pass3_expr_intrude(ARRAY_EXPR(node), 1); + if (TREE_NBITS(*ARRAY_EXPR_CODE(node)) > MAX_BITS_IN_NUMBER) + error("Array index expression must be within 32 bits", + NULL_CHAR, NULL_CHAR); + + maybe_build_marker(ARRAY_REF_DECL(node)); + TREE_NBITS(node) = TREE_NBITS(ARRAY_REF_DECL(node)); + break; + + case CONCAT_REP_REF: + val = get_const(CONCAT_EXPR(node), &nbits); + if (!BVAL(val)) + CONCAT_COUNT(node) = AVAL(val); + else + CONCAT_COUNT(node) = 0; /* X or Z in expression */ + if (nbits > MAX_BITS_IN_NUMBER) + warning + ("Repeat count expression is larger than 32 bits; will be truncated", + NULL, NULL); + + case CONCAT_REF: + nbits = prev_nbits = 0; +// push_inst (); + +/* TREE_PURPOSE (t) is the member expression. TREE_VALUE (t) points + to another tree_list node. TREE_PURPOSE of this 2nd list node is + the expression code; TREE_VALUE of the 2nd list node points to a + part_info structure. + */ + + for (t = CONCAT_LIST(node); t; t = TREE_CHAIN(t)) { + tree tmp_tree; + + TREE_VALUE(t) = make_node(TREE_LIST); + + TREE_PURPOSE(TREE_VALUE(t)) = + (tree) pass3_expr_intrude(TREE_PURPOSE(t), 1); + TREE_LABEL(node) = + max(TREE_LABEL(node), TREE_LABEL(TREE_PURPOSE(t))); + TREE_SUB_LABEL(node) = + max(TREE_SUB_LABEL(node), TREE_SUB_LABEL(TREE_PURPOSE(t))); + +/* To get the right NBITS, use TREE_NBITS from the original expression + if it is not a hierarchical reference; get TREE_NBITS from the + dereferenced expression code if it is a hierarchical reference. + */ + + tmp_tree = + H_(*(tree *) TREE_PURPOSE(TREE_VALUE(t)), TREE_PURPOSE(t)); + nbits1 = TREE_NBITS(tmp_tree); + +/* lval case shifts over previous concat entry; rval case shifts + from absolute location */ + + TREE_VALUE(TREE_VALUE(t)) = + (tree) cook_part_ref(nbits + nbits1 - 1, nbits, 1); + + /* nbits is the total number of bits in the concat ref */ + nbits += nbits1; + if (bits_to_groups(nbits) > bits_to_groups(nbits1)) + prev_nbits = nbits % BITS_IN_GROUP; + else + prev_nbits = nbits1; + } + TREE_LABEL(node) += 1; + TREE_SUB_LABEL(node) += 1; + CONCAT_NBITS(node) = nbits; + if (code == CONCAT_REF) + TREE_NBITS(node) = nbits; + else + TREE_NBITS(node) = nbits * CONCAT_COUNT(node); + break; + + case PART_REF: + if (HIERARCHICAL_ATTR(node)) { + PART_DECL(node) = resolve_hierarchical_name(PART_NAME(node)); + if (PART_DECL(node) == error_mark_node) { + TREE_NBITS(node) = 1; + break; + } + } + +/* If the decl that node is pointing to is a redeclared port, move the pointer + to the newer decl */ +/* + + if ((PORT_OUTPUT_ATTR (PART_DECL (node)) || + PORT_INPUT_ATTR (PART_DECL (node))) + && DECL_THREAD (PART_DECL (node))) + PART_DECL (node) = DECL_THREAD (PART_DECL (node)); + */ + PART_MSB(node) = msb = + get_range(PART_MSB_(node), + IDENTIFIER_POINTER(DECL_NAME(PART_DECL(node)))); + PART_LSB(node) = lsb = + get_range(PART_LSB_(node), + IDENTIFIER_POINTER(DECL_NAME(PART_DECL(node)))); + + nbits = msb - lsb; + if (ABS(nbits) + 1 > MAX_BITS) + error("Part-select for '%s' encompases too many bits", + IDENT(DECL_NAME(PART_DECL(node))), NULL_CHAR); + msb_decl = MSB(PART_DECL(node)); + lsb_decl = LSB(PART_DECL(node)); + nbits_decl = msb_decl - lsb_decl; + if (nbits < 0) { + if (nbits_decl > 0) + error("MSB and LSB of '%s' are reversed", + IDENT(DECL_NAME(PART_DECL(node))), NULL_CHAR); + else if (msb < msb_decl || lsb > lsb_decl) + error + ("Part-select is outside limits set by declaration of '%s'", + IDENT(DECL_NAME(PART_DECL(node))), NULL_CHAR); + } else { + if (nbits_decl < 0) + error("MSB and LSB of '%s' are reversed", + IDENT(DECL_NAME(PART_DECL(node))), NULL_CHAR); + else if (msb > msb_decl || lsb < lsb_decl) + error + ("Part-select is outside limits set by declaration of '%s'", + IDENT(DECL_NAME(PART_DECL(node))), NULL_CHAR); + } + PART_STORAGE(node) = DECL_STORAGE(PART_DECL(node)) + + (ABS(lsb - lsb_decl)) / BITS_IN_GROUP; + PART_INFO(node) = + cook_part_ref(ABS(msb - lsb_decl), ABS(lsb - lsb_decl), 0); + TREE_NBITS(node) = ABS(nbits) + 1; + maybe_build_marker(PART_DECL(node)); + break; + + case FUNCTION_REF: + if (HIERARCHICAL_ATTR(node)) + t = search_scope(FUNC_REF_NAME(node), 0); + else +// t = lookdown_scope (FUNC_REF_NAME (node), current_pass3_module); + t = lookdown_scope(FUNC_REF_NAME(node), + module_of(current_scope)); + if (!t) { + error("Function '%s' not defined", FUNC_REF_NAME(node), + NULL_CHAR); + break; + } + FUNC_REF_INASSIGN(node) = NULL_TREE; + FUNC_REF_FUNC(node) = t; + FUNC_REF_CONTEXT(node) = current_scope; + if (FUNC_REF_ARGS(node)) { + pass3_args(FUNC_REF_ARGS(node), FUNC_REF_NAME(node), + &FUNC_REF_INASSIGN(node), (tree *) NULL, + BLOCK_PORTS(t), 1); + } + TREE_NBITS(node) = TREE_NBITS(FUNCT_DECL(t)); + TREE_REAL_ATTR(node) = TREE_REAL_ATTR(FUNCT_DECL(t)); + TREE_INTEGER_ATTR(node) = TREE_INTEGER_ATTR(FUNCT_DECL(t)); + break; + + case SYSFUNCTION_REF: + { + p_tfcell p_tf; + enum sysfunction_type sysfunction = + lookup_sysfunction(FUNC_REF_NAME(node), &p_tf); + if (sysfunction == -1) { + if (lookup_systask(FUNC_REF_NAME(node), &p_tf) != -1) + error + ("'%s' is a system task; it cannot be called as a function", + FUNC_REF_NAME(node), NULL_CHAR); + else + error("Unknown system function '%s'", + FUNC_REF_NAME(node), NULL_CHAR); + TREE_NBITS(node) = 32; + break; + } + FUNC_REF_CONTEXT(node) = current_scope; + SET_FUNC_REF_SYSTYPE(node, sysfunction); + FUNC_REF_USERTF(node) = p_tf; + init_sysfunction(node); + } + break; + + } /* switch */ + return TREE_NBITS(node); +} + +/* Convert op1 to real if necessary */ + +int pass3_early_conversion(tree * op1_ptr, tree op2) +{ + tree op1 = *op1_ptr; + + /* if op1 is not real but op2 is, insert a real conversion operator */ + if (!TREE_REAL_ATTR(op1) && TREE_REAL_ATTR(op2)) { + *op1_ptr = build_unary_op(REAL_CONV_EXPR, op1); + TREE_REAL_ATTR(*op1_ptr) = 1; + TREE_INTEGER_ATTR(*op1_ptr) = 0; + TREE_NBITS(*op1_ptr) = 32; + return 1; + } + return 0; +} + +/* Convert op1 to integer if necessary */ + +int pass3_early_both_conversion(tree * op1_ptr, tree op2) +{ + tree op1 = *op1_ptr; + + /* if op1 is real, but op2 is not, convert op1 to integer */ + if (TREE_REAL_ATTR(op1) && !TREE_REAL_ATTR(op2)) { + *op1_ptr = build_unary_op(INT_CONV_EXPR, op1); + TREE_REAL_ATTR(*op1_ptr) = 0; + TREE_INTEGER_ATTR(*op1_ptr) = 1; + TREE_NBITS(*op1_ptr) = 1; + return 1; + } else + return pass3_early_conversion(op1_ptr, op2); +} + + +/* After it is already too late, add an integer->real conversion block */ + +int pass3_late_conversion(tree * op1_ptr, tree op2, int code_offset) +{ + tree *p, *p_end; + + if (pass3_early_conversion(op1_ptr, op2)) { + INSERT_PTR(NULL_TREE); /* Make room for one more pointer */ + + /* Start at current end, shift all instruction pointers down one + until we are at the place where the conversion instruction needs + to be inserted */ + p = (tree *) obstack_next_free(&inst_obstack); + p_end = + (tree *) ((char *) obstack_base(&inst_obstack) + code_offset); + while (--p > p_end) + *p = *(p - 1); + *p = *op1_ptr; /* Insert newly-created conversion block */ + return 1; + } + return 0; +} + +/* Fixup_nbits performs several tasks: + 1) sets TREE_NBITS for each node with is the expression length of the + result of the operation. It make sure that the Verilog rules for + context-dependent expression length are followed. If two operands + of an operator ar of different lengths, adjust_nbits will be called + to enlarge the smaller subexpression. Adjusting does not go below + conditional and reduction operators since their lengths are not context- + dependent. + 2) As the expression tree is walked, a list is created that points to + all of the nodes in the expression in postfix order. This list will + later be used to execute/evaluate the expression at runtime. + 3) As part-references are found, the expressions for their msbs and lsbs + are evaluated and tested for consistancy (same direction as the declared + var, etc.). This is done by recursively calling fixup_nbits. +*/ + +nbits_t fixup_nbits(tree node) +{ + nbits_t nbits_left, nbits_right, nbits; + enum tree_code code = TREE_CODE(node); + char *tree_type_ptr = tree_code_type[code]; + tree *finish; + int finish_size, op0_offset; + + + switch (*tree_type_ptr) { + case 'x': + if (HIERARCHICAL_ATTR(node)) + return pass3_hierarchy(node); + else if (node == error_mark_node) + return 1; +#if VDEBUG != 0 + else if (vdebug) { + if (code == ERROR_MARK) { + printf_error_V("Pass3 over error_mark"); + return 0; + } + } +#endif + else + fatal("Internal: Attempt to reparse identifier", NULL_CHAR); + break; + + case ('r'): + INSERT_PTR(node); + TREE_NBITS(node) = fixup_reference(node); + return TREE_NBITS(node); + + case ('d'): /* decl nodes will have had TREE_NBITS set */ + maybe_build_marker(node); +// if (!INITIALIZED_ATTR (node)) +// fatal ("Uninitialized decl: %s\n", IDENTIFIER_POINTER (DECL_NAME (node))); + if (in_lval) + if (code == NET_VECTOR_DECL || code == NET_SCALAR_DECL) + NET_ASSIGNMENT(node) = global_cont_assign; + + case ('c'): /* as will constant nodes */ + INSERT_PTR(node); + return TREE_NBITS(node); + + case ('e'): + switch (*++tree_type_ptr) { + + /* The condition operator (?:) is treated as a binary op for the + purpose of allocating stack space since in the worst case + (condition = X), both true and false expressions need to be + evaluated. But, make sure there is enough stack space for + the condition expression */ + + case ('3'): + COND_EXPR_CODE(node) = pass3_expr_intrude(COND_EXPR(node), 0); + + push_inst(); + nbits_left = fixup_nbits(COND_TRUE(node)); + INSERT_PTR(NULL_TREE); /* Make room for possible conversion */ + op0_offset = obstack_object_size(&inst_obstack); + INSERT_PTR(NULL_TREE); + finish_size = obstack_object_size(&inst_obstack); + finish = (tree *) obstack_finish(&inst_obstack); + COND_TRUE_CODE(node) = + (tree *) obstack_copy(&alt_inst_obstack, finish, + finish_size); + + if (pass3_early_conversion(&COND_FALSE(node), COND_TRUE(node))) + TREE_REAL_ATTR(node) = 1; + nbits_right = fixup_nbits(COND_FALSE(node)); + INSERT_PTR(NULL_TREE); + finish_size = obstack_object_size(&inst_obstack); + finish = (tree *) obstack_finish(&inst_obstack); + COND_FALSE_CODE(node) = + (tree *) obstack_copy(&alt_inst_obstack, finish, + finish_size); + pop_inst(); /* go back to current expression */ + + /* go back and add real conversion if necessary */ + if (pass3_early_conversion(&COND_TRUE(node), COND_FALSE(node))) { + tree *p = COND_TRUE_CODE(node) + op0_offset; + *p = COND_TRUE(node); + nbits_left = 32; + TREE_REAL_ATTR(node) = 1; + } + + if (nbits_left < nbits_right) { + adjust_nbits(nbits_right, &COND_TRUE(node), + COND_TRUE_CODE(node)); + nbits = nbits_right; + } else if (nbits_left > nbits_right) { + adjust_nbits(nbits_left, &COND_FALSE(node), + COND_FALSE_CODE(node)); + nbits = nbits_left; + } else + nbits = nbits_left; /* nbits_left equals nbits_right */ + + INSERT_PTR(node); + TREE_NBITS(node) = (*tree_type_ptr == '1') ? 1 : nbits_left; + break; + +/* For a binary context-dependent operations, return the largest of the + left and right operands and make the smaller side the same size. */ + + case ('x'): + case ('1'): + nbits_left = fixup_nbits(TREE_OPERAND(node, 0)); + op0_offset = obstack_object_size(&inst_obstack); + + /* && and || are conditional, the operator terminate once the + truth can be deterimined. Thus, the right op is recuresively + evaluated at runtime only if necessary; a seperate set of + instructions is generated for this. */ + + if (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR) { + push_inst(); + if (pass3_early_conversion(&TREE_OPERAND(node, 1), + TREE_OPERAND(node, 0))) { + TREE_REAL_ATTR(node) = 1; + TREE_INTEGER_ATTR(node) = 0; + } + nbits_right = fixup_nbits(TREE_OPERAND(node, 1)); + INSERT_PTR(NULL_TREE); + finish_size = obstack_object_size(&inst_obstack); + finish = (tree *) obstack_finish(&inst_obstack); + TRUTH_EXPR_CODE(node) = + (tree *) obstack_copy(&alt_inst_obstack, finish, + finish_size); + pop_inst(); + if (pass3_late_conversion(&TREE_OPERAND(node, 1), + TREE_OPERAND(node, 0), + op0_offset)) { + TREE_REAL_ATTR(node) = 1; + TREE_INTEGER_ATTR(node) = 0; + } + } else { + if (pass3_early_conversion(&TREE_OPERAND(node, 1), + TREE_OPERAND(node, 0))) { + TREE_REAL_ATTR(node) = 1; + TREE_INTEGER_ATTR(node) = 0; + } + nbits_right = fixup_nbits(TREE_OPERAND(node, 1)); + if (pass3_late_conversion(&TREE_OPERAND(node, 0), + TREE_OPERAND(node, 1), + op0_offset)) { + TREE_REAL_ATTR(node) = 1; + TREE_INTEGER_ATTR(node) = 0; + } + + if (TREE_REAL_ATTR(TREE_OPERAND(node, 0)) + && TREE_REAL_ATTR(TREE_OPERAND(node, 1))) { + TREE_REAL_ATTR(node) = 1; + TREE_INTEGER_ATTR(node) = 0; + } + } + + if (nbits_left < nbits_right) { + adjust_nbits(nbits_right, &TREE_OPERAND(node, 0), + (tree *) obstack_base(&inst_obstack)); + nbits = nbits_right; + } else if (nbits_left > nbits_right) { + if (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR) + adjust_nbits(nbits_left, &TREE_OPERAND(node, 1), + TRUTH_EXPR_CODE(node)); + else + adjust_nbits(nbits_left, &TREE_OPERAND(node, 1), + (tree *) obstack_base(&inst_obstack)); + nbits = nbits_left; + } else + nbits = nbits_left; /* nbits_left equals nbits_right */ + + /* reserve enough stack space for the subexpression */ + if (*tree_type_ptr == '1') + reserve_stack_space(TREE_SUB_LABEL(node), nbits, + (nbits_t) 1); + + INSERT_PTR(node); + TREE_NBITS(node) = nbits = (*tree_type_ptr == '1') ? 1 : nbits; + + break; + + case 'r': + if (code == POSEDGE_EXPR || code == NEGEDGE_EXPR) + TREE_OPERAND(node, 1) = (tree) X; + reserve_stack_space(TREE_SUB_LABEL(node), + fixup_nbits(TREE_OPERAND(node, 0)), + (nbits_t) 1); + if (TREE_REAL_ATTR(TREE_OPERAND(node, 0))) + error("Reduction not allowed on real numbers", NULL, NULL); + INSERT_PTR(node); + TREE_NBITS(node) = nbits = 1; + break; + + case 's': /* shift operations */ + TREE_NBITS(node) = nbits = fixup_nbits(SHIFT_OPERAND(node)); + SHIFT_NBITS(node) = ensure_stack_space(SHIFT_COUNT(node)); + if (SHIFT_NBITS(node) > MAX_BITS_IN_NUMBER) + error("Shift count must be within 32 bits", NULL_CHAR, + NULL_CHAR); + + if (TREE_REAL_ATTR(SHIFT_OPERAND(node)) + || TREE_REAL_ATTR(SHIFT_COUNT(node))) + error("Shift not allowed on real numbers", NULL, NULL); + + INSERT_PTR(node); + break; + + case 'u': + TREE_NBITS(node) = nbits = fixup_nbits(TREE_OPERAND(node, 0)); + TREE_REAL_ATTR(node) = TREE_REAL_ATTR(TREE_OPERAND(node, 0)); + TREE_INTEGER_ATTR(node) = + TREE_INTEGER_ATTR(TREE_OPERAND(node, 0)); + INSERT_PTR(node); + break; + + case 'c': + nbits = fixup_nbits(TREE_OPERAND(node, 0)); + + if (code == REAL_CONV_EXPR) { + /* It is possible that the operand is already real (function or + hierarchical name). If so, make it a nop. */ + if (TREE_REAL_ATTR(TREE_OPERAND(node, 0))) { + TREE_SET_CODE(node, NOP_EXPR); + TREE_NBITS(node) = nbits; + break; + } + TREE_NBITS(node) = nbits = 32; + } else + /* When converting to integer, let adjust_nbits fill in the correct + size */ + TREE_NBITS(node) = nbits = 1; + INSERT_PTR(node); + break; + + default: + TREE_NBITS(node) = nbits = fixup_nbits(TREE_OPERAND(node, 0)); + TREE_REAL_ATTR(node) = TREE_REAL_ATTR(TREE_OPERAND(node, 0)); + TREE_INTEGER_ATTR(node) = + TREE_INTEGER_ATTR(TREE_OPERAND(node, 0)); + INSERT_PTR(node); + break; + } /* switch 'e' */ + } + return nbits; +} + +/* Process lval; discard any generated code; set lval flag so the proper + concat code can be generated. */ + +void pass3_lval(tree * node) +{ + push_inst(); + /* Get here if lval is a hierarchical reference */ + if (TREE_CODE(*node) == IDENTIFIER_NODE && HIERARCHICAL_ATTR(*node)) { + tree t, t1; + + t = make_node(SHADOW_LVAL_REF); + t1 = resolve_hierarchical_name(*node); + REF_NAME(t) = *node; + TREE_CHAIN(t) = t1; + TREE_NBITS(t) = fixup_nbits(t1); + HIERARCHICAL_ATTR(t) = 1; + *node = t; + } else { + in_lval = 1; + pass3_node(*node); + in_lval = 0; + } + pop_inst(); +} + +/* This routine starts the expression re-parsing and returns a pointer + to the postfix sequence pointers. It also performs final type conversion + if requested and if necessary. (This used to be pass3_expra until + conversion was added. Now there is a wrapper for pass3_expr that calls + this). +*/ + +tree *pass3_expr_convert(tree node, enum convert_to convert_to) +{ + nbits_t nbits; + char *type = tree_code_type[TREE_CODE(node)]; + + /* initialize stack size for this expression */ + have_for_pad = 0; + have_for_push = stack_extension; + + nbits = fixup_nbits(node); + if (convert_to != eNONE) { + if (convert_to == eREAL && !TREE_REAL_ATTR(node)) { + node = build_unary_op(REAL_CONV_EXPR, node); + TREE_NBITS(node) = 32; + INSERT_PTR(node); + } + + else if (convert_to == eINT && TREE_REAL_ATTR(node)) { + node = build_unary_op(INT_CONV_EXPR, node); + TREE_NBITS(node) = 1; /* adjust_bits will change this */ + INSERT_PTR(node); + } + } + adjust_nbits(nbits, &node, (tree *) obstack_base(&inst_obstack)); + + if (*type != 'e' || (*++type != '1' && *type != 'r')) + reserve_stack_space(TREE_SUB_LABEL(node), nbits, nbits); + + /* If this is the largest stack size seen so far, make it so */ + if (have_for_pad + have_for_push > stack_size) { + stack_size = have_for_pad + have_for_push; + stack_lineno = lineno; /* save linenumber and filename of largest expr */ + stack_filename = input_filename; + } + stack_size = max(stack_size, have_for_pad + have_for_push); +#if VDEGUB != 0 + if (stack_size > 50) + fatal("Too big stack size at line %lu\n", (char *) lineno); +#endif + + /* save largest label encountered thus far */ + if (TREE_LABEL(node) > max_label) + max_label = TREE_LABEL(node); + + INSERT_PTR(NULL_TREE); /* zero for stop */ + + /* Save this in case the insts for this expression need to be + copied to alt_inst_obstack (i.e. for bit_refs) */ + last_inst_length = obstack_object_size(&inst_obstack); + return (tree *) obstack_finish(&inst_obstack); +} + +/* This is a wrapper for pass3_expr_convert. pass3_expr was changed to + pass3_expr_convert when the conversion aspect was added. Existing + calls to pass3_expr did not have to be changed to add arguments. +*/ + +tree *pass3_expr(tree node) +{ + return pass3_expr_convert(node, eNONE); +} + +/* This is like pass3_expr_convert, except convert op1 to be the same + type as op2. op2 is assumed to have already been through pass3_expr + so its type is known. +*/ + +tree *pass3_expr_match_convert(tree op1, tree op2) +{ + if (TREE_REAL_ATTR(op2)) + return (pass3_expr_convert(op1, eREAL)); + else + return (pass3_expr_convert(op1, eINT)); +} + +/* This is like pass3_expr, except that it is used to generate instructions + for an expression while processing another expression. For example, + bit-select and array index expressions need to be evaluated during the + of the expression the variable are used in. Also, conditionals (?:), + &&/||, concatentations, and function arguments call this. Note that + there are two flavors that have a subtile diffenece. One case will + restore the current expression's stack size at the end of the re-parse -- + this is the most common usage; the other does not -- this is used for + (?:) expressions where the size of evaluating the result needs to + be factored into the rest of the expression. */ + +tree *pass3_expr_intrude(tree node, int restore_stack) +{ + tree *finish, *tmp; + int finish_size; + + push_inst(); /* start another sequence of insts */ + if (restore_stack) + ensure_stack_space(node); + else + fixup_nbits(node); + INSERT_PTR(NULL_TREE); /* generate stop */ + finish_size = obstack_object_size(&inst_obstack); + finish = (tree *) obstack_finish(&inst_obstack); + + obstack_grow(&alt_inst_obstack, finish, finish_size); + tmp = (tree *) obstack_finish(&alt_inst_obstack); + pop_inst(); + return tmp; +} + +/* While expanding expression, create markers for each reference */ + +tree *pass3_expr_marker(tree node, Marker ** marker_ptr, + enum marker_flags flags, tree info, + tree convert_to) +{ + tree *expr; + Marker *marker; + + marker_info.in_event = 1; + marker_info.first = NULL; + marker_info.last = NULL; + marker_info.flags = flags; + marker_info.delay = NULL; + + if (TREE_CODE(node) != EVENT_DECL) { + if (convert_to) + expr = pass3_expr_match_convert(node, convert_to); + else + expr = pass3_expr(node); + } else { + marker_info.flags = + (enum marker_flags) (~M_TEST & marker_info.flags); + BuildMarker(node, &marker_info); + expr = NULL; + } + + marker_info.in_event = 0; + + /* now that expression is re-parsed, scan all of the generated markers + and add the pointer to the expression and make the list of markers + circular */ + if (marker_info.first) { /* NULL if constant expression */ + for (marker = marker_info.first; marker->link; + marker = marker->link) { + if (info == NULL) + marker->expr.expr = expr; /* In most cases, put expr code in marker */ + else + marker->expr.tree = info; /* But, somtimes use it for monitor, gates */ + } + if (info == NULL) + marker->expr.expr = expr; + else + marker->expr.tree = info; + + /* if other markers there, append these news ones */ + if (*marker_ptr) { + for (marker = *marker_ptr; marker->link != *marker_ptr; marker = marker->link); /* gets to end of list */ + marker->link = marker_info.first; /* append */ + marker_info.last->link = *marker_ptr; /* make circular */ + } else { + marker->link = marker_info.first; /* Make list circular */ + *marker_ptr = marker_info.first; + } + } + + return expr; +} + + +void pass3_delay(tree node) +{ + unsigned int i; + + if (!node) + return; + + for (i = 0; i < TREE_LABEL(node); i++) { + if (TREE_OPERAND(node, i)) { +// TREE_OPERAND (node, i + 3) = (tree) pass3_expr (TREE_OPERAND (node, i)); + TREE_OPERAND(node, i + 3) = + (tree) timescale_scale(TREE_OPERAND(node, i)); + } + } +} + +/* There are several cases for assignments. The simple case is a simple + a = b assignment. The second case is a continuous assignment. The + third case is a continuous assignment with a delay. The fourth case + is a procedural assignment with an event (not yet implemented). + Return true if the lval and the rval are the same size before adjusting + (needed for port discrepancy warning) */ + + +int pass3_assignment(tree node) +{ + nbits_t nbits; + enum tree_code code = TREE_CODE(node); + +/* First, process lval */ + /* If this is a cont assignment w/delay, then there is two assignments + with a temp var in the middle. Note that net assignments w/delay + only have one assignment. Allocate storage for it and make code for + its rval + in the second assignment (pointed to by TREE_CHAIN) */ + + if (code == ASSIGN_CONT_STMT) { + pass3_delay(STMT_ASSIGN_DELAY(node)); + if (TREE_CHAIN(node) + && TREE_CODE(TREE_CHAIN(node)) == ASSIGN_CONT_STMT) { + pass3_lval(&STMT_ASSIGN_LVAL(TREE_CHAIN(node))); + TREE_NBITS(STMT_ASSIGN_LVAL(node)) = + TREE_NBITS(STMT_ASSIGN_LVAL(TREE_CHAIN(node))); + pass3_decl(STMT_ASSIGN_LVAL(node)); + STMT_ASSIGN_RVAL_CODE(TREE_CHAIN(node)) = + pass3_expr(STMT_ASSIGN_LVAL(node)); + marker_info.current_scb = BuildSCB(TREE_CHAIN(node), NOLIST); + marker_info.last = NULL; + marker_info.first = NULL; + marker_info.delay = STMT_ASSIGN_DELAY(node); + marker_info.flags = (enum marker_flags) (M_FIXED + M_CONT); + BuildMarker(STMT_ASSIGN_LVAL(node), &marker_info); + } + } + + global_cont_assign = node; + pass3_lval(&STMT_ASSIGN_LVAL(node)); + nbits = TREE_NBITS(STMT_ASSIGN_LVAL(node)); + +// pass3_early_both_conversion (&STMT_ASSIGN_RVAL (node), STMT_ASSIGN_LVAL (node)); + if (code == ASSIGN_STMT + || code == ASSIGN_EVENT_STMT || code == ASSIGN_DELAY_STMT + || code == ASSIGN_NONBLK_EVENT_STMT + || code == ASSIGN_NONBLK_DELAY_STMT) + STMT_ASSIGN_RVAL_CODE(node) = + pass3_expr_match_convert(STMT_ASSIGN_RVAL(node), + STMT_ASSIGN_LVAL(node)); + +/* if continuous assignment, generate markers with the rval. */ + + else if (code == ASSIGN_CONT_STMT) { + STMT_ASSIGN_RVAL_CODE(node) = + pass3_expr_marker(STMT_ASSIGN_RVAL(node), + &STMT_ASSIGN_EVENT_LIST(node), + (enum marker_flags) (M_FIXED + M_CONT), node, + STMT_ASSIGN_LVAL(node)); + } + + else if (code == ASSIGN_PROC_STMT || FORCE_STMT) { /* Procedural cont assign */ + /* if lval is hierarchical, use the actual decl */ + tree lval = the_lval(STMT_ASSIGN_LVAL(node)); + + STMT_ASSIGN_RVAL_CODE(node) = + pass3_expr_marker(STMT_ASSIGN_RVAL(node), + &STMT_ASSIGN_EVENT_LIST(node), + M_CONT, node, lval); + + /* Generate a marker for the lval, thread it in at the beginning + and make the last market point to the new first marker. + Note that all the markers point back to the continuous assignment. + */ + + { + Marker *last = marker_info.last; + + marker_info.first = marker_info.last = NULL; + /* if lval is a shadow, then it was a hierarchical reference; + point to the original node. */ + BuildMarker(lval, &marker_info); + marker_info.first->expr.tree = node; + marker_info.first->link = STMT_ASSIGN_EVENT_LIST(node); + STMT_ASSIGN_EVENT_LIST(node) = marker_info.first; + if (last) + last->link = marker_info.first; + else + STMT_ASSIGN_EVENT_LIST(node)->link = + STMT_ASSIGN_EVENT_LIST(node); + } + } +// if (nbits == TREE_NBITS (STMT_ASSIGN_RVAL (node))) + if (nbits == TREE_NBITS(*STMT_ASSIGN_RVAL_CODE(node))) + return 1; + else +// if (TREE_CHAIN (node) && TREE_CODE (TREE_CHAIN (node)) == ASSIGN_CONT_STMT) +// adjust_nbits (nbits, &STMT_ASSIGN_RVAL (TREE_CHAIN (node))); +// else + + adjust_nbits(nbits, &STMT_ASSIGN_RVAL(node), + STMT_ASSIGN_RVAL_CODE(node)); + return 0; +} + +/* arg is a tree_list of arguments; port is a chain of decl_nodes */ + +void +pass3_args(tree arg_list, char *name, tree * inassign, tree * outassign, + tree port_list, int stack_args) +{ + tree arg, arg_tmp, port, *assign; + + port = port_list; + for (arg_tmp = arg_list; arg_tmp; + arg_tmp = TREE_CHAIN(arg_tmp), port = TREE_CHAIN(port)) { + arg = TREE_PURPOSE(arg_tmp); + if (!port) { + error + ("More TASK/FUNCTION arguments than in TASK/FUNCTION '%s'", + name, NULL_CHAR); + return; + } + if (PORT_INPUT_ATTR(port)) { + if (stack_args) + assign = pass3_expr_intrude(arg, 1); + else + assign = pass3_expr(arg); + + /* DECL_THREAD is the redefined version of the port */ + if (DECL_THREAD(port)) + adjust_nbits(TREE_NBITS(DECL_THREAD(port)), &arg, assign); + else + adjust_nbits(TREE_NBITS(port), &arg, assign); + *inassign = tree_cons((tree) assign, NULL_TREE, *inassign); + } + if (PORT_OUTPUT_ATTR(port)) { + if (!is_proc_lval(arg)) + error("Illegal expression connected to output port", + NULL_CHAR, NULL_CHAR); + else + pass3_lval(&arg); + *outassign = tree_cons(arg, NULL_TREE, *outassign); + } + } + if (port) { + error("Fewer TASK/FUNCTION arguments than in TASK/FUNCTION '%s'", + name, NULL_CHAR); + return; + } + if (inassign) + *inassign = nreverse(*inassign); + if (outassign) + *outassign = nreverse(*outassign); +} + +void pass3_delay_stmt(tree node) +{ + tree tmp_tree; + + STMT_DELAY_EXPR_CODE(node) = timescale_scale(STMT_DELAY_EXPR(node)); + tmp_tree = H_(*STMT_DELAY_EXPR_CODE(node), STMT_DELAY_EXPR(node)); +} + +void pass3_event_stmt(tree node) +{ + tree t; + + STMT_EVENT_MARKER(node) = NULL; + for (t = STMT_EVENT_EXPR_LIST(node); t; t = TREE_CHAIN(t)) + TREE_EXPR_CODE(t) = pass3_expr_marker(TREE_EXPR(t), + &STMT_EVENT_MARKER(node), + M_TEST, NULL_TREE, + NULL_TREE); +} + +/* Reparse a chain of statements, adding a pointer on the last statement's + TREE_CHAIN */ + +tree dump; /* initialized in pass3_tree to point to dump instruction */ +tree _return; /* initialized in pass3_node to point to return instruction */ +tree dummy_return; /* initialized in pass3_tree for disable stmt support */ +SCB *finish_scb; + + +void pass3_node(tree node) +{ + pass3_node_tail(node, NULL_TREE); +} + +void pass3_node_tail(tree node, tree label) +{ + enum tree_code code = TREE_CODE(node); + tree t, t1, alt_chain, prev, tmp_tree; + extern void print_common(); + +#if VDEBUG != 0 + if (vdebug) + printf("pass3: Node: %s @ %p, chain %p\n", + tree_code_name[code], node, TREE_CHAIN(node)); +#endif +//HEAPTEST ("Heap corrupted (in beginning of pass3)"); + + switch (*tree_code_type[code]) { + case ('b'): + +/* Scan Module */ + + if (code == MODULE_BLOCK && !UDP_ATTR(node)) { +// current_scope = node; + set_scope(node); +// current_pass3_module = node; + + + +/* Scan continuous assignments */ + + for (t = MODULE_ASSIGNMENTS(node); t; t = TREE_CHAIN(t)) { + lineno = STMT_SOURCE_LINE(TREE_PURPOSE(t)); + input_filename = STMT_SOURCE_FILE(TREE_PURPOSE(t)); + pass3_assignment(TREE_PURPOSE(t)); + } + +/* insert specify paths */ + + insert_specify_paths(node); + +/* now actually process specify paths */ + + for (t = BLOCK_BODY(node); t; t = TREE_CHAIN(t)) + if (TREE_CODE(t) == GATE_INSTANCE) { + pass3_specify(t); + } + +/* Scan timing checks */ + + for (t = MODULE_SPECDEFS(node); t; t = TREE_CHAIN(t)) { + if (TREE_CODE(t) == CHECK_SPEC) { + pass3_timing_check(t, node); + } + } + +/* Scan INITIAL and ALWAYS blocks ignoring gates */ + + for (t = BLOCK_BODY(node); t; t = TREE_CHAIN(t)) + if (TREE_CODE(t) == INSTANCE_NODE && !UDP_ATTR(t)) + pass3_node(INSTANCE_BLOCK(t)); + else if (TREE_CODE(t) == GATE_INSTANCE) + pass3_gate(t); + else if (TREE_CODE(t) != INSTANCE_NODE) + pass3_node(TREE_PURPOSE(t)); + +/* Scan functions and tasks within current module */ + + for (t = BLOCK_DOWN(node); t; t = TREE_CHAIN(t)) + if (TREE_CODE(t) != MODULE_BLOCK) + pass3_node(t); + + current_scope = pop_scope(); + } + /* MODULE */ + else if (code == TASK_BLOCK || code == FUNCTION_BLOCK) { +// current_scope = node; + set_scope(node); + + TASK_OUTPUT(node) = TASK_INPUT(node) = NULL; + for (t = BLOCK_PORTS(node); t; t = TREE_CHAIN(t)) { + /* Input is an lvalue */ + if (PORT_INPUT_ATTR(t)) { + push_inst(); + if (PORT_REDEFINED_ATTR(t)) /* re-decl'ed port */ + TASK_INPUT(node) = + tree_cons(DECL_THREAD(t), NULL_TREE, + TASK_INPUT(node)); + else + TASK_INPUT(node) = + tree_cons(t, NULL_TREE, TASK_INPUT(node)); + pop_inst(); + } + /* Output is an rvalue */ + if (PORT_OUTPUT_ATTR(t)) { + if (PORT_REDEFINED_ATTR(t)) /* re-decl'ed port */ + TASK_OUTPUT(node) = + tree_cons((tree) pass3_expr(DECL_THREAD(t)), + NULL_TREE, TASK_OUTPUT(node)); + else + TASK_OUTPUT(node) = + tree_cons((tree) pass3_expr(t), NULL_TREE, + TASK_OUTPUT(node)); + } + } + if (TREE_CODE(node) != TASK_BLOCK + && TREE_CODE(node) != FUNCTION_BLOCK) + fatal("oops", NULL); + if (!node) + fatal("oops!", NULL); + TASK_OUTPUT(node) = nreverse(TASK_OUTPUT(node)); + TASK_INPUT(node) = nreverse(TASK_INPUT(node)); + + /* Scan body of task or function. */ + if (code == FUNCTION_BLOCK) { + int max_label_save; + ngroups_t stack_size_save; + +// FUNCT_DECL_CODE (node) = pass3_expr (FUNCT_DECL (node)); + TREE_NBITS(node) = TREE_NBITS(FUNCT_DECL(node)); + + stack_size_save = stack_size; + max_label_save = max_label; + max_label = 0; + stack_size = 0; + pass3_node_tail(BLOCK_BODY(node), node); + TREE_LABEL(node) = max_label + 2 + 4; + FUNCT_AREA(node) = stack_size + 1 + 10; + stack_size = stack_size_save; + max_label = max_label_save; + } else /* TASK_BLOCK */ + pass3_node_tail(BLOCK_BODY(node), node); + current_scope = pop_scope(); + } + /* TASK, FUNCTION */ + else if (code == NAMED_BLOCK) + break; + else + goto default1; + break; + + case ('e'): + case ('r'): + case ('d'): + fixup_nbits(node); + break; + + case ('s'): + for (; node; node = TREE_CHAIN(node)) { + code = TREE_CODE(node); + prev = node; + lineno = STMT_SOURCE_LINE(node); + input_filename = STMT_SOURCE_FILE(node); + alt_chain = TREE_CHAIN(node); + /* this makes sure that statments that use STMT_BODY and whose + statements then merge with TREE_CHAIN will correctly propigate + the label if the statement is last in a list (else, the end + of STMT_BODY will have NULL instead of the correct label) */ + if (!alt_chain) + alt_chain = label; + + switch (code) { + case (ALWAYS_BLOCK): + marker_info.current_scb = BuildSCB(node, READY_LIST); + pass3_node_tail(STMT_BODY(node), node); + break; + + case (INITIAL_BLOCK): + marker_info.current_scb = BuildSCB(node, READY_LIST); + pass3_node_tail(STMT_BODY(node), dump); + break; + + case (BEGIN_STMT): + pass3_node_tail(STMT_BODY(node), alt_chain); + break; + + case BEGIN_NAMED_STMT: + set_scope(STMT_BLOCK(node)); + pass3_node_tail(STMT_BODY(node), alt_chain); + current_scope = pop_scope(); + break; + + /* Unlike the BEGIN stmt, the body of FORK first has the accompanying + JOIN stmt and then a TREE_LIST(!) of statements. Make each + stamtement point to the JOIN and them move the JOIN to the end of + FORK. Note that the statements on the body might be BEGIN/END + or nested FORK/JOIN. */ + case FORK_NAMED_STMT: + set_scope(STMT_BLOCK(node)); + case FORK_STMT: + t1 = STMT_BODY(node); /* Points to JOIN */ + for (t = TREE_CHAIN(t1); t; t = TREE_CHAIN(t)) + pass3_node_tail(TREE_PURPOSE(t), t1); + + /* first stmt in chain is always the JOIN stmt. */ + STMT_BODY(node) = TREE_CHAIN(t1); /* take JOIN out of list */ + TREE_CHAIN(t1) = TREE_CHAIN(node); /* Thread JOIN in after FORK */ + TREE_CHAIN(node) = t1; + STMT_JOIN_FORK(t1) = node; /* Make join point to fork */ + if (code == FORK_NAMED_STMT) + current_scope = pop_scope(); + break; + + case END_STMT: + case END_NAMED_STMT: + case JOIN_STMT: + case JOIN_NAMED_STMT: +// case DUMP_STMT: /* doesn't get here often: initial #t stmt; */ + break; + + case ASSIGN_STMT: + case ASSIGN_PROC_STMT: + case FORCE_STMT: + pass3_assignment(node); + break; + + case ASSIGN_DELAY_STMT: + case ASSIGN_EVENT_STMT: + pass3_assignment(node); + STMT_ASSIGN_TMP(node) = make_node(TMP_DECL); + TREE_CHAIN(STMT_ASSIGN_TMP(node)) = STMT_ASSIGN_LVAL(node); + pass3_decl(STMT_ASSIGN_TMP(node)); + STMT_ASSIGN_TMPCODE(node) = + pass3_expr(STMT_ASSIGN_TMP(node)); + if (code == ASSIGN_DELAY_STMT) + pass3_delay_stmt(STMT_ASSIGN_DELAY(node)); + else + pass3_event_stmt(STMT_ASSIGN_EVENT(node)); + break; + + case ASSIGN_NONBLK_DELAY_STMT: + case ASSIGN_NONBLK_EVENT_STMT: + pass3_assignment(node); + if (code == ASSIGN_NONBLK_DELAY_STMT) + pass3_delay_stmt(STMT_ASSIGN_DELAY(node)); + else { + SCB *save_scb = marker_info.current_scb; + + STMT_ASSIGN_TMP(node) = make_node(TMP_DECL); + TREE_CHAIN(STMT_ASSIGN_TMP(node)) = + STMT_ASSIGN_LVAL(node); + pass3_decl(STMT_ASSIGN_TMP(node)); + STMT_ASSIGN_TMPCODE(node) = + pass3_expr(STMT_ASSIGN_TMP(node)); + + marker_info.current_scb = BuildSCB(node, NOLIST); + pass3_event_stmt(STMT_ASSIGN_EVENT(node)); + STMT_ASSIGN_SCB(node) = marker_info.current_scb; + marker_info.current_scb = save_scb; + } + break; + + case (IF_STMT): +//HEAPTEST ("Heap corrupted (in pass3 -- if)"); + STMT_COND_CODE(node) = pass3_expr(STMT_COND(node)); + pass3_node_tail(STMT_THEN(node), alt_chain); + if (STMT_ELSE(node)) { + pass3_node_tail(STMT_ELSE(node), alt_chain); + } + break; + + case (WHILE_STMT): + STMT_WHILE_COND_CODE(node) = + pass3_expr(STMT_WHILE_COND(node)); + pass3_node_tail(STMT_BODY(node), node); + break; + + case (REPEAT_INIT_STMT): + /* stmt_body points to repeat_init node */ + STMT_REPEAT_EXPR_CODE(node) = + pass3_expr(STMT_REPEAT_EXPR(node)); + tmp_tree = + H_(*STMT_REPEAT_EXPR_CODE(node), + STMT_REPEAT_EXPR(node)); + if (TREE_NBITS(tmp_tree) > MAX_BITS_IN_NUMBER) + error("REPEAT expression must be within 32 bits", + NULL_CHAR, NULL_CHAR); + STMT_REPEAT_VAR(node) = + (Group *) xmalloc(sizeof(Group) * + (1 + + bits_to_groups(TREE_NBITS + (tmp_tree)))); + + pass3_node_tail(STMT_BODY(node), alt_chain); + break; + + case REPEAT_STMT: + /* inherit values from REPEAT_INIT */ + STMT_REPEAT_EXPR_CODE(node) = + STMT_REPEAT_EXPR_CODE(STMT_BODY(node)); + STMT_REPEAT_VAR(node) = STMT_REPEAT_VAR(STMT_BODY(node)); + STMT_BODY(node) = STMT_BODY(STMT_BODY(node)); + break; + + case (FOR_STMT): + pass3_node(STMT_FOR_ASSIGN(node)); + if (!STMT_SURROGATE_ATTR(node)) { /* just do this once */ + STMT_FOR_COND_CODE(node) = + pass3_expr(STMT_FOR_COND(node)); + pass3_node_tail(STMT_BODY(node), alt_chain); + } + /* If this is the iteration part, TREE_CHAIN is pointing to + the initial part. Make TREE_CHAIN point to the same place + as the initial part is pointing. */ + else { + STMT_FOR_COND_CODE(node) = + STMT_FOR_COND_CODE(TREE_CHAIN(node)); + STMT_BODY(node) = STMT_BODY(TREE_CHAIN(node)); + TREE_CHAIN(node) = NULL_TREE; /* Let tail fix this */ + } + break; + + case FOREVER_STMT: + pass3_node_tail(STMT_BODY(node), node); + break; + + case CASE_STMT: + case CASEX_STMT: + case CASEZ_STMT: + STMT_CASE_EXPR_CODE(node) = + pass3_expr(STMT_CASE_EXPR(node)); + { + tree tmp_tree = + H_(*STMT_CASE_EXPR_CODE(node), + STMT_CASE_EXPR(node)); + nbits_t nbits = TREE_NBITS(tmp_tree); + ngroups_t ngroups = 1 + bits_to_groups(nbits); + + stack_extension += ngroups; + for (t = STMT_CASE_LIST(node); t; t = TREE_CHAIN(t)) { + /* evaluate the expressions */ + for (t1 = TREE_PURPOSE(t); t1; t1 = TREE_CHAIN(t1)) { + TREE_EXPR_CODE(t1) = pass3_expr(TREE_EXPR(t1)); +/********** THIS BREAKS IF EXPR IS LARGER THAN CASE_EXPR!!! */ + adjust_nbits(nbits, &TREE_EXPR(t1), + TREE_EXPR_CODE(t1)); + } + pass3_node_tail(TREE_VALUE(t), alt_chain); + } + if (STMT_CASE_DEFAULT(node)) + pass3_node_tail(STMT_CASE_DEFAULT(node), + alt_chain); + + stack_extension -= ngroups; + } + break; + + case DELAY_STMT: + pass3_delay_stmt(node); + pass3_node_tail(STMT_BODY(node), alt_chain); + break; + + case (WAIT_STMT): + STMT_WAIT_MARKER(node) = NULL; + STMT_WAIT_EXPR_CODE(node) = + pass3_expr_marker(STMT_WAIT_EXPR(node), + &STMT_WAIT_MARKER(node), M_PLAIN, + NULL_TREE, NULL_TREE); + pass3_node_tail(STMT_BODY(node), alt_chain); + break; + + case EVENT_STMT: + pass3_event_stmt(node); + pass3_node_tail(STMT_BODY(node), alt_chain); + break; + + case ARROW_STMT: + if (HIERARCHICAL_ATTR(STMT_ARROW_NAME(node))) + STMT_ARROW_EVENT(node) = double_check_named_event + (resolve_hierarchical_name(STMT_ARROW_NAME(node))); + else + STMT_ARROW_EVENT(node) = STMT_ARROW_NAME(node); + break; + + case (DISABLE_BLOCK_STMT): + case (DISABLE_TASK_STMT): + pass3_node(STMT_BODY(node)); + break; + + case DISABLE_STMT: + if (HIERARCHICAL_ATTR(node)) + t = search_scope(IDENTIFIER_POINTER + (STMT_DISABLE_NAME(node)), 0); + else { + t = double_check_block(STMT_DISABLE_NAME(node)); + } + if (!t) { + error("Undefined scope '%s' cannot be disabled", + IDENT(STMT_DISABLE_NAME(node)), NULL_CHAR); + break; + } + STMT_DISABLE_SCOPE(node) = t; + break; + + case (DEASSIGN_STMT): +// pass3_node (STMT_BODY (node)); +// break; + + case (RELEASE_STMT): +// pass3_node (STMT_BODY (node)); + pass3_lval(&STMT_BODY(node)); + break; + + case TASK_STMT: + if (HIERARCHICAL_ATTR(node)) + t = search_scope(STMT_TASK_NAME(node), 0); + else + t = lookdown_scope(STMT_TASK_NAME(node), + module_of(current_scope)); + if (!t || TREE_CODE(t) != TASK_BLOCK) { + error("Task '%s' not defined", STMT_TASK_NAME(node), + NULL_CHAR); + break; + } + STMT_TASK_INASSIGN(node) = NULL_TREE; + STMT_TASK_OUTASSIGN(node) = NULL_TREE; + STMT_TASK_TASK(node) = t; + if (STMT_TASK_ARGS(node)) + pass3_args(STMT_TASK_ARGS(node), STMT_TASK_NAME(node), + &STMT_TASK_INASSIGN(node), + &STMT_TASK_OUTASSIGN(node), BLOCK_PORTS(t), + 0); + break; + + case SYSTASK_STMT: + { + p_tfcell p_tf; + enum systask_type systask; + systask = lookup_systask(STMT_TASK_NAME(node), &p_tf); + if (systask == -1) { + if (lookup_sysfunction(STMT_TASK_NAME(node), &p_tf) + != -1) + error + ("'%s' is a function; it cannot be called as a task", + STMT_TASK_NAME(node), NULL_CHAR); + else + error("Unknown system task '%s'", + STMT_TASK_NAME(node), NULL_CHAR); + break; + } + SET_STMT_SYSTASK_TYPE(node, systask); + STMT_SYSTASK_USERTF(node) = p_tf; + init_systask(node); + } + break; + + case NULL_STMT: + break; + + case LOOPBACK_STMT: + /* if points to CASE, then chance to point to what CASE pointes to */ + if (TREE_CODE(STMT_BODY(node)) == CASE_STMT || + TREE_CODE(STMT_BODY(node)) == CASEX_STMT || + TREE_CODE(STMT_BODY(node)) == CASEZ_STMT) + STMT_BODY(node) = TREE_CHAIN(STMT_BODY(node)); + break; + + default: +#if VDEBUG != 0 + printf_error_V("unimplemented PASS3 instruction:"); + print_common(node); +#else + fatal + ("Internal error: Attempt to reparse unknown structure", + NULL_CHAR); +#endif + } /* switch */ + +//HEAPTEST ("Heap corrupted (in pass3 -- end of stmts)"); + + } /* for (do next statement) */ + TREE_CHAIN(prev) = label; + break; + + case ('x'): +#if VDEBUG != 0 + if (code == ERROR_MARK) + printf_error_V("line: %lu error_mark\n", lineno); + else { + printf_error_V("Unimplemented PASS3 x\n"); + print_common(node); + } +#else + fatal + ("Fatal error: unexpected structure encountered during Phase III", + NULL_CHAR); +#endif + + break; + + default: + default1: +#if VDEBUG != 0 + print_common(node); + fatal("Fatal: Unexpected structure encountered during Phase III", + NULL_CHAR); +#else + printf("Printing something here...\n"); + printf("node = %p\n", node); + fatal + ("Fatal: ...Unexpected structure encountered during Phase III", + NULL_CHAR); +#endif + } +} + +void connect_instances(tree module) +{ + tree t, arg; + int port_count, even; + + current_scope = module; /* Instance args could be hierarchical names */ + for (t = MODULE_INSTANCES(module); t; t = TREE_CHAIN(t)) + if (TREE_CODE(t) == INSTANCE_NODE && !UDP_ATTR(t)) { + port_count = 1; + for (arg = INSTANCE_PORTS(t); arg; + arg = TREE_CHAIN(arg), port_count++) + if (TREE_3RD(arg)) { + even = 1; + /* input port */ + if (TREE_PURPOSE(TREE_3RD(arg))) + even = + pass3_assignment(TREE_PURPOSE(TREE_3RD(arg))); + /* output port */ + if (TREE_VALUE(TREE_3RD(arg))) + even &= + pass3_assignment(TREE_VALUE(TREE_3RD(arg))); + if (!even) { + lineno = STMT_SOURCE_LINE(t); + input_filename = STMT_SOURCE_FILE(t); + warning("Port sizes don't match in port #%d", + (char *) port_count, NULL_CHAR); + } + } + /* Recursively connect modules below this one */ + connect_instances(INSTANCE_BLOCK(t)); + } +} + +void pass3_tree(tree node) +{ + tree t; + + tree finish_stmt = build_stmt(FINISH_STMT, NULL); + + /* Dummy finish SCB is used so that there will be a command-line + prompt after the last stmt if the last stmt causes a call to + dispatch. */ + current_scope = NULL; + finish_scb = BuildSCB(finish_stmt, NOLIST); + dump = build_stmt(DUMP_STMT, NULL); + dummy_return = build_stmt(DUMMY_RETURN_STMT, NULL); + + for (t = node; t; t = TREE_CHAIN(t)) + pass3_node(t); + + for (t = node; t; t = TREE_CHAIN(t)) + connect_instances(t); + +} + +void pass3_interactive(tree node) +{ + pass3_node_tail(node, dump); +} + +/******************************************************************** + * + * init_pass3 + * - initialize global and static variables for pass3.c + * + ******************************************************************** + */ + +void init_pass3() +{ + in_lval = 0; /* set if processing lvalue (used in concat) */ + in_connect_ports = 0; /* set if building port connections */ + stack_size = 0; + stack_extension = 0; + max_label = 0; + debug_ = 0; + debug_tree = NULL_TREE; + memset(&inst_obstack, 0, sizeof(inst_obstack)); + memset(&alt_inst_obstack, 0, sizeof(alt_inst_obstack)); + memset(&marker_info, 0, sizeof(marker_info)); + last_inst_length = 0; + have_for_push = 0; + have_for_pad = 0; + stack_lineno = 0; + stack_filename = NULL; + debug_node = NULL_TREE; + global_cont_assign = NULL_TREE; + memset(&inst_stack, 0, sizeof(inst_stack)); + memset(&stack_size_stack, 0, sizeof(stack_size_stack)); + dump = NULL_TREE; + _return = NULL_TREE; + dummy_return = NULL_TREE; + memset(&finish_scb, 0, sizeof(finish_scb)); +} diff --git a/src/pass3.h b/src/pass3.h new file mode 100644 index 0000000..70b3613 --- /dev/null +++ b/src/pass3.h @@ -0,0 +1,85 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* PASS3.H - Prototypes for pass3.c */ + +#ifndef PASS3_H +#define PASS3_H + +/* Used to tell pass3_expr to make a conversion, if necessary */ + +enum convert_to { eNONE, eREAL, eINT }; + +extern tree dump; // common dump block + + +// public exports + +tree *pass3_expr(tree); +tree *pass3_expr_convert(tree, enum convert_to); +void push_inst(void); +void pop_inst(void); +void push_stack_size(void); +void pop_stack_size(void); +void stack_allocate(void); +tree module_of(tree scope); +tree lookdown_scope(char *ident, tree scope); +void maybe_build_marker(tree decl); +nbits_t get_range(tree node, char *ident); +Group *get_const(tree node, nbits_t *); +Bit get_delay(tree); +int pass3_early_conversion(tree * op1_ptr, tree op2); +int pass3_early_both_conversion(tree * op1_ptr, tree op2); +int pass3_late_conversion(tree * op1_ptr, tree op2, int code_offset); +nbits_t fixup_nbits(tree node); +void pass3_lval(tree * node); +tree *pass3_expr(tree node); +tree *pass3_expr_intrude(tree node, int restore_stack); +tree *pass3_expr_marker(tree node, Marker ** marker_ptr, + enum marker_flags flags, tree info, tree); +void pass3_delay(tree node); +int pass3_assignment(tree node); +void pass3_args(tree arg_list, char *name, tree * inassign, + tree * outassign, tree port_list, int stack_args); +void pass3_delay_stmt(tree node); +void pass3_event_stmt(tree node); +void pass3_node(tree node); +void pass3_node_tail(tree node, tree label); +void connect_instances(tree module); +void pass3_tree(tree node); +void pass3_interactive(tree node); +void init_pass3(void); +void adjust_nbits(nbits_t nbits, tree * tree_addr, tree * code_base); + +// private declarations +#ifdef PASS3_C + +static nbits_t ensure_stack_space(tree node); +static void reserve_stack_space(int number, nbits_t nbits_push, + nbits_t nbits_pad); +static nbits_t fixup_reference(tree node); +static struct part_info *cook_part_ref(nbits_t offset_high, + nbits_t offset_low, int concat); +static nbits_t pass3_hierarchy(tree); + +tree *pass3_expr_match_convert(tree op1, tree op2); + +#endif // PASS3_C + +#endif // PASS3_H diff --git a/src/pli.cc b/src/pli.cc new file mode 100644 index 0000000..11c23d7 --- /dev/null +++ b/src/pli.cc @@ -0,0 +1,7445 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* PLI.C - Programming language interface support routines */ + +#define PLI_C + +#include +#include +#include +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "glue.h" +#include "decl.h" +#include "veriuser.h" +#include "acc_user.h" +#include "pli.h" +#include "schedule.h" +#include "io.h" +#include "print.h" +#include "strobe.h" +#include "systask.h" +#include "scope.h" +#include "pass3.h" +#include "parse.h" +#include "runtime.h" +#include "eval.h" +#include "veriwell.h" +#include "store.h" +#include "specify.h" +#include "timescal.h" +#include "pass2.h" +#include "flags.h" +#include "multdiv.h" +#include "nsched.h" +#include "lex.h" + + +#ifndef min +#define min(a,b) ((a)<(b)?(a):(b)) +#endif // min + +#ifndef max +#define max(a,b) ((a)>(b)?(a):(b)) +#endif // max + +#define avg(a,b) (((a)+(b))/2) + +typedef enum { eMapMax, eMapMin, eMapLatest } MapToMipd_t; +typedef enum + { eDelayAverage, eDelayMax, eDelayMin, eDelayFromUser } ToHiZDelay_t; +struct pli_global_info { + char *stringbuf; /* beginning of buffer */ + char *p; /* current pointer */ + char *lastCopy; /* pointer to begin of last copied string */ + int stringbuf_size; /* size of buffer */ + handle scope; /* scope for acc_handle_object */ + char *text; /* used for buffer for tf_text */ + char *nextText; /* points to next useable location */ + int textSize; /* size of text buffer */ + struct { + int accDefaultAttr0_; + char accDevelopmentVersion_[256]; + int accDisplayWarnings_; + int accDisplayErrors_; + int accEnableArgsModpath_; + int accEnableArgsTchk_; + int accEnableArgsSetScope_; + MapToMipd_t accMapToMipd_; + int accMinTypMaxDelays_; + int accPathDelayCount_; + char accPathDelimStr_[256]; + ToHiZDelay_t accToHiZDelay_; + } config; +} pli_info = { +NULL, NULL, 0}; + +int acc_error_flag = FALSE; +tree delayFreeList = NULL; +int lcbCount = 0; + + +/************************************************************************ + * support routines * +/***********************************************************************/ + +/************************************************************************ + * acc_initialize + *********************************************************************** * + */ + +int acc_initialize(void) +{ + acc_error_flag = FALSE; + pli_info.config.accDefaultAttr0_ = FALSE; + pli_info.config.accDisplayWarnings_ = 0; + pli_info.config.accDisplayErrors_ = 1; + pli_info.config.accEnableArgsModpath_ = FALSE; + pli_info.config.accEnableArgsTchk_ = FALSE; + pli_info.config.accEnableArgsSetScope_ = FALSE; + pli_info.config.accMapToMipd_ = eMapMax; + pli_info.config.accMinTypMaxDelays_ = FALSE; + pli_info.config.accPathDelayCount_ = 6; + pli_info.scope = (handle) current_scope; + strcpy(pli_info.config.accPathDelimStr_, "$"); + pli_info.config.accToHiZDelay_ = eDelayFromUser; + + if (pli_info.text == NULL) { + pli_info.textSize = 1024; + pli_info.text = (char *) xmalloc(pli_info.textSize); + if (pli_info.text == NULL) { + tf_error("Out of Memory"); + return (0); + } + } + if (pli_info.stringbuf == NULL) { + pli_info.stringbuf_size = 4096; + pli_info.stringbuf = + (char *) xmalloc(pli_info.stringbuf_size); + if (pli_info.stringbuf == NULL) { + tf_error("Out of Memory"); + return (0); + } + } + pli_info.p = pli_info.stringbuf; + pli_info.lastCopy = NULL; + pli_info.nextText = pli_info.text; + return (1); +} + +/************************************************************************ + init_pli + - initialize pli module +************************************************************************* +*/ + +void init_pli(void) +{ + strcpy(pli_info.config.accDevelopmentVersion_, "IEEE 1364 PLI 1.0"); + pli_info.p = NULL; + pli_info.lastCopy = NULL; + pli_info.stringbuf = NULL; + pli_info.stringbuf_size = 0; + pli_info.text = NULL; + pli_info.nextText = NULL; + pli_info.textSize = 0; + + delayFreeList = NULL; + + lcbCount = 0; + + acc_initialize(); +} + +/************************************************************************ + fetch_storage + Get the pointer to the storage of a decl, etc +************************************************************************* +*/ + +static Group *fetch_storage(tree object) +{ + return DECL_STORAGE(object); +} + +/********************************************************************* + nth_arg + - Generic routine for returning nth argument +**********************************************************************/ + +static tree nth_arg(int n, tree instance) +{ + tree arg; + + arg = nth_parameter(n, instance); + if (arg != NULL) { + return (TREE_PURPOSE(arg)); + } else { + return (NULL); + } +} + +/********************************************************************* + nth_parameter + - Generic routine for returning nth parameter +**********************************************************************/ + +static tree nth_parameter(int n, tree instance) +{ + int i; + int N = tf_inump((char *) instance); + tree arg; + + if (n < 1 || n > N) + return NULL; + + if (TREE_CODE(instance) == SYSTASK_STMT) + arg = STMT_TASK_ARGS(instance); + else if (TREE_CODE(instance) == SYSFUNCTION_REF) + arg = FUNC_REF_ARGS(instance); + + for (i = 1; i < n; i++, arg = TREE_CHAIN(arg)); + + return arg; +} + +/********************************************************************* + pli_write_string + - Write a string into the pli buffer, + return a pointer to the buffer. + if the buffer is full, sent a warning (if enabled) + and reset the buffer +**********************************************************************/ + + +static char *pli_write_string(char *string) +{ + int size; + char *p; + + if (string == NULL) { + pli_info.lastCopy = NULL; + return (pli_info.p); + } + + size = strlen(string); + if (pli_info.p + size + 1 > + pli_info.stringbuf + pli_info.stringbuf_size) { + tf_warning("String pointer being reset"); + pli_info.p = pli_info.stringbuf; + } + + strcpy(pli_info.p, string); + p = pli_info.p; + pli_info.p += size + 1; + + pli_info.lastCopy = p; + return p; +} + +/********************************************************************* + pli_append_string + - Append a string to the string currently in the pli buffer, + return a pointer to the start of the whole string. + if the buffer is full, sent a warning (if enabled) + and reset the buffer +**********************************************************************/ + + +static char *pli_append_string(char *string) +{ + int size; + char *p; + + + if (string == NULL) { + return pli_info.lastCopy; + } + + size = strlen(string); + if (pli_info.p + size + 1 > + pli_info.stringbuf + pli_info.stringbuf_size) { + tf_warning("String pointer being reset"); + pli_info.p = pli_info.stringbuf; + if (pli_info.lastCopy != NULL) { + strcpy(pli_info.stringbuf, pli_info.lastCopy); + pli_info.lastCopy = pli_info.stringbuf; + pli_info.p = + pli_info.stringbuf + strlen(pli_info.lastCopy) + 1; + } + } + + if (pli_info.lastCopy != NULL) { + pli_info.p--; + } else { + pli_info.lastCopy = pli_info.p; + } + + strcpy(pli_info.p, string); + p = pli_info.p; + pli_info.p += size + 1; + + return pli_info.lastCopy; +} + +/************************************************************************ + * acc_configure * +/***********************************************************************/ + +int acc_configure(int what, char *string) +{ + acc_error_flag = FALSE; + + switch (what) { + case accDefaultAttr0: + if (!strcmp(string, "true")) { + pli_info.config.accDefaultAttr0_ = TRUE; + } else if (!strcmp(string, "false")) { + pli_info.config.accDefaultAttr0_ = FALSE; + } else { + acc_error_flag = TRUE; + } + break; + + case accDevelopmentVersion: + if (strcmp(pli_info.config.accDevelopmentVersion_, string)) { + acc_error_flag = TRUE; + } + break; + + case accDisplayErrors: + if (!strcmp(string, "true")) { + pli_info.config.accDisplayErrors_ = TRUE; + } else if (!strcmp(string, "false")) { + pli_info.config.accDisplayErrors_ = FALSE; + } else { + acc_error_flag = TRUE; + } + break; + + case accDisplayWarnings: + if (!strcmp(string, "true")) { + pli_info.config.accDisplayWarnings_ = TRUE; + } else if (!strcmp(string, "false")) { + pli_info.config.accDisplayWarnings_ = FALSE; + } else { + acc_error_flag = TRUE; + } + break; + + case accEnableArgs: + if (!strcmp(string, "acc_handle_modpath")) { + pli_info.config.accEnableArgsModpath_ = TRUE; + } else if (!strcmp(string, "no_acc_handle_modpath")) { + pli_info.config.accEnableArgsModpath_ = FALSE; + } else if (!strcmp(string, "acc_handle_tchk")) { + pli_info.config.accEnableArgsTchk_ = TRUE; + } else if (!strcmp(string, "no_acc_handle_tchk")) { + pli_info.config.accEnableArgsTchk_ = FALSE; + } else if (!strcmp(string, "acc_set_scope")) { + pli_info.config.accEnableArgsSetScope_ = TRUE; + } else if (!strcmp(string, "no_acc_set_scope")) { + pli_info.config.accEnableArgsSetScope_ = FALSE; + } else { + acc_error_flag = TRUE; + } + break; + + case accMapToMipd: + if (!strcmp(string, "max")) { + pli_info.config.accMapToMipd_ = eMapMax; + } else if (!strcmp(string, "min")) { + pli_info.config.accMapToMipd_ = eMapMin; + } else if (!strcmp(string, "latest")) { + pli_info.config.accMapToMipd_ = eMapLatest; + } else { + acc_error_flag = TRUE; + } + break; + + case accMinTypMaxDelays: + if (!strcmp(string, "true")) { + pli_info.config.accMinTypMaxDelays_ = TRUE; + } else if (!strcmp(string, "false")) { + pli_info.config.accMinTypMaxDelays_ = FALSE; + } else { + acc_error_flag = TRUE; + } + break; + + case accPathDelayCount: + if (strlen(string) != 1) { + acc_error_flag = TRUE; + break; + } + switch (string[0]) { + case '1': + case '2': + case '3': + case '6': + pli_info.config.accPathDelayCount_ = atoi(string); + break; + default: + acc_error_flag = TRUE; + break; + } + break; + + case accPathDelimStr: + strncpy(pli_info.config.accPathDelimStr_, string, + sizeof(pli_info.config.accPathDelimStr_) - 1); + break; + + + case accToHiZDelay: + if (!strcmp(string, "average")) { + pli_info.config.accToHiZDelay_ = eDelayAverage; + } else if (!strcmp(string, "max")) { + pli_info.config.accToHiZDelay_ = eDelayMax; + } else if (!strcmp(string, "min")) { + pli_info.config.accToHiZDelay_ = eDelayMin; + } else if (!strcmp(string, "from_user")) { + pli_info.config.accToHiZDelay_ = eDelayFromUser; + } else { + acc_error_flag = TRUE; + } + break; + + default: + acc_error_flag = TRUE; + tf_error("Unknown configuration parameter %d in acc_configure", + what); + return (0); + } + + if (acc_error_flag) { + tf_error("Unknown configuration value \"%s\" in acc_configure", + string); + } + + return (acc_error_flag); +} + +/************************************************************************ + * acc_close * +/***********************************************************************/ + +void acc_close() +{ + acc_error_flag = FALSE; + acc_initialize(); + pli_info.scope = null; +} + +/************************************************************************ + acc_collect +************************************************************************* +*/ + +handle *acc_collect(handle(*nextFunction) (handle, handle), + handle reference, int *numberOfObjects) +{ + handle object; + handle *list; + int count; + int listLength; + + acc_error_flag = FALSE; + + listLength = 64; + list = (handle *) xmalloc(listLength * sizeof(handle *)); + count = 0; + object = NULL; + while (list != NULL) { + object = (nextFunction) (reference, object); + if (object == NULL) { + break; + } + if (count > listLength) { + listLength += 64; + list = + (handle *) xrealloc((char*)list, + listLength * sizeof(handle *)); + if (list == NULL) { + break; + } + } + list[count] = object; + count++; + + } + + if (list == NULL) { + count = 0; + acc_error_flag = TRUE; + tf_error("Memory allocation failed in acc_collect"); + } + + *numberOfObjects = count; + return (list); +} + +/************************************************************************ + acc_free +************************************************************************* +*/ +void acc_free(handle * list) +{ + acc_error_flag = FALSE; + free(list); +} + +/************************************************************************ + acc_count +************************************************************************* +*/ + +int acc_count(handle(*nextFunction) (handle, handle), handle reference) +{ + handle object; + int count; + + acc_error_flag = FALSE; + + count = 0; + object = NULL; + while (TRUE) { + object = (nextFunction) (reference, object); + if (object == NULL) { + break; + } + count++; + + } + + return (count); +} + +/************************************************************************ + acc_object_in_typelist +************************************************************************* +*/ + +bool acc_object_in_typelist(handle object, int *typeList) +{ + int *ptr; + + acc_error_flag = FALSE; + for (ptr = typeList; *ptr != 0; ptr++) { + if (acc_object_of_type(object, *ptr)) { + return (TRUE); + } + } + return (FALSE); +} + +/************************************************************************ + acc_object_of_type +************************************************************************* +*/ + +bool acc_object_of_type(handle object, int type) +{ + acc_error_flag = FALSE; + + /* check type first */ + + if (acc_fetch_type(object) == type) { + return (TRUE); + } + + /* check full type next */ + + if (acc_fetch_fulltype(object) == type) { + return (TRUE); + } + + /* check propertys next */ + + switch (type) { + case accScalar: + return (is_scalar(object)); + case accVector: + return (is_vector(object)); + case accCollapsedNet: + return (is_collapsed(object)); + case accExpandedVector: + return (is_expanded(object)); + case accUnexpandedVector: + return (!is_expanded(object) && is_vector(object)); + } + + return (FALSE); +} + +/************************************************************************ + is_scalar + returns true if object is scalar +************************************************************************* +*/ + +static int is_scalar(handle object) +{ + int type; + + type = acc_fetch_type(object); + switch (type) { + case accNet: + case accPort: + case accRegister: + return (acc_fetch_size(object) == 1); + } + return (FALSE); +} + +/************************************************************************ + is_vector + returns true if object is vector +************************************************************************* +*/ + +static int is_vector(handle object) +{ + int type; + + type = acc_fetch_type(object); + switch (type) { + case accNet: + case accPort: + case accRegister: + return (acc_fetch_size(object) > 1); + } + return (FALSE); +} + +/************************************************************************ + is_collapsed + returns true if object is collapsed +************************************************************************* +*/ + +static int is_collapsed(handle object) +{ + /* collapsed nets aren't supported */ + return (FALSE); +} + +/************************************************************************ + is_expanded + returns true if object is expanded +************************************************************************* +*/ + +static int is_expanded(handle object) +{ + /* expanded nets aren't supported */ + return (FALSE); +} + +/************************************************************************ + acc_product_type +************************************************************************* +*/ +int acc_product_type(void) +{ + acc_error_flag = FALSE; + return (accSimulator); +} + +/************************************************************************ + acc_product_version +************************************************************************* +*/ +char *acc_product_version(void) +{ + char *ptr; + + acc_error_flag = FALSE; + pli_write_string("VeriWell Simulator Version "); + ptr = pli_append_string(pli_info.config.accDevelopmentVersion_); + return (ptr); +} + +/************************************************************************ + acc_version +************************************************************************* +*/ +char *acc_version(void) +{ + char *ptr; + + acc_error_flag = FALSE; + pli_write_string("Access Routines Version "); + ptr = pli_append_string(pli_info.config.accDevelopmentVersion_); + return (ptr); +} + + +/************************************************************************ + * acc_next_topmod * +/***********************************************************************/ + +handle acc_next_topmod(handle topmod) +{ + acc_error_flag = FALSE; + + if (!topmod) { + return (handle) top_level; + } else { + return (handle) TREE_CHAIN((tree) topmod); + } +} + +/**************************************************************** + + acc_next_child + - return the handle to the next child of the given module + +*****************************************************************/ + +handle acc_next_child(handle module, handle child) +{ + tree t; + + acc_error_flag = FALSE; + + // acts like acc_next_topmod if module handle is NULL + + if (module == NULL) { + return (acc_next_topmod(child)); + } + + if (child == NULL) { + t = BLOCK_DOWN((tree) module); + } else { + t = TREE_CHAIN((tree) child); + } + + // sift through other things on list + + while (t != NULL && TREE_CODE(t) != MODULE_BLOCK) { + t = TREE_CHAIN(t); + } + + return ((handle) t); +} + +/************************************************************************ + * acc_next_cell * +/***********************************************************************/ + +handle acc_next_cell(handle reference, handle cell) +{ + // cells are not currently supported + acc_error_flag = FALSE; + return (NULL); +} + +/************************************************************************ + * acc_next_cell_load * +/***********************************************************************/ + +handle acc_next_cell_load(handle reference, handle load) +{ + // cells are not currently supported + acc_error_flag = FALSE; + return (NULL); +} + +/************************************************************************ + * acc_next_load * +/***********************************************************************/ + +handle acc_next_load(handle reference, handle load) +{ + handle parent; + handle primitive; + handle terminal; + int match; + + acc_error_flag = FALSE; + + match = FALSE; + + parent = acc_handle_parent(reference); + primitive = null; + while (TRUE) { + primitive = acc_next_primitive(parent, primitive); + if (primitive == null) { + break; + } + terminal = null; + while (TRUE) { + terminal = acc_next_terminal(primitive, terminal); + if (terminal == null) { + break; + } + if (acc_fetch_direction(terminal) != accOutput) { + if (load == null || match) { + return (terminal); + } + if (acc_handle_conn(terminal) == load) { + match = TRUE; + } + } + } + } + + + return (NULL); +} + +/************************************************************************ + * acc_next_bit * +/***********************************************************************/ + +handle acc_next_bit(handle reference, handle bit) +{ + // expanded vectors or ports are not currently supported + acc_error_flag = FALSE; + return (NULL); +} + +/**************************************************************** + + acc_next + +*****************************************************************/ +handle acc_next(int *object_type_list, handle reference, handle aObject) +{ + int i; + handle object; + + acc_error_flag = FALSE; + object = aObject; + + do { + if (object == NULL) { + object = acc_next_primitive(reference, object); + if (object == NULL) { + object = acc_next_child(reference, object); + } + if (object == NULL) { + object = (handle) BLOCK_DECL((tree) reference); + while (TRUE) { + if (object == NULL || acc_fetch_type(object) != accNet) { + break; + } + object = (handle) TREE_CHAIN((tree) object); + } + } + if (object == NULL) { + object = acc_next_net(reference, null); + } + } else { + switch (acc_fetch_type(object)) { + case accPrimitive: + object = acc_next_primitive(reference, object); + if (object == NULL) { + object = acc_next_child(reference, object); + } + if (object == NULL) { + object = (handle) BLOCK_DECL((tree) reference); + while (TRUE) { + if (object == NULL + || acc_fetch_type(object) != accNet) { + break; + } + object = (handle) TREE_CHAIN((tree) object); + } + } + if (object == NULL) { + object = acc_next_net(reference, null); + } + break; + case accModule: + object = acc_next_child(reference, object); + if (object == NULL) { + object = (handle) BLOCK_DECL((tree) reference); + while (TRUE) { + if (object == NULL + || acc_fetch_type(object) != accNet) { + break; + } + object = (handle) TREE_CHAIN((tree) object); + } + } + if (object == NULL) { + object = acc_next_net(reference, null); + } + break; + case accNet: + object = acc_next_net(reference, object); + break; + default: + object = (handle) TREE_CHAIN((tree) object); + while (TRUE) { + if (object == NULL || acc_fetch_type(object) != accNet) { + break; + } + object = (handle) TREE_CHAIN((tree) object); + } + if (object == NULL) { + object = acc_next_net(reference, null); + } + } + } + + if (object == NULL) { + return (NULL); + } + + + for (i = 0; object_type_list[i] != 0; i++) { + if (acc_fetch_type(object) == object_type_list[i]) { + return (object); + } + if (acc_fetch_fulltype(object) == object_type_list[i]) { + return (object); + } + } + } + while (object != NULL); + + + return (NULL); +} + +/**************************************************************** + + acc_next_modpath + - retrieve all module paths in given scope + +*****************************************************************/ + +handle acc_next_modpath(handle module, handle path) +{ + tree t; + + acc_error_flag = FALSE; + if (path == NULL) { + t = MODULE_SPECINST((tree) module); + } else { + t = TREE_CHAIN((tree) path); + } + while (t && TREE_CODE(t) != PATH_INSTANCE) { + t = TREE_CHAIN(t); + } + return ((handle) t); +} + +/**************************************************************** + + acc_next_primitive + - retrieve all primitives in given scope + +*****************************************************************/ + +handle acc_next_primitive(handle module, handle gate) +{ + tree t; + + acc_error_flag = FALSE; + if (gate == NULL) { + t = BLOCK_BODY((tree) module); + } else { + t = TREE_CHAIN((tree) gate); + } + while (t && TREE_CODE(t) != GATE_INSTANCE) { + t = TREE_CHAIN(t); + } + return ((handle) t); +} + +/**************************************************************** + + acc_next_tchk + - retrieve all timing checks in given scope + +*****************************************************************/ + +handle acc_next_tchk(handle module, handle check) +{ + tree t; + + acc_error_flag = FALSE; + + if (check == NULL) { + t = MODULE_SPECINST((tree) module); + } else { + t = TREE_CHAIN((tree) check); + } + while (t && TREE_CODE(t) != TIMING_CHECK) { + t = TREE_CHAIN(t); + } + return ((handle) t); +} + +/**************************************************************** + + acc_handle_conn + - return net connected to terminal + +*****************************************************************/ +handle acc_handle_conn(handle terminal) +{ + tree t = (tree) terminal; + tree n; + tree desc; + tree module; + tree instance; + tree out; + tree gate; + tree constraint; + + ASSERT(t != NULL); + ASSERT(TREE_CODE(t) == TREE_LIST); + acc_error_flag = FALSE; + if (terminal == NULL) { + acc_error_flag = TRUE; + tf_error("Illegal object in acc_handle_conn()"); + return null; + } + + if (TREE_CODE(t) == PATH_CONSTRAINT) { + desc = PATH_CONSTRAINT_PATHDESC(t); + instance = PATH_CONSTRAINT_INSTANCE(t); + module = PATH_INSTANCE_MODULE(instance); + for (out = MODULE_SPECINST(module); out; out = TREE_CHAIN(out)) { + if (TREE_CODE(out) != PATH_OUTPUT) { + continue; + } + for (constraint = PATH_OUTPUT_CONSTRAINTS(out); + constraint; constraint = TREE_CHAIN(constraint)) { + if (constraint == t) { + gate = PATH_OUTPUT_GATE(out); + t = GATE_OUTPUT_LIST(gate); + goto done; + } + } + } + } + done: + n = TREE_PURPOSE(t); + if (n != NULL && STMT_SURROGATE_ATTR(n)) { + n = TREE_CHAIN(n); + } + return ((handle) n); +} + +/************************************************************************ + * acc_fetch_size * +/***********************************************************************/ + +int acc_fetch_size(handle object) +{ + tree t = (tree) object; + + acc_error_flag = FALSE; + + if (PORT_REDEFINED_ATTR(t)) { + return (TREE_NBITS(TREE_CHAIN(t))); + } + + return TREE_NBITS(t); +} + +/************************************************************************ + * acc_fetch_range * +/***********************************************************************/ + +int acc_fetch_range(handle object, int *pMsb, int *pLsb) +{ + tree t = (tree) object; + + acc_error_flag = FALSE; + switch (TREE_CODE(t)) { + case NET_VECTOR_DECL: + case REG_VECTOR_DECL: + case PORT_VECTOR_DECL: + case INTEGER_DECL: + *pMsb = MSB(t); + *pLsb = LSB(t); + return TRUE; + case TIME_DECL: + *pMsb = 63; + *pLsb = 0; + break; + case NET_SCALAR_DECL: + case REG_SCALAR_DECL: + case PORT_SCALAR_DECL: + *pMsb = 0; + *pLsb = 0; + break; + default: + acc_error_flag = TRUE; + return FALSE; + } +} + +/**************************************************************** + + acc_handle_parent + - return handle of parent of object + +*****************************************************************/ + +handle acc_handle_parent(handle object) +{ + tree gate; + tree timingCheck; + tree decl; + tree modpathEntity; + + + acc_error_flag = FALSE; + + switch (TREE_CODE((tree) object)) { + case PATH_CONSTRAINT: + return ((handle) PATH_CONSTRAINT_INSTANCE((tree) object)); + case PATH_INSTANCE: + return ((handle) PATH_INSTANCE_MODULE((tree) object)); + case GATE_INSTANCE: + return ((handle) GATE_SCOPE((tree) object)); + case TIMING_CHECK: + return ((handle) TIMING_CHECK_MODULE((tree) object)); + case TREE_LIST: + /* check for primitive terminal */ + gate = GATE_TERMINAL_GATE((tree) object); + if (gate != NULL && TREE_CODE(gate) == GATE_INSTANCE) { + return ((handle) gate); + } + timingCheck = TIMING_TERMINAL_CHECK((tree) object); + if (timingCheck != NULL && TREE_CODE(timingCheck) == TIMING_CHECK) { + return (handle) TIMING_CHECK_MODULE(timingCheck); + } + modpathEntity = MODPATH_INPUT_TERMINAL_PARENT((tree) object); + if (modpathEntity != NULL && + TREE_CODE(modpathEntity) == PATH_CONSTRAINT) { + return (handle) PATH_CONSTRAINT_INSTANCE(modpathEntity); + } + /* check for a port terminal */ + decl = TREE_PURPOSE((tree) object); + if ((TREE_CODE(decl) == NET_SCALAR_DECL || + TREE_CODE(decl) == NET_VECTOR_DECL) && + (PORT_INPUT_ATTR(decl) || PORT_OUTPUT_ATTR(decl))) { + return ((handle) DECL_CONTEXT(decl)); + } + break; + } + + switch (*tree_code_type[TREE_CODE((tree) object)]) { + case 'd': /* decls */ + return ((handle) DECL_CONTEXT((tree) object)); + case 'b': /* blocks */ + return ((handle) BLOCK_UP((tree) object)); + case 's': /* statements */ + return ((handle) STMT_SCOPE((tree) object)); + case 'g': + return ((handle) GATE_SCOPE((tree) object)); + default: + acc_error_flag = TRUE; + return NULL; + } +} + +/**************************************************************** + + acc_next_port + - return the next port of module + +*****************************************************************/ + +handle acc_next_port(handle module, handle port) +{ + + acc_error_flag = FALSE; + + if (port == NULL && acc_fetch_type(module) == accModule) { + return (handle) MODULE_PORT_LIST((tree) module); + } else if (port == NULL) { + return (handle) BLOCK_PORTS((tree) module); + } + + return (handle) TREE_CHAIN((tree) port); +} + +/**************************************************************** + + acc_handle_port + +*****************************************************************/ + +handle acc_handle_port(handle module, int argumentNumber) +{ + int i; + tree port; + + acc_error_flag = FALSE; + + if (acc_fetch_type(module) == accModule) { + port = MODULE_PORT_LIST((tree) module); + } else { + port = BLOCK_PORTS((tree) module); + } + for (i = 0; i < argumentNumber; i++) { + port = TREE_CHAIN(port); + if (port == NULL) { + return NULL; + } + } + + return (handle) port; +} + +/**************************************************************** + + acc_next_net + +*****************************************************************/ +handle acc_next_net(handle reference, handle net) +{ + handle object; + handle port; + + acc_error_flag = FALSE; + + object = net; + while (TRUE) { + if (object == NULL) { + object = acc_next_port(reference, object); + if (object != NULL) { + object = acc_handle_loconn(object); + } else { + object = (handle) BLOCK_DECL((tree) reference); + while (TRUE) { + if (object == NULL + || (!PORT_INPUT_ATTR((tree) object) + && !PORT_OUTPUT_ATTR((tree) object))) { + break; + } + object = (handle) TREE_CHAIN((tree) object); + } + } + } else { + if (PORT_OUTPUT_ATTR((tree) object) || + PORT_INPUT_ATTR((tree) object)) { + port = NULL; + while (TRUE) { + port = acc_next_port(reference, port); + if (port == NULL) { + break; + } + if (acc_handle_loconn(port) == object) { + break; + } + } + if (port != NULL) { + port = acc_next_port(reference, port); + } + if (port != NULL) { + object = acc_handle_loconn(port); + } else { + object = (handle) BLOCK_DECL((tree) reference); + while (TRUE) { + if (object == NULL + || (!PORT_INPUT_ATTR((tree) object) + && !PORT_OUTPUT_ATTR((tree) object))) { + break; + } + object = (handle) TREE_CHAIN((tree) object); + } + } + } else { + object = (handle) TREE_CHAIN((tree) object); + while (TRUE) { + if (object == NULL + || (!PORT_INPUT_ATTR((tree) object) + && !PORT_OUTPUT_ATTR((tree) object))) { + break; + } + object = (handle) TREE_CHAIN((tree) object); + } + } + } + if (object == NULL || acc_fetch_type(object) == accNet) { + break; + } + } + return (object); +} + +/************************************************************************ + * + * tf_isizep + * tf_sizep + * +/***********************************************************************/ + +int tf_sizep(int nparam) +{ + return (tf_isizep(nparam, tf_getinstance())); +} + +int tf_isizep(int nparam, char *instance) +{ + tree arg; + int nbits; + tree node; + + arg = nth_parameter(nparam, (tree) instance); + if (arg == NULL) { + return (0); + } + + + node = TREE_PURPOSE(arg); + switch (TREE_CODE(node)) { + case BIT_CST: + nbits = BIT_CST_NBITS(node); + switch (BIT_CST_RADIX(node)) { + case EXP_: + case EXPFLOAT_: + case FLOAT_: + nbits = 0; + break; + case STRING_: + nbits = nbits / 8; + break; + default: + // do nothing + break; + } + return (nbits); + + case INTEGER_DECL: + case REAL_DECL: + case REG_SCALAR_DECL: + case REG_VECTOR_DECL: + case NET_SCALAR_DECL: + case NET_VECTOR_DECL: + case PARAM_DECL: + case SPECPARAM_DECL: + return (TREE_NBITS(node)); + } + + return (TREE_NBITS(*TREE_EXPR_CODE(arg))); +} + +/************************************************************************ + * + * tf_iasynchon + * tf_asynchon + * +/***********************************************************************/ + +static int driverCallback(p_vc_record record) +{ + PliInfo_t *info = (PliInfo_t *) record->user_data; + + if (!ASYNCH_ATTR(info->instance)) { + return 0; + } + switch (TREE_CODE(info->instance)) { + case SYSFUNCTION_REF: + call_misc_tf1(FUNC_REF_USERTF(info->instance), + reason_paramdrc, info->argNumber); + break; + case SYSTASK_STMT: + call_misc_tf1(STMT_SYSTASK_USERTF(info->instance), + reason_paramdrc, info->argNumber); + break; + } + return 0; +} + +void tf_iasynchon(char *instance) +{ + tree node = (tree) instance; + int i; + int argumentCount; + handle net; + handle driver; + tree terminal; + PliInfo_t *info; + + + ASYNCH_ATTR(node) = TRUE; + + // look for value changes on all drivers of nets + // connected to task + + + argumentCount = tf_inump(instance); + for (i = 1; i <= argumentCount; i++) { + net = acc_handle_tfarg(i); + if (net == NULL || acc_fetch_type(net) != accNet) { + continue; + } + driver = null; + while (TRUE) { + driver = acc_next_driver(net, driver); + if (driver == null) { + break; + } + terminal = nth_parameter(i, node); + info = (PliInfo_t *) TREE_PLIINFO(terminal); + if (info->vclSet) { + break; + } + acc_vcl_add(driver, driverCallback, (char *) info, + vcl_verilog_logic); + } + info->vclSet = TRUE; + } + return; +} + +void tf_asynchon() +{ + tf_iasynchon((char *) tf_getinstance()); + return; +} + +/************************************************************************ + * + * tf_iasynchoff + * tf_asynchoff + * +/***********************************************************************/ + +void tf_iasynchoff(char *instance) +{ + tree node = (tree) instance; + + ASYNCH_ATTR(node) = FALSE; + return; +} + +void tf_asynchoff() +{ + tf_iasynchoff((char *) tf_getinstance()); + return; +} + +/************************************************************************ + * io_printf * +/***********************************************************************/ + +void io_printf(char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + vprintf_V(fmt, args); + va_end(args); + return; +} + +/**************************************************************************/ +/* tf_getinstance */ +/**************************************************************************/ + +char *tf_getinstance(void) +{ + return (char *) current_tf_instance; +} + +/************************************************************************ + * tf_synchronize * + * tf_isynchronize * + * tf_rosynchronize * + * tf_irosynchronize * + * Add an item to either the idle queue (synchronize) or to the * + * final queue (rosynchronize). Later, add flags to send error * + * messages is certain PLI routines are called in violation of the * + * rules (i.e., can't call tf_strdelputp, etc on reason_rosynch). * + ***********************************************************************/ + +void tf_synchronize(void) +{ + tf_isynchronize(tf_getinstance()); + return; +} + +void tf_isynchronize(char *instance) +{ + tickle_monitor(&idle_strobe_queue, (tree) instance); + return; +} + +void tf_rosynchronize(void) +{ + tf_irosynchronize(tf_getinstance()); + return; +} + +void tf_irosynchronize(char *instance) +{ + tickle_monitor(&final_strobe_queue, (tree) instance); + return; +} + +/************************************************************************ + * tf_nump * + * Return the number of (possibly null) arguments * +/***********************************************************************/ + +int tf_nump(void) +{ + return tf_inump(tf_getinstance()); +} + +int tf_inump(char *instance) +{ + return count_args((tree) instance); +} + +/**************************************************************** + + tf_mipname + tf_imipname + - return the pathname of the module containing the current + instance + +*****************************************************************/ + +char *tf_mipname(void) +{ + return (tf_imipname(tf_getinstance())); +} + +char *tf_imipname(char *instance) +{ + handle statement; + handle parent; + + statement = (handle) instance; + parent = acc_handle_parent(statement); + return (acc_fetch_fullname((handle) parent)); +} + +/**************************************************************** + + tf_itypep + tf_typep + - return the type of the given argument + +*****************************************************************/ + +int tf_typep(int argnum) +{ + return (tf_itypep(argnum, tf_getinstance())); +} + +int tf_itypep(int argnum, char *instance) +{ + tree arg; + + arg = nth_arg(argnum, (tree) instance); + + if (arg == NULL_TREE) { + return (tf_nullparam); + } + + + switch (TREE_CODE(arg)) { + case BIT_CST: + switch (BIT_CST_RADIX(arg)) { + case STRING_: + return (tf_string); + case EXP_: + case FLOAT_: + case EXPFLOAT_: + return (tf_readonlyreal); + default: + return (tf_readonly); + } + break; + case REAL_CST: + return (tf_readonlyreal); + case STRING_CST: + return (tf_string); + case INTEGER_CST: + return (tf_readonly); + case REAL_DECL: + return (tf_readwritereal); + case NET_SCALAR_DECL: + case NET_VECTOR_DECL: + return (tf_readonly); + case INTEGER_DECL: + case REG_SCALAR_DECL: + case REG_VECTOR_DECL: + if (PORT_INPUT_ATTR(arg)) { + return (tf_readonly); + } else { + return (tf_readwrite); + } + case BIT_REF: + return (tf_rwbitselect); + case PART_REF: + return (tf_rwpartselect); + default: + if (TREE_REAL_ATTR(arg)) { + return (tf_readonlyreal); + } else { + return (tf_readonly); + } + } + + return (0); +} + +/**************************************************************** + + tf_gettimeprecision + tf_igettimeprecision + - return time precision of instance + +*****************************************************************/ + +int tf_gettimeprecision() +{ + return (tf_igettimeprecision(tf_getinstance())); +} + +int tf_igettimeprecision(char *instance) +{ + int prec; + int unit; + + if (instance == null) { + return (-get_tick_precision()); + } + timescale_get((tree) acc_handle_parent((handle) instance), &unit, + &prec); + return (-prec); +} + +/**************************************************************** + + tf_gettimeunit + tf_igettimeunit + - return time units of instance + +*****************************************************************/ + +int tf_gettimeunit() +{ + return (tf_igettimeunit(tf_getinstance())); +} + +int tf_igettimeunit(char *instance) +{ + int prec; + int unit; + + timescale_get((tree) acc_handle_parent((handle) instance), &unit, + &prec); + return (-unit); +} + +/**************************************************************** + + tf_finish + tf_dofinish + +*****************************************************************/ +void tf_finish() +{ + do_finish(); +} + +void tf_dofinish() +{ + tf_finish(); +} + +/**************************************************************** + + tf_stop + tf_dostop + +*****************************************************************/ +void tf_stop() +{ + do_stop(); +} + +void tf_dostop() +{ + tf_stop(); +} + +/***************************************************************** + acc_fetch_timescale_info +******************************************************************/ + +void acc_fetch_timescale_info(handle object, p_timescale_info p_timescale) +{ + int unit; + int precision; + +/* make sure object points to a module */ + + if (object != NULL && acc_fetch_type(object) != accModule) { + object = acc_handle_parent(object); + } + timescale_get((tree) object, &unit, &precision); + p_timescale->unit = -unit; + p_timescale->precision = -precision; +} + +/***************************************************************** + acc_fetch_precision +******************************************************************/ + +int acc_fetch_precision() +{ + return -get_tick_precision(); +} + +/**************************************************************** + + acc_fetch_defname + - return defining name of module or primitive + +*****************************************************************/ + +char *acc_fetch_defname(handle object) +{ + char *name; + tree t = (tree) object; + + acc_error_flag = FALSE; + + switch (TREE_CODE(t)) { + case MODULE_BLOCK: + return (MODULE_NAME(t)); + case GATE_INSTANCE: + switch (TREE_TYPE(t)) { + case GATE_AND_TYPE: + name = "and"; + break; + case GATE_BUFIF0_TYPE: + name = "bufif0"; + break; + case GATE_BUFIF1_TYPE: + name = "bufif1"; + break; + case GATE_BUF_TYPE: + name = "buf"; + break; + case GATE_CMOS_TYPE: + name = "cmos"; + break; + case GATE_NAND_TYPE: + name = "nand"; + break; + case GATE_NMOS_TYPE: + name = "nmos"; + break; + case GATE_NOR_TYPE: + name = "nor"; + break; + case GATE_NOTIF0_TYPE: + name = "notif0"; + break; + case GATE_NOTIF1_TYPE: + name = "notif1"; + break; + case GATE_NOT_TYPE: + name = "not"; + break; + case GATE_OR_TYPE: + name = "or"; + break; + case GATE_PMOS_TYPE: + name = "pmos"; + break; + case GATE_PULLDN_TYPE: + name = "pulldown"; + break; + case GATE_PULLUP_TYPE: + name = "pullup"; + break; + case GATE_RCMOS_TYPE: + name = "rcmos"; + break; + case GATE_RNMOS_TYPE: + name = "rnmos"; + break; + case GATE_RPMOS_TYPE: + name = "rpmos"; + break; + case GATE_RTRANIF0_TYPE: + name = "rtranif0"; + break; + case GATE_RTRANIF1_TYPE: + name = "rtranif1"; + break; + case GATE_RTRAN_TYPE: + name = "rtran"; + break; + case GATE_TRANIF0_TYPE: + name = "tranif0"; + break; + case GATE_TRANIF1_TYPE: + name = "tranif1"; + break; + case GATE_TRAN_TYPE: + name = "tran"; + break; + case GATE_UDP_TYPE: + name = UDP_NAME(GATE_UDP_DEF(t)); + break; + case GATE_XNOR_TYPE: + name = "xnor"; + break; + case GATE_XOR_TYPE: + name = "xor"; + break; + } + return (name); + } + acc_error_flag = TRUE; + return (NULL); +} + +/**************************************************************** + + acc_fetch_type_str + - add delays for given object + +*****************************************************************/ + +char *acc_fetch_type_str(int type) +{ + char *string; + + acc_error_flag = FALSE; + switch (type) { + case accModule: + string = "accModule"; + break; + case accScope: + string = "accScope"; + break; + case accNet: + string = "accNet"; + break; + case accRegister: + string = "accRegister"; + break; + case accPort: + string = "accPort"; + break; + case accTerminal: + string = "accTerminal"; + break; + case accInputTerminal: + string = "accInputTerminal"; + break; + case accOutputTerminal: + string = "accOutputTerminal"; + break; + case accInoutTerminal: + string = "accInoutTerminal"; + break; + case accCombPrim: + string = "accCombPrim"; + break; + case accSeqPrim: + string = "accSeqPrim"; + break; + case accAndGate: + string = "accAndGate"; + break; + case accNandGate: + string = "accNandGate"; + break; + case accNorGate: + string = "accNorGate"; + break; + case accOrGate: + string = "accOrGate"; + break; + case accXorGate: + string = "accXorGate"; + break; + case accXnorGate: + string = "accXnorGate"; + break; + case accBufGate: + string = "accBufGate"; + break; + case accNotGate: + string = "accNotGate"; + break; + case accBufif0Gate: + string = "accBufif0Gate"; + break; + case accBufif1Gate: + string = "accBufif1Gate"; + break; + case accNotif0Gate: + string = "accNotif0Gate"; + break; + case accNotif1Gate: + string = "accNotif1Gate"; + break; + case accNmosGate: + string = "accNmosGate"; + break; + case accPmosGate: + string = "accPmosGate"; + break; + case accCmosGate: + string = "accCmosGate"; + break; + case accRnmosGate: + string = "accRnmosGate"; + break; + case accRpmosGate: + string = "accRpmosGate"; + break; + case accRcmosGate: + string = "accRcmosGate"; + break; + case accRtranGate: + string = "accRtranGate"; + break; + case accRtranif0Gate: + string = "accRtranif0Gate"; + break; + case accRtranif1Gate: + string = "accRtranif1Gate"; + break; + case accTranGate: + string = "accTranGate"; + break; + case accTranif0Gate: + string = "accTranif0Gate"; + break; + case accTranif1Gate: + string = "accTranif1Gate"; + break; + case accPullupGate: + string = "accPullupGate"; + break; + case accPulldownGate: + string = "accPulldownGate"; + break; + case accIntegerParam: + string = "accIntegerParam"; + break; + case accRealParam: + string = "accRealParam"; + break; + case accStringParam: + string = "accStringParam"; + break; + case accPath: + string = "accPath"; + break; + case accTchk: + string = "accTchk"; + break; + case accPrimitive: + string = "accPrimitive"; + break; + case accBit: + string = "accBit"; + break; + case accPortBit: + string = "accPortBit"; + break; + case accNetBit: + string = "accNetBit"; + break; + case accRegBit: + string = "accRegBit"; + break; + case accParameter: + string = "accParameter"; + break; + case accSpecparam: + string = "accSpecparam"; + break; + case accTopModule: + string = "accTopModule"; + break; + case accModuleInstance: + string = "accModuleInstance"; + break; + case accCellInstance: + string = "accCellInstance"; + break; + case accModPath: + string = "accModPath"; + break; + case accPrimPath: + string = "accPrimPath"; + break; + case accWirePath: + string = "accWirePath"; + break; + case accInterModPath: + string = "accInterModPath"; + break; + case accTermPath: + string = "accTermPath"; + break; + case accModTermPath: + string = "accModTermPath"; + break; + case accTermModPath: + string = "accTermModPath"; + break; + case accScalarPort: + string = "accScalarPort"; + break; + case accBitSelectPort: + string = "accBitSelectPort"; + break; + case accPartSelectPort: + string = "accPartSelectPort"; + break; + case accVectorPort: + string = "accVectorPort"; + break; + case accConcatPort: + string = "accConcatPort"; + break; + case accWire: + string = "accWire"; + break; + case accWand: + string = "accWand"; + break; + case accWor: + string = "accWor"; + break; + case accTri: + string = "accTri"; + break; + case accTriand: + string = "accTriand"; + break; + case accTrior: + string = "accTrior"; + break; + case accTri0: + string = "accTri0"; + break; + case accTri1: + string = "accTri1"; + break; + case accTrireg: + string = "accTrireg"; + break; + case accSupply0: + string = "accSupply0"; + break; + case accSupply1: + string = "accSupply1"; + break; + case accNamedEvent: + string = "accNamedEvent"; + break; + case accIntegerVar: + string = "accIntegerVar"; + break; + case accRealVar: + string = "accRealVar"; + break; + case accTimeVar: + string = "accTimeVar"; + break; + case accScalar: + string = "accScalar"; + break; + case accVector: + string = "accVector"; + break; + case accCollapsedNet: + string = "accCollapsedNet"; + break; + case accExpandedVector: + string = "accExpandedVector"; + break; + case accProtected: + string = "accProtected"; + break; + case accVlogSimPath: + string = "accVlogSimPath"; + break; + case accExpandedPath: + string = "accExpandedPath"; + break; + case accSwXlInvisibleNet: + string = "accSwXlInvisibleNet"; + break; + case accAcceleratedNet: + string = "accAcceleratedNet"; + break; + case accSetup: + string = "accSetup"; + break; + case accHold: + string = "accHold"; + break; + case accWidth: + string = "accWidth"; + break; + case accPeriod: + string = "accPeriod"; + break; + case accRecovery: + string = "accRecovery"; + break; + case accSkew: + string = "accSkew"; + break; + case accNoChange: + string = "accNoChange"; + break; + case accSetuphold: + string = "accSetuphold"; + break; + case accInput: + string = "accInput"; + break; + case accOutput: + string = "accOutput"; + break; + case accInout: + string = "accInout"; + break; + case accPositive: + string = "accPositive"; + break; + case accNegative: + string = "accNegative"; + break; + case accUnknown: + string = "accUnknown"; + break; + case accPathTerminal: + string = "accPathTerminal"; + break; + case accPathInput: + string = "accPathInput"; + break; + case accPathOutput: + string = "accPathOutput"; + break; + case accDataPath: + string = "accDataPath"; + break; + case accTchkTerminal: + string = "accTchkTerminal"; + break; + case accBitSelect: + string = "accBitSelect"; + break; + case accPartSelect: + string = "accPartSelect"; + break; + case accTask: + string = "accTask"; + break; + case accFunction: + string = "accFunction"; + break; + case accStatement: + string = "accStatement"; + break; + case accTaskCall: + string = "accTaskCall"; + break; + case accFunctionCall: + string = "accFunctionCall"; + break; + case accSystemTask: + string = "accSystemTask"; + break; + case accSystemFunction: + string = "accSystemFunction"; + break; + case accSystemRealFunction: + string = "accSystemRealFunction"; + break; + case accUserTask: + string = "accUserTask"; + break; + case accUserFunction: + string = "accUserFunction"; + break; + case accUserRealFunction: + string = "accUserRealFunction"; + break; + case accAssignmentStat: + string = "accAssignmentStat"; + break; + case accContAssignStat: + string = "accContAssignStat"; + break; + case accNullStat: + string = "accNullStat"; + break; + case accDelayStat: + string = "accDelayStat"; + break; + case accAssignDelayStat: + string = "accAssignDelayStat"; + break; + case accRtlDelayStat: + string = "accRtlDelayStat"; + break; + case accAssignEventStat: + string = "accAssignEventStat"; + break; + case accAssignMultiStat: + string = "accAssignMultiStat"; + break; + case accRtlEventStat: + string = "accRtlEventStat"; + break; + case accRtlMultiStat: + string = "accRtlMultiStat"; + break; + case accGenEventStat: + string = "accGenEventStat"; + break; + case accDisableStat: + string = "accDisableStat"; + break; + case accAssignStat: + string = "accAssignStat"; + break; + case accDeassignStat: + string = "accDeassignStat"; + break; + case accForceStat: + string = "accForceStat"; + break; + case accReleaseStat: + string = "accReleaseStat"; + break; + case accInitialStat: + string = "accInitialStat"; + break; + case accAlwaysStat: + string = "accAlwaysStat"; + break; + case accAtEventStat: + string = "accAtEventStat"; + break; + case accUnnamedBeginStat: + string = "accUnnamedBeginStat"; + break; + case accNamedBeginStat: + string = "accNamedBeginStat"; + break; + case accUnnamedForkStat: + string = "accUnnamedForkStat"; + break; + case accNamedForkStat: + string = "accNamedForkStat"; + break; + case accIfStat: + string = "accIfStat"; + break; + case accCaseStat: + string = "accCaseStat"; + break; + case accCaseZStat: + string = "accCaseZStat"; + break; + case accCaseXStat: + string = "accCaseXStat"; + break; + case accForeverStat: + string = "accForeverStat"; + break; + case accRepeatStat: + string = "accRepeatStat"; + break; + case accWhileStat: + string = "accWhileStat"; + break; + case accForStat: + string = "accForStat"; + break; + case accWaitStat: + string = "accWaitStat"; + break; + case accConstant: + string = "accConstant"; + break; + case accConcat: + string = "accConcat"; + break; + case accOperator: + string = "accOperator"; + break; + default: + acc_error_flag = TRUE; + string = NULL; + } + return (string); +} + + +/************************************************************************ + * acc_fetch_type * +/***********************************************************************/ + +int acc_fetch_type(handle object) +{ + tree gate; + tree timingCheck; + tree decl; + tree modpathEntity; + + acc_error_flag = FALSE; + + // missing things: + // accDataPath + // accNetBit - no supported + // accOperator + // accPathTerminal + // accPortBit + // accRegBit + + switch (TREE_CODE((tree) object)) { + case SYSTASK_STMT: + return accUserTask; + case SYSFUNCTION_REF: + if (((p_tfcell) FUNC_REF_USERTF((tree) object))->type == + USERFUNCTION) { + return accUserFunction; + } else { + return accUserRealFunction; + } + case PATH_CONSTRAINT: + return accPathTerminal; + case TREE_LIST: + gate = GATE_TERMINAL_GATE((tree) object); + if (gate != NULL && TREE_CODE(gate) == GATE_INSTANCE) { + return accTerminal; + } + timingCheck = TIMING_TERMINAL_CHECK((tree) object); + if (timingCheck != NULL && TREE_CODE(timingCheck) == TIMING_CHECK) { + return accTchkTerminal; + } + modpathEntity = MODPATH_INPUT_TERMINAL_PARENT((tree) object); + if (modpathEntity != NULL + && TREE_CODE(modpathEntity) == PATH_CONSTRAINT) { + return accPathTerminal; + } + /* check for a port terminal */ + decl = TREE_PURPOSE((tree) object); + if ((TREE_CODE(decl) == NET_SCALAR_DECL || + TREE_CODE(decl) == NET_VECTOR_DECL) && + (PORT_INPUT_ATTR(decl) || PORT_OUTPUT_ATTR(decl))) { + return (accPort); + } + acc_error_flag = TRUE; + return (0); + + case BIT_CST: + return accConstant; + case EVENT_DECL: + return accNamedEvent; + case FUNCTION_BLOCK: + return accFunction; + case INTEGER_DECL: + return accIntegerVar; + case MODULE_BLOCK: + return accModule; + case NET_VECTOR_DECL: + case NET_SCALAR_DECL: + return accNet; + case PARAM_DECL: + return accParameter; + + case PART_REF: + return (accPartSelect); + case PATH_INSTANCE: + return accPath; + case REAL_DECL: + return accRealVar; + case REG_SCALAR_DECL: + case REG_VECTOR_DECL: + return accReg; + + case SPECPARAM_DECL: + return accSpecparam; + case TASK_BLOCK: + return accTask; + case TIMING_CHECK: + return accTchk; + case TIME_DECL: + return accTimeVar; + + case GATE_INSTANCE: + return accPrimitive; + + default: + if (*tree_code_type[TREE_CODE((tree) object)] == 's') { + return accStatement; + } else if (*tree_code_type[TREE_CODE((tree) object)] == 'g') { + return (accPrimitive); + } else { + acc_error_flag = TRUE; + return 0; + } + } +} + + /**************************************************************** + + acc_fetch_fulltype + - return the fulltype of the given object + +*****************************************************************/ + +int acc_fetch_fulltype(handle object) +{ + int type; + tree t = (tree) object; + tree gate; + tree decl; + tree modpathEntity; + + // full types not supported: + // accCellInstance/accCellModule + // accNet enumerations + // accParameter enumerations + // accPort enumerations + // accSpecparam enumerations + // accStatement enumerations + // accNoChange + // + acc_error_flag = FALSE; + type = 0; + + switch (TREE_CODE(t)) { + case PATH_INSTANCE: + return accModPath; + case PATH_CONSTRAINT: + return accPathOutput; + case TREE_LIST: + gate = GATE_TERMINAL_GATE(t); + if (gate != NULL && TREE_CODE(gate) == GATE_INSTANCE) { + if (PORT_INPUT_ATTR(t) && PORT_OUTPUT_ATTR(t)) { + type = accInoutTerminal; + } else if (PORT_INPUT_ATTR(t)) { + type = accInputTerminal; + } else if (PORT_OUTPUT_ATTR(t)) { + type = accOutputTerminal; + } + break; + } + modpathEntity = MODPATH_INPUT_TERMINAL_PARENT((tree) object); + if (modpathEntity != NULL && + TREE_CODE(modpathEntity) == PATH_CONSTRAINT) { + return accPathInput; + } + /* must be a port */ + decl = TREE_PURPOSE(t); + if (PORT_INPUT_ATTR(decl) || PORT_OUTPUT_ATTR(decl)) { + if (TREE_NBITS(decl) == 1) { + type = accScalarPort; + } else { + type = accVectorPort; + } + } + break; + + case MODULE_BLOCK: + if (BLOCK_UP(t) != NULL_TREE) { + type = accModuleInstance; + } else { + type = accTopModule; + } + break; + + case GATE_INSTANCE: + + switch (TREE_TYPE(t)) { + case GATE_AND_TYPE: + type = accAndGate; + break; + case GATE_BUFIF0_TYPE: + type = accBufif0Gate; + break; + case GATE_BUFIF1_TYPE: + type = accBufif1Gate; + break; + case GATE_BUF_TYPE: + type = accBufGate; + break; + case GATE_CMOS_TYPE: + type = accCmosGate; + break; + case GATE_NAND_TYPE: + type = accNandGate; + break; + case GATE_NMOS_TYPE: + type = accNmosGate; + break; + case GATE_NOR_TYPE: + type = accNorGate; + break; + case GATE_NOTIF0_TYPE: + type = accNotif0Gate; + break; + case GATE_NOTIF1_TYPE: + type = accNotif1Gate; + break; + case GATE_NOT_TYPE: + type = accNotGate; + break; + case GATE_OR_TYPE: + type = accOrGate; + break; + case GATE_PMOS_TYPE: + type = accPmosGate; + break; + case GATE_PULLDN_TYPE: + type = accPulldownGate; + break; + case GATE_PULLUP_TYPE: + type = accPullupGate; + break; + case GATE_RCMOS_TYPE: + type = accRcmosGate; + break; + case GATE_RNMOS_TYPE: + type = accRnmosGate; + break; + case GATE_RPMOS_TYPE: + type = accRpmosGate; + break; + case GATE_RTRANIF0_TYPE: + type = accRtranif0Gate; + break; + case GATE_RTRANIF1_TYPE: + type = accRtranif1Gate; + break; + case GATE_RTRAN_TYPE: + type = accRtranGate; + break; + case GATE_TRANIF0_TYPE: + type = accTranif0Gate; + break; + case GATE_TRANIF1_TYPE: + type = accTranif1Gate; + break; + case GATE_TRAN_TYPE: + type = accTranGate; + break; + case GATE_UDP_TYPE: + { + tree udpDef = GATE_UDP_DEF(t); + ASSERT(udpDef != NULL_TREE); + if (UDP_REG_NAME(udpDef)) { + type = accSeqPrim; + } else { + type = accCombPrim; + } + } + break; + case GATE_XNOR_TYPE: + type = accXnorGate; + break; + case GATE_XOR_TYPE: + type = accXorGate; + break; + } + break; + case TIMING_CHECK: + { + tree check; + check = TIMING_CHECK_CHECKSPEC(t); + ASSERT(check != NULL_TREE); + switch (CHECK_SPEC_CHECKTYPE(check)) { + case SETUP: + type = accSetup; + break; + case HOLD: + type = accHold; + break; + case WIDTH: + type = accWidth; + break; + case PERIOD: + type = accPeriod; + break; + case SKEW: + type = accSkew; + break; + case RECOVERY: + type = accRecovery; + break; + case SETUPHOLD: + type = accSetuphold; + break; + default: + ASSERT(FALSE); + } + } + break; + default: + type = acc_fetch_type(object); + if (type == accNet) { + switch (TREE_TYPE((tree) object)) { + case NET_TRI_TYPE: + return accTri; + case NET_WIRE_TYPE: + return accWire; + case NET_TRIOR_TYPE: + return accTrior; + case NET_WOR_TYPE: + return accWor; + case NET_TRIAND_TYPE: + return accTriand; + case NET_WAND_TYPE: + return accWand; + case NET_TRIREG_TYPE: + return accTrireg; + case NET_TRI0_TYPE: + return accTri0; + case NET_TRI1_TYPE: + return accTri1; + case NET_SUPPLY1_TYPE: + return accSupply0; + case NET_SUPPLY0_TYPE: + return accSupply1; + default: + ASSERT(FALSE); + } + } else if (type == accParameter) { + if (TREE_INTEGER_ATTR(DECL_PARAM_RVAL((tree) object))) { + return (accIntegerParam); + } else if (TREE_REAL_ATTR(DECL_PARAM_RVAL((tree) object))) { + return (accRealParam); + } else { + return (accStringParam); + } + } + } + return (type); +} + +/****************************************************************************** + io_mcdprintf( int mcd, char* fmt, ... ) +******************************************************************************* +*/ + +void io_mcdprintf(int handle, char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + vfprintf_V(handle, fmt, args); + va_end(args); +} + +/****************************************************************************** + tf_long_to_real +******************************************************************************* +*/ + +void tf_long_to_real(int low, int high, double *aof_real) +{ + double result; + + result = high; + result = ldexp(result, 32); /* shift by 32 */ + result += low; + *aof_real = result; +} + +/****************************************************************************** + tf_real_to_long +******************************************************************************* +*/ + +void tf_real_to_long(double realvalue, int *aof_int_lo, int *aof_int_hi) +{ + double y; + const double pow2_32 = ldexp((double) 1, 32); + + y = realvalue + 0.5; /* round to compensate for small errors in conversion */ + + *aof_int_lo = (int) fmod(y, pow2_32); /* mod 2^32 */ + *aof_int_hi = (int) ldexp(y, -32); /* div 2^32 */ +} + +/****************************************************************************** + tf_scale_longdelay +******************************************************************************* +*/ + +void +tf_scale_longdelay(char *instance_p, int delay_lo, int delay_hi, + int *aof_delay_lo, int *aof_delay_hi) +{ + int factor; + + *aof_delay_lo = delay_lo; + *aof_delay_hi = delay_hi; + factor = (int) timescale_precision((tree) + acc_handle_parent((handle) + instance_p)); + tf_multiply_long(aof_delay_lo, aof_delay_hi, factor, 0); +} + +/****************************************************************************** + tf_scale_realdelay +******************************************************************************* +*/ + +void +tf_scale_realdelay(char *instance_p, double realdelay, + double *aof_realdelay) +{ + *aof_realdelay = realdelay * timescale_precision((tree) + acc_handle_parent((handle) instance_p)); +} + +/****************************************************************************** + tf_unscale_longdelay +******************************************************************************* +*/ + +void +tf_unscale_longdelay(char *instance_p, int delay_lo, int delay_hi, + int *aof_delay_lo, int *aof_delay_hi) +{ + int factor; + + *aof_delay_lo = delay_lo; + *aof_delay_hi = delay_hi; + factor = (int) timescale_precision((tree) + acc_handle_parent((handle) + instance_p)); + tf_divide_long(aof_delay_lo, aof_delay_hi, factor, 0); +} + +/****************************************************************************** + tf_unscale_realdelay +******************************************************************************* +*/ + +void +tf_unscale_realdelay(char *instance_p, double realdelay, + double *aof_realdelay) +{ + *aof_realdelay = + realdelay / + timescale_precision((tree) acc_handle_parent((handle) instance_p)); +} + +/****************************************************************************** + tf_longtime_tostr +******************************************************************************* +*/ + +char *tf_longtime_tostr(int lowtime, int hightime) +{ + time64 time; + + time.timeh = hightime; + time.timel = lowtime; + return (time_string(&time)); +} + +/**************************************************************************/ +/* tf_gettime */ +/**************************************************************************/ + +int tf_gettime() +{ + int timeh; + + return (tf_getlongtime(&timeh)); +} + + +/**************************************************************************/ +/* tf_getlongtime */ +/* tf_igetlongtime */ +/**************************************************************************/ + +int tf_igetlongtime(int *aof_hightime, char *instance) +{ + +/* + * time is unscaled per vcs behavior + */ +/* + int timeh; + int timel; + tf_unscale_longdelay( instance, CurrentTime.timel, CurrentTime.timeh, + &timel, &timeh ); + *aof_hightime = timeh; +*/ + *aof_hightime = CurrentTime.timeh; + return CurrentTime.timel; +} + +int tf_getlongtime(int *aof_hightime) +{ + return tf_igetlongtime(aof_hightime, tf_getinstance()); +} + +/**************************************************************************/ +/* tf_getrealtime */ +/**************************************************************************/ + +double tf_getrealtime(void) +{ + double result; + + + tf_long_to_real(CurrentTime.timel, CurrentTime.timeh, &result); + return (result); +} + +/**************************************************************************/ +/* tf_strgettime */ +/**************************************************************************/ + +char *tf_strgettime() +{ + time64 time; + + time.timel = tf_getlongtime((int *) &time.timeh); + return time_string(&time); +} + +/************************************************************************ + mc_scan_plusargs +************************************************************************* +*/ + +char *mc_scan_plusargs(char *startarg) +{ + tree t; + + for (t = plusargs; t; t = TREE_CHAIN(t)) { + if (!strncmp(startarg, (char *) TREE_PURPOSE(t), strlen(startarg))) { + return ((char *) TREE_PURPOSE(t) + strlen(startarg)); + } + } + return (NULL); +} + +/**************************************************************** + tf_propagate + tf_ipropagate +*****************************************************************/ + +void tf_propagatep(int nparam) +{ + tf_ipropagatep(nparam, tf_getinstance()); +} + +void tf_ipropagatep(int nparam, char *instance) +{ + tree arg = nth_arg(nparam, (tree) instance); + tree param = nth_parameter(nparam, (tree) instance); + int numbits; + int ngroups; + PliInfo_t *info; + + numbits = TREE_NBITS(*TREE_EXPR_CODE(param)); + ngroups = (numbits - 1) / 32 + 1; + info = (PliInfo_t *) TREE_PLIINFO(param); + ASSERT(info != NULL); + + if (info->storage == NULL) { + info->storage = (Group *) malloc_X(ngroups); + } + + memcpy(DECL_STORAGE(arg), info->storage, sizeof(Group) * ngroups); + notify(arg, DECL_STATE(arg), 1, NULL); +} + +/**************************************************************** + tf_evaluatep + tf_ievaluatep +*****************************************************************/ +void tf_evaluatep(int nparam) +{ + tf_ievaluatep(nparam, tf_getinstance()); +} + +void tf_ievaluatep(int nparam, char *instance) +{ + tree arg; + Group *g; + int numbits; + int ngroups; + PliInfo_t *info; + + arg = nth_parameter(nparam, (tree) instance); + if (arg == NULL) { + return; + } + info = (PliInfo_t *) TREE_PLIINFO(arg); + ASSERT(info != NULL); + + numbits = TREE_NBITS(*TREE_EXPR_CODE(arg)); + ngroups = (numbits - 1) / 32 + 1; + stack_allocate(); + eval(TREE_EXPR_CODE(arg)); + g = *--R; + + if (info->storage == NULL) { + info->storage = (Group *) malloc_X(ngroups); + } + + memcpy(info->storage, g, ngroups * sizeof(Group)); +} + +/**************************************************************** + + tf_exprinfo + tf_iexprinfo + +*****************************************************************/ + +struct t_tfexprinfo *tf_exprinfo(int nparam, + struct t_tfexprinfo *exprinfo_p) +{ + return (tf_iexprinfo(nparam, exprinfo_p, tf_getinstance())); +} + +struct t_tfexprinfo *tf_iexprinfo(int nparam, + struct t_tfexprinfo *exprinfo_p, + char *instance) +{ + int type; + tree arg; + tree param; + int bits; + PliInfo_t *info; + + tf_ievaluatep(nparam, instance); + param = nth_parameter(nparam, (tree) instance); + if (param == NULL) { + return (NULL); + } + arg = TREE_PURPOSE(param); + info = (PliInfo_t *) TREE_PLIINFO(param); + ASSERT(info != NULL); + + if (info->storage == NULL) { + info->storage = (Group *) malloc_X(exprinfo_p->expr_ngroups); + } + + type = tf_itypep(nparam, instance); + bits = tf_isizep(nparam, instance); + switch (type) { + case tf_nullparam: + break; + case tf_string: + exprinfo_p->expr_sign = 0; + exprinfo_p->expr_vec_size = 0; + exprinfo_p->expr_ngroups = 0; + exprinfo_p->expr_value_p = 0; + exprinfo_p->expr_string = + GroupToString(info->storage, bits * 8, (bits + 3) / 4); + break; + case tf_readonlyreal: + case tf_readwritereal: + exprinfo_p->expr_vec_size = 0; + exprinfo_p->expr_ngroups = 0; + exprinfo_p->real_value = REAL_(info->storage); + exprinfo_p->expr_value_p = 0; + if (exprinfo_p->real_value < 0) { + exprinfo_p->expr_sign = -1; + } else { + exprinfo_p->expr_sign = 1; + } + break; + case tf_readonly: + case tf_readwrite: + case tf_rwbitselect: + case tf_rwpartselect: + exprinfo_p->expr_sign = 0; // this needs fixed + exprinfo_p->expr_vec_size = bits; + exprinfo_p->expr_ngroups = 1 + (bits - 1) / (8 * sizeof(int)); + exprinfo_p->expr_value_p = (struct t_vecval *) info->storage; + break; + break; + case tf_rwmemselect: + default: + return (NULL); + } + + exprinfo_p->expr_type = type; + return (exprinfo_p); +} + + +/************************************************************************ + * tf_getp + * tf_igetp + * tf_putp + * tf_iputp + * tf_putlongp + * tf_iputlongp + * tf_getlongp + * tf_igetlongp + * tf_getrealp + * tf_igetrealp + * tf_putrealp + * tf_iputrealp + ***********************************************************************/ + +LP64 tf_getp(int nparam) +{ + return tf_igetp(nparam, tf_getinstance()); +} + +LP64 tf_igetp(int nparam, char *instance) +{ + s_tfexprinfo info; + + tf_iexprinfo(nparam, &info, instance); + if (info.expr_ngroups < 1) { + return (0); + } + if (info.expr_type == tf_string) { + return ((LP64) info.expr_string); + } + + return (info.expr_value_p->avalbits); + +} + +void tf_putp(int nparam, int value) +{ + tf_iputp(nparam, value, tf_getinstance()); + return; +} + +void tf_iputp(int nparam, int value, char *instance) +{ + s_tfexprinfo info; + Group *g; + + + // handle function return here + if (nparam == 0) { + g = DECL_STORAGE(FUNC_REF_RETURNDECL((tree) instance)); + AVAL(g) = value; + BVAL(g) = 0; + return; + } + + tf_iexprinfo(nparam, &info, instance); + if (info.expr_ngroups < 1) { + return; + } + + if (info.expr_type == tf_string) { + return; + } + + info.expr_value_p->avalbits = value; + info.expr_value_p->bvalbits = 0; + + tf_ipropagatep(nparam, instance); + return; +} + +void tf_putlongp(int nparam, int lowvalue, int highvalue) +{ + tf_iputlongp(nparam, lowvalue, highvalue, tf_getinstance()); + return; +} + +void tf_iputlongp(int nparam, int lowvalue, int highvalue, char *instance) +{ + s_tfexprinfo info; + Group *g; + + + // handle function return here + if (nparam == 0) { + g = DECL_STORAGE(FUNC_REF_RETURNDECL((tree) instance)); + AVAL(g) = lowvalue; + BVAL(g) = 0; + g++; + AVAL(g) = highvalue; + BVAL(g) = 0; + return; + } + + tf_iexprinfo(nparam, &info, instance); + if (info.expr_ngroups < 2) { + return; + } + + if (info.expr_type == tf_string) { + return; + } + + info.expr_value_p->avalbits = lowvalue; + info.expr_value_p->bvalbits = 0; + info.expr_value_p++; + info.expr_value_p->avalbits = highvalue; + info.expr_value_p->bvalbits = 0; + + tf_ipropagatep(nparam, instance); + return; +} + +int tf_getlongp(int *aof_highvalue, int nparam) +{ + return tf_igetlongp(aof_highvalue, nparam, tf_getinstance()); +} + +int tf_igetlongp(int *aof_highvalue, int nparam, char *instance) +{ + s_tfexprinfo info; + + tf_iexprinfo(nparam, &info, instance); + if (info.expr_ngroups < 2) { + return (0); + } + + if (info.expr_type == tf_string) { + return ((LP64) info.expr_string); + } + + *aof_highvalue = (info.expr_value_p + 1)->avalbits; + return (info.expr_value_p->avalbits); +} + +double tf_getrealp(int nparam) +{ + return tf_igetrealp(nparam, tf_getinstance()); +} + +double tf_igetrealp(int nparam, char *instance) +{ + s_tfexprinfo info; + + tf_iexprinfo(nparam, &info, instance); + + if (info.expr_type != tf_readonlyreal + && info.expr_type != tf_readwritereal) { + return (0.0); + } + + return (info.real_value); +} + +void tf_putrealp(int nparam, double value) +{ + tf_iputrealp(nparam, value, tf_getinstance()); + return; +} + +void tf_iputrealp(int nparam, double value, char *instance) +{ + s_tfexprinfo info; + Group *g; + + + // handle function return here + if (nparam == 0) { + g = DECL_STORAGE(FUNC_REF_RETURNDECL((tree) instance)); + REAL_(g) = value; + return; + } + + tf_iexprinfo(nparam, &info, instance); + if (info.expr_ngroups < 1) { + return; + } + + if (info.expr_type != tf_readonlyreal + && info.expr_type != tf_readwritereal) { + return; + } + + ((Group *) info.expr_value_p)->real = value; + + tf_ipropagatep(nparam, instance); + return; +} + +/************************************************************************ + tf_getcstringp + tf_igetcstringp +/***********************************************************************/ + + +char *tf_getcstringp(int argnum) +{ + return (tf_igetcstringp(argnum, tf_getinstance())); +} + +char *tf_igetcstringp(int argnum, char *instance) +{ + s_tfexprinfo info; + + + tf_iexprinfo(argnum, &info, instance); + + return (info.expr_string); +} + +/************************************************************************ + GroupToString +/***********************************************************************/ + +static char *GroupToString(Group * g, int nbits, int ngroups) +{ + char buffer[1024]; + int bufferIndex; + int groupIndex; + int byteIndex; + int charPerBit; + char *ptr; + char numberOfChars; + int limit; + + charPerBit = sizeof(Bit) / sizeof(char); + numberOfChars = (nbits + 7) / 8; + bufferIndex = 0; + for (groupIndex = ngroups - 1; groupIndex >= 0; groupIndex--) { + ptr = (char *) &AVAL(&g[groupIndex]); + if (groupIndex != ngroups - 1) { + limit = 3; + } else { + limit = numberOfChars % charPerBit; + if (limit != 0) { + limit--; + } else { + limit = 3; + } + } + for (byteIndex = limit; byteIndex >= 0; byteIndex--) { +#ifdef WORDS_BIGENDIAN + buffer[bufferIndex] = ptr[charPerBit - byteIndex - 1]; +#else + buffer[bufferIndex] = ptr[byteIndex]; +#endif + bufferIndex += 1; + numberOfChars -= 1; + } + } + + buffer[bufferIndex] = 0; + + return (pli_write_string(buffer)); +} + +/************************************************************************ + StringToGroup +/***********************************************************************/ + +static void StringToGroup(char *string, Group * g, int nbits, int ngroups) +{ + char buffer[1024]; + int bufferIndex; + int groupIndex; + int byteIndex; + int charPerBit; + char *ptr; + char numberOfChars; + int limit; + int length; + + charPerBit = sizeof(Bit) / sizeof(char); + numberOfChars = (nbits + 7) / 8; + length = strlen(string); + + + bufferIndex = 0; + for (groupIndex = ngroups - 1; groupIndex >= 0; groupIndex--) { + ptr = (char *) &AVAL(&g[groupIndex]); + BVAL(&g[groupIndex]) = 0; + if (groupIndex != ngroups - 1) { + limit = 3; + } else { + limit = numberOfChars % charPerBit; + if (limit != 0) { + limit--; + } else { + limit = 3; + } + } + for (byteIndex = limit; byteIndex >= 0; byteIndex--) { +#ifdef WORDS_BIGENDIAN + if (numberOfChars > length) { + ptr[charPerBit - byteIndex - 1] = 0; + } else { + ptr[charPerBit - byteIndex - 1] = string[bufferIndex]; + bufferIndex += 1; + } +#else + if (numberOfChars > length) { + ptr[byteIndex] = 0; + } else { + ptr[byteIndex] = string[bufferIndex]; + bufferIndex += 1; + } +#endif + numberOfChars -= 1; + } + } + +} + +/**************************************************************** + tf_compare_long + **************************************************************** + */ +int tf_compare_long(int low1, int high1, int low2, int high2) +{ + Bit a[2]; + Bit b[2]; + Bit c[3]; + + b[0] = low1; + b[1] = high1; + + c[0] = low2; + c[1] = high2; + + BitSub(a, b, c, 2); + + if (a[0] == 0 && a[1] == 0) { + return (0); + } else if (a[0] < 0) { + return (-1); + } else { + return (1); + } +} + +/**************************************************************** + tf_add_long + **************************************************************** + */ +void tf_add_long(int *low1p, int *high1p, int low2, int high2) +{ + Bit a[2]; + Bit b[2]; + Bit c[3]; + + b[0] = *low1p; + b[1] = *high1p; + + c[0] = low2; + c[1] = high2; + + BitAdd(a, b, c, 2); + + *low1p = a[0]; + *high1p = a[1]; +} + +/**************************************************************** + tf_subtract_long + **************************************************************** + */ +void tf_subtract_long(int *low1p, int *high1p, int low2, int high2) +{ + Bit a[2]; + Bit b[2]; + Bit c[3]; + + b[0] = *low1p; + b[1] = *high1p; + + c[0] = low2; + c[1] = high2; + + BitSub(a, b, c, 2); + + *low1p = a[0]; + *high1p = a[1]; +} + +/**************************************************************** + tf_multiply_long + **************************************************************** + */ +void tf_multiply_long(int *low1p, int *high1p, int low2, int high2) +{ + Group a[4]; + Group b[2]; + Group c[2]; + int sign; + + sign = 1; + + if (*high1p < 0) { + sign = sign ^ 1; + AVAL(&b[0]) = ~*low1p; + AVAL(&b[1]) = ~*high1p; + AVAL(&b[0])++; + if (AVAL(&b[0]) == 0) { + AVAL(&b[1])++; + } + } else { + AVAL(&b[0]) = *low1p; + AVAL(&b[1]) = *high1p; + } + + if (high2 < 0) { + sign = sign ^ 1; + AVAL(&c[0]) = ~low2; + AVAL(&c[1]) = ~high2; + AVAL(&c[0])++; + if (AVAL(&c[0]) == 0) { + AVAL(&c[1])++; + } + } else { + AVAL(&c[0]) = low2; + AVAL(&c[1]) = high2; + } + + GroupMult(a, b, c, 2); + + if (sign) { + *low1p = AVAL(&a[0]); + *high1p = AVAL(&a[1]); + } else { + *low1p = ~AVAL(&a[0]); + *high1p = ~AVAL(&a[1]); + (*low1p)++; + if (*low1p == 0) { + (*high1p)++; + } + } + +} + +/**************************************************************** + tf_divide_long + **************************************************************** + */ +void tf_divide_long(int *low1p, int *high1p, int low2, int high2) +{ + Group a[2]; + Group b[2]; + Group c[2]; + Group m[2]; + int sign; + + sign = 1; + + if (*high1p < 0) { + sign = sign ^ 1; + AVAL(&b[0]) = ~*low1p; + AVAL(&b[1]) = ~*high1p; + AVAL(&b[0])++; + if (AVAL(&b[0]) == 0) { + AVAL(&b[1])++; + } + } else { + AVAL(&b[0]) = *low1p; + AVAL(&b[1]) = *high1p; + } + + if (high2 < 0) { + sign = sign ^ 1; + AVAL(&c[0]) = ~low2; + AVAL(&c[1]) = ~high2; + AVAL(&c[0])++; + if (AVAL(&c[0]) == 0) { + AVAL(&c[1])++; + } + } else { + AVAL(&c[0]) = low2; + AVAL(&c[1]) = high2; + } + + GroupDiv(a, m, b, c, 2, 0); + + if (sign) { + *low1p = AVAL(&a[0]); + *high1p = AVAL(&a[1]); + } else { + *low1p = ~AVAL(&a[0]); + *high1p = ~AVAL(&a[1]); + (*low1p)++; + if (*low1p == 0) { + (*high1p)++; + } + } + +} + +/**************************************************************** + + acc_fetch_delays + - retrieve delays for given object + +*****************************************************************/ +bool acc_fetch_delays(handle object, ...) +{ + tree pathInstance; + tree pathDesc; + tree instance; + tree constraint; + tree module; + tree t = (tree) object; + double scaleFactor; + int delayCount; + double d1; + double d2; + double d3; + double d4; + double d5; + double d6; + double *dp[18]; + va_list ap; + int i; + + va_start(ap, object); + for (i = 0; i < 18; i++) { + dp[i] = va_arg(ap, double *); + } + va_end(ap); + + acc_error_flag = FALSE; + + switch (acc_fetch_type(object)) { + + case accTchk: + ASSERT(TREE_CODE((tree) object) == TIMING_CHECK); + d1 = (double) TIMING_CHECK_PARAM1((tree) object); + delayCount = 1; + switch (acc_fetch_fulltype(object)) { + case accSetuphold: + case accNochange: + d2 = TIMING_CHECK_PARAM2((tree) object); + delayCount = 2; + break; + default: + break; + } + break; + + case accPrimitive: + + if (GATE_DELAY(t)) { + d1 = (double) eval_delay(GATE_DELAY(t), ONE); + delayCount = 1; + if (pli_info.config.accPathDelayCount_ >= 2) { + d2 = (double) eval_delay(GATE_DELAY(t), ZERO); + delayCount = 2; + } + if (pli_info.config.accPathDelayCount_ >= 3) { + d3 = (double) eval_delay(GATE_DELAY(t), Z); + delayCount = 3; + } + } else { + d1 = 0; + delayCount = 1; + if (pli_info.config.accPathDelayCount_ >= 2) { + d2 = 0; + delayCount = 2; + } + if (pli_info.config.accPathDelayCount_ >= 3) { + d3 = 0; + delayCount = 3; + } + } + break; + + case accPath: + pathInstance = t; + ASSERT(TREE_CODE(pathInstance) == PATH_INSTANCE); + + pathDesc = PATH_INSTANCE_PATHDESC(pathInstance); + ASSERT(TREE_CODE(pathDesc) == PATH_NODE); + + module = PATH_INSTANCE_MODULE(pathInstance); + ASSERT(TREE_CODE(module) == MODULE_BLOCK); + + for (instance = MODULE_SPECINST(module); + instance != NULL_TREE; instance = TREE_CHAIN(instance)) { + + if (TREE_CODE(instance) != PATH_OUTPUT) { + continue; + } + + + for (constraint = PATH_OUTPUT_CONSTRAINTS(instance); + constraint != NULL_TREE; + constraint = TREE_CHAIN(constraint)) { + + ASSERT(TREE_CODE(constraint) == PATH_CONSTRAINT); + if (PATH_CONSTRAINT_PATHDESC(constraint) == pathDesc) { + d1 = (double) PATH_CONSTRAINT_DELAY(constraint, ZERO, + ONE); + delayCount = 1; + if (pli_info.config.accPathDelayCount_ >= 2) { + d2 = (double) PATH_CONSTRAINT_DELAY(constraint, + ONE, ZERO); + delayCount = 2; + } + if (pli_info.config.accPathDelayCount_ >= 3) { + d3 = (double) PATH_CONSTRAINT_DELAY(constraint, + ZERO, Z); + delayCount = 3; + } + if (pli_info.config.accPathDelayCount_ == 6) { + d4 = (double) PATH_CONSTRAINT_DELAY(constraint, Z, + ONE); + d5 = (double) PATH_CONSTRAINT_DELAY(constraint, + ONE, Z); + d6 = (double) PATH_CONSTRAINT_DELAY(constraint, Z, + ZERO); + delayCount = 6; + } + goto done; + } + } + } + break; + + } + done: + scaleFactor = pow(10.0, tf_igettimeprecision(null) - + tf_igettimeprecision((char *) + acc_handle_parent(object))); + + switch (delayCount) { + case 6: + if (pli_info.config.accMinTypMaxDelays_) { + *dp[17] = d6 * scaleFactor; + *dp[16] = *dp[17]; + *dp[15] = *dp[17]; + } else { + *dp[5] = d6 * scaleFactor; + } + case 5: + if (pli_info.config.accMinTypMaxDelays_) { + *dp[14] = d5 * scaleFactor; + *dp[13] = *dp[14]; + *dp[12] = *dp[14]; + } else { + *dp[4] = d5 * scaleFactor; + } + case 4: + if (pli_info.config.accMinTypMaxDelays_) { + *dp[11] = d4 * scaleFactor; + *dp[10] = *dp[11]; + *dp[9] = *dp[11]; + } else { + *dp[3] = d4 * scaleFactor; + } + case 3: + if (pli_info.config.accMinTypMaxDelays_) { + *dp[8] = d3 * scaleFactor; + *dp[7] = *dp[8]; + *dp[6] = *dp[8]; + } else { + *dp[2] = d3 * scaleFactor; + } + case 2: + if (pli_info.config.accMinTypMaxDelays_) { + *dp[5] = d2 * scaleFactor; + *dp[4] = *dp[5]; + *dp[3] = *dp[5]; + } else { + *dp[1] = d2 * scaleFactor; + } + case 1: + if (pli_info.config.accMinTypMaxDelays_) { + *dp[2] = d1 * scaleFactor; + *dp[1] = *dp[2]; + *dp[0] = *dp[2]; + } else { + *dp[0] = d1 * scaleFactor; + } + break; + default: + acc_error_flag = TRUE; + tf_error("Illegal object in acc_fetch_delays()"); + return (0); + } + + return (1); +} + +/**************************************************************** + + acc_replace_delays + - replace delays for given object + +*****************************************************************/ +bool acc_replace_delays(handle object, ...) +{ + tree pathInstance; + tree pathDesc; + tree instance; + tree constraint; + tree module; + tree delayNode; + int delayCount; + double scaleFactor; + double d1; + double d2; + double d3; + double d4; + double d5; + double d6; + va_list ap; + + acc_error_flag = FALSE; + + va_start(ap, object); + if (pli_info.config.accMinTypMaxDelays_ && delay_type == MIN_DELAY) { + d1 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d2 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d3 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d4 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d5 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d6 = va_arg(ap, double); + } else if (pli_info.config.accMinTypMaxDelays_ + && delay_type == TYP_DELAY) { + va_arg(ap, double); + d1 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d2 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d3 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d4 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d5 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d6 = va_arg(ap, double); + } else if (pli_info.config.accMinTypMaxDelays_ + && delay_type == MAX_DELAY) { + va_arg(ap, double); + va_arg(ap, double); + d1 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d2 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d3 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d4 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d5 = va_arg(ap, double); + va_arg(ap, double); + va_arg(ap, double); + d6 = va_arg(ap, double); + } else { + d1 = va_arg(ap, double); + d2 = va_arg(ap, double); + d3 = va_arg(ap, double); + d4 = va_arg(ap, double); + d5 = va_arg(ap, double); + d6 = va_arg(ap, double); + } + va_end(ap); + + scaleFactor = pow(10.0, tf_igettimeprecision(null) - + tf_igettimeprecision((char *) + acc_handle_parent(object))); + d1 *= scaleFactor; + d2 *= scaleFactor; + d3 *= scaleFactor; + d4 *= scaleFactor; + d5 *= scaleFactor; + d6 *= scaleFactor; + + switch (acc_fetch_type(object)) { + case accTchk: + ASSERT(TREE_CODE((tree) object) == TIMING_CHECK); + TIMING_CHECK_PARAM1((tree) object) = (int) max(d1, 0); + switch (acc_fetch_fulltype(object)) { + case accSetuphold: + case accNochange: + TIMING_CHECK_PARAM2((tree) object) = (int) max(d2, 0); + break; + default: + break; + } + break; + + case accPrimitive: + // determine number of delays + switch (acc_fetch_fulltype(object)) { + case accBufif0Gate: + case accBufif1Gate: + case accNotif0Gate: + case accNotif1Gate: + case accNmosGate: + case accPmosGate: + case accRnmosGate: + case accRpmosGate: + case accCmosGate: + case accRcmosGate: + delayCount = 3; + break; + case accPulldownGate: + case accPullupGate: + case accTranGate: + case accRtranGate: + delayCount = 0; + break; + default: + delayCount = 2; + break; + } + + // create a new delay node + switch (delayCount) { + case 2: + delayNode = build_nt(DELAY_EXPR, + build_int_cst((int) max(d1, 0)), + build_int_cst((int) max(d2, 0))); + TREE_LABEL(delayNode) = 2; + break; + case 3: + if (pli_info.config.accToHiZDelay_ == eDelayMin) { + d3 = min(d1, d2); + } else if (pli_info.config.accToHiZDelay_ == eDelayMax) { + d3 = max(d1, d2); + } else if (pli_info.config.accToHiZDelay_ == eDelayAverage) { + d3 = (d1 + d2) / 2; + } + + delayNode = build_nt(DELAY_EXPR, + build_int_cst((int) max(d1, 0)), + build_int_cst((int) max(d2, 0)), + build_int_cst((int) max(d3, 0))); + TREE_LABEL(delayNode) = 3; + break; + default: + return (false); + } + + + // create code for delay + pass3_delay(delayNode); + ASSERT(TREE_CODE((tree) object) == GATE_INSTANCE); + GATE_DELAY((tree) object) = delayNode; + break; + case accModPath: + + pathInstance = (tree) object; + ASSERT(TREE_CODE(pathInstance) == PATH_INSTANCE); + + pathDesc = PATH_INSTANCE_PATHDESC(pathInstance); + ASSERT(TREE_CODE(pathDesc) == PATH_NODE); + + module = PATH_INSTANCE_MODULE(pathInstance); + ASSERT(TREE_CODE(module) == MODULE_BLOCK); + + for (instance = MODULE_SPECINST(module); + instance != NULL_TREE; instance = TREE_CHAIN(instance)) { + + if (TREE_CODE(instance) != PATH_OUTPUT) { + continue; + } + + + for (constraint = PATH_OUTPUT_CONSTRAINTS(instance); + constraint != NULL_TREE; + constraint = TREE_CHAIN(constraint)) { + + ASSERT(TREE_CODE(constraint) == PATH_CONSTRAINT); + if (PATH_CONSTRAINT_PATHDESC(constraint) == pathDesc) { + int oldTurnOff[2]; + int newTurnOff[2]; + oldTurnOff[0] = + PATH_CONSTRAINT_DELAY(constraint, ZERO, Z); + oldTurnOff[1] = + PATH_CONSTRAINT_DELAY(constraint, ONE, Z); + switch (pli_info.config.accPathDelayCount_) { + case 1: + PATH_CONSTRAINT_DELAY(constraint, ZERO, ONE) = + (int) d1; + PATH_CONSTRAINT_DELAY(constraint, ONE, ZERO) = + (int) d1; + PATH_CONSTRAINT_DELAY(constraint, Z, ONE) = + (int) d1; + PATH_CONSTRAINT_DELAY(constraint, Z, ZERO) = + (int) d1; + newTurnOff[0] = (int) max(d1, 0); + newTurnOff[1] = (int) max(d1, 0); + break; + case 2: + PATH_CONSTRAINT_DELAY(constraint, ZERO, ONE) = + (int) d1; + PATH_CONSTRAINT_DELAY(constraint, ONE, ZERO) = + (int) d2; + PATH_CONSTRAINT_DELAY(constraint, Z, ONE) = + (int) d1; + PATH_CONSTRAINT_DELAY(constraint, Z, ZERO) = + (int) d2; + newTurnOff[0] = (int) max(d1, 0); + newTurnOff[1] = (int) max(d2, 0); + break; + case 3: + PATH_CONSTRAINT_DELAY(constraint, ZERO, ONE) = + (int) d1; + PATH_CONSTRAINT_DELAY(constraint, ONE, ZERO) = + (int) d2; + PATH_CONSTRAINT_DELAY(constraint, Z, ONE) = + (int) d1; + PATH_CONSTRAINT_DELAY(constraint, Z, ZERO) = + (int) d2; + newTurnOff[0] = (int) max(d3, 0); + newTurnOff[1] = (int) max(d3, 0); + break; + case 6: + PATH_CONSTRAINT_DELAY(constraint, ZERO, ONE) = + (int) d1; + PATH_CONSTRAINT_DELAY(constraint, ONE, ZERO) = + (int) d2; + PATH_CONSTRAINT_DELAY(constraint, Z, ONE) = + (int) d4; + PATH_CONSTRAINT_DELAY(constraint, Z, ZERO) = + (int) d6; + newTurnOff[0] = (int) max(d3, 0); + newTurnOff[1] = (int) max(d5, 0); + break; + } + if (pli_info.config.accToHiZDelay_ == eDelayMin) { + PATH_CONSTRAINT_DELAY(constraint, ZERO, Z) = + min(newTurnOff[0], newTurnOff[1]); + PATH_CONSTRAINT_DELAY(constraint, ONE, Z) = + min(newTurnOff[0], newTurnOff[1]); + } else if (pli_info.config.accToHiZDelay_ == eDelayMax) { + PATH_CONSTRAINT_DELAY(constraint, ZERO, Z) = + max(newTurnOff[0], newTurnOff[1]); + PATH_CONSTRAINT_DELAY(constraint, ONE, Z) = + max(newTurnOff[0], newTurnOff[1]); + } else if (pli_info.config.accToHiZDelay_ == + eDelayAverage) { + PATH_CONSTRAINT_DELAY(constraint, ZERO, Z) = + avg(newTurnOff[0], newTurnOff[1]); + PATH_CONSTRAINT_DELAY(constraint, ONE, Z) = + avg(newTurnOff[0], newTurnOff[1]); + } else { + PATH_CONSTRAINT_DELAY(constraint, ZERO, Z) = + newTurnOff[0]; + PATH_CONSTRAINT_DELAY(constraint, ONE, Z) = + newTurnOff[1]; + } + setXPathConstraints(constraint); + } + } + } + break; + default: + acc_error_flag = TRUE; + tf_error("Illegal object in acc_replace_delays()"); + return (0); + + } + return (1); +} + + +/**************************************************************** + + acc_append_delays + - add delays for given object + +*****************************************************************/ +bool acc_append_delays(handle object, ...) +{ + double xd[18]; + int save_error_flag; + va_list ap; + int i; + + acc_error_flag = FALSE; + save_error_flag = pli_info.config.accDisplayErrors_; + pli_info.config.accDisplayErrors_ = 0; + if (!acc_fetch_delays + (object, &xd[0], &xd[1], &xd[2], &xd[3], &xd[4], &xd[5], &xd[6], + &xd[7], &xd[8], &xd[9], &xd[10], &xd[11], &xd[12], &xd[13], + &xd[14], &xd[15], &xd[16], &xd[17])) { + acc_error_flag = TRUE; + pli_info.config.accDisplayErrors_ = save_error_flag; + tf_error("Illegal object in acc_append_delays()"); + return (0); + + } + + va_start(ap, object); + for (i = 0; i < 18; i++) { + xd[i] += va_arg(ap, double); + } + va_end(ap); + + if (!acc_replace_delays + (object, xd[0], xd[1], xd[2], xd[3], xd[4], xd[5], xd[6], xd[7], + xd[8], xd[9], xd[10], xd[11], xd[12], xd[13], xd[14], xd[15], + xd[16], xd[17])) { + acc_error_flag = TRUE; + pli_info.config.accDisplayErrors_ = save_error_flag; + tf_error("Illegal object in acc_append_delays()"); + return (0); + + } + pli_info.config.accDisplayErrors_ = save_error_flag; + return (1); + +} + +/**************************************************************** + acc_fetch_pulsere +*****************************************************************/ +bool +acc_fetch_pulsere(handle path, double *f1, double *e1, double *f2, + double *e2, double *f3, double *e3, double *f4, + double *e4, double *f5, double *e5, double *f6, + double *e6) +{ + acc_error_flag = FALSE; + tf_error("acc_fetch_pulsere() not supported"); + return (0); +} + +/**************************************************************** + acc_append_pulsere +*****************************************************************/ +bool +acc_append_pulsere(handle path, double f1, double e1, double f2, double e2, + double f3, double e3, double f4, double e4, double f5, + double e5, double f6, double e6) +{ + acc_error_flag = TRUE; + tf_error("acc_append_pulsere() not supported"); + return (0); +} + +/**************************************************************** + acc_replace_pulsere +*****************************************************************/ +bool +acc_replace_pulsere(handle path, double f1, double e1, double f2, + double e2, double f3, double e3, double f4, double e4, + double f5, double e5, double f6, double e6) +{ + acc_error_flag = TRUE; + tf_error("acc_replace_pulsere() not supported"); + return (0); +} + +/**************************************************************** + acc_set_pulsere +*****************************************************************/ +bool +acc_set_pulsere(handle path, double reject_percentage, double e_percentage) +{ + acc_error_flag = TRUE; + tf_error("acc_set_pulsere() not supported"); + return (0); +} + +/************************************************************************ + * acc_fetch_value * +/***********************************************************************/ + +char *acc_fetch_value(handle object, char *format, ...) +{ + int num_bits = acc_fetch_size(object); + int num_chars; + enum radii radix; + Group *g; + char *return_pointer; + int num_groups; + p_acc_value value; + va_list ap; + char *result; + + acc_error_flag = FALSE; + num_groups = (num_bits - 1) / 32 + 1; + g = fetch_storage((tree) object); + + switch (format[1]) { + case 'b': + radix = BIN; + num_chars = num_bits; + break; + + case 'd': + radix = DEC; + num_chars = num_bits / 3; + break; + + case 'o': + radix = OCT; + num_chars = num_bits / 3; + break; + + case 'h': + case 'x': + radix = HEX; + num_chars = num_bits / 4; + break; + + case '%': + va_start(ap, format); + value = va_arg(ap, p_acc_value); + switch (value->format) { + case accBinStrVal: + result = acc_fetch_value(object, "%b"); + value->value.str = result; + break; + case accOctStrVal: + result = acc_fetch_value(object, "%o"); + value->value.str = result; + break; + case accDecStrVal: + result = acc_fetch_value(object, "%d"); + value->value.str = result; + break; + case accHexStrVal: + result = acc_fetch_value(object, "%h"); + value->value.str = result; + break; + case accIntVal: + value->value.integer = AVAL(g); + result = NULL; + break; + case accRealVal: + value->value.real = g->real; + result = NULL; + break; + case accScalarVal: + switch ((AVAL(g) & 1) | ((BVAL(g) & 1) << 1)) { + case 0: + value->value.scalar = vcl0; + break; + case 1: + value->value.scalar = vcl1; + break; + case 2: + value->value.scalar = vclZ; + break; + case 3: + value->value.scalar = vclX; + break; + } + result = NULL; + break; + case accStringVal: + value->value.str = GroupToString(g, num_bits, num_groups); + result = NULL; + break; + case accVectorVal: + memcpy(value->value.vector, g, + num_groups * sizeof(s_acc_vecval)); + result = NULL; + break; + } + va_end(ap); + return (result); + case 'v': + default: + acc_error_flag = FALSE; + return (null); + } + global_print_override = 1; + global_print_buffer = (char *) xmalloc(num_chars + 1); + global_print_p = global_print_buffer; + print_datum_file(0, g, (nbits_t) 0, num_bits, radix, 0, 1, 0); + + return_pointer = pli_write_string(global_print_buffer); + + free(global_print_buffer); + global_print_override = 0; + return return_pointer; +} + +/************************************************************************ + * + * tf_strgetp + * tf_istrgetp + * + ***********************************************************************/ + +char *tf_strgetp(int nparam, char format_character) +{ + return (tf_istrgetp(nparam, format_character, tf_getinstance())); +} + +char *tf_istrgetp(int nparam, char format_character, char *instance) +{ + char *result; + tree arg; + Group *g; + int numbits; + enum radii radix; + int num_chars; + + + result = NULL; + arg = nth_parameter(nparam, (tree) instance); + if (arg == NULL) { + return (result); + } + + numbits = TREE_NBITS(*TREE_EXPR_CODE(arg)); + stack_allocate(); + eval(TREE_EXPR_CODE(arg)); + g = *--R; + + switch (format_character) { + case 'd': + case 'D': + radix = DEC; + num_chars = numbits / 3; + break; + case 'h': + case 'H': + radix = HEX; + num_chars = numbits / 4; + break; + case 'b': + case 'B': + radix = BIN; + num_chars = numbits; + break; + case 'o': + case 'O': + radix = OCT; + num_chars = numbits / 3; + break; + default: + return (NULL); + } + global_print_override = 1; + global_print_buffer = (char *) xmalloc(num_chars + 1); + global_print_p = global_print_buffer; + print_datum_file(0, g, (nbits_t) 0, numbits, radix, 0, 0, 0); + + result = pli_write_string(global_print_buffer); + + free(global_print_buffer); + global_print_override = 0; + return (result); +} + +/************************************************************************ + * acc_vcl_add * +/***********************************************************************/ + +void +acc_vcl_add(handle hobject, int (*routine) (s_vc_record *), + char *user_data, int VCL_flags) +{ + struct pli_vcl *vcl; + Marker *vcl_marker; + struct Marker_info marker_info; + + tree object = (tree) hobject; + + acc_error_flag = FALSE; + + if (VCL_flags != vcl_verilog_logic + && VCL_flags != vcl_verilog_strength) { + acc_error_flag = TRUE; + tf_error + ("only 'vcl_verilog_logic' flag is supported in acc_vcl_add()"); + return; + } + // check for a port or terminal + + if (TREE_CODE(object) == TREE_LIST) { + object = TREE_PURPOSE(object); + if (PORT_REDEFINED_ATTR(object)) { + object = DECL_THREAD(object); + } + } + + if (*tree_code_type[TREE_CODE(object)] != 'd') { + tf_error("Illegal object type for acc_vcl_add"); + acc_error_flag = TRUE; + return; + } + + if (lookup_vcl(object, routine, user_data, &vcl_marker)) { + tf_warning("vcl already set in acc_vcl_add()"); + return; + } + + marker_info.first = NULL; + marker_info.last = NULL; + marker_info.current_scb = NULL; /* This will bypass SCBs */ + marker_info.flags = (enum marker_flags) (M_VCL + M_FIXED); + marker_info.delay = 0; + + BuildMarker(object, &marker_info); + vcl_marker = marker_info.first; + vcl = (struct pli_vcl *) xmalloc(sizeof(struct pli_vcl)); + vcl->marker = vcl_marker; + vcl->decl = object; + vcl->routine = routine; + vcl->user_data = user_data; + vcl_marker->expr.vcl = vcl; +} + +/* Scan the markers for an object (already assumed to be a decl) for one that + was generated by a similar acc_vcl_add call. If found, pass make the + marker address and return nonzero. */ + +static int +lookup_vcl(tree hobject, int (*routine) (s_vc_record *), char *user_data, + Marker ** marker) +{ + Marker *mark; + tree object = (tree) hobject; + for (mark = DECL_EVENT_CHAIN(object); mark; mark = mark->next) { + if (mark->flags & M_VCL) { + struct pli_vcl *vcl = (struct pli_vcl *) mark->expr.vcl; + if (vcl->routine == routine && vcl->user_data == user_data) { + *marker = mark; + return 1; + } + } + } + return 0; +} + +//struct t_vc_record vc_record; +s_vc_record vc_record; + +/* This is called from the scheduler when a vcl var has changed */ + +void vcl_dispatch(struct pli_vcl *vcl) +{ + Group *g; + int ival; + + g = DECL_STORAGE(vcl->decl); + vc_record.vc_hightime = CurrentTime.timeh; + vc_record.vc_lowtime = CurrentTime.timel; + vc_record.user_data = vcl->user_data; + + switch (TREE_CODE(vcl->decl)) { + case REG_SCALAR_DECL: + vc_record.vc_reason = sregister_value_change; + goto logic_common; + + case NET_SCALAR_DECL: + vc_record.vc_reason = logic_value_change; + logic_common: + ival = (AVAL(g) & 1) | ((BVAL(g) & 1) << 1); + switch (ival) { + case 0: + vc_record.out_value.logic_value = vcl0; + break; + case 1: + vc_record.out_value.logic_value = vcl1; + break; + case 2: + vc_record.out_value.logic_value = vclZ; + break; + case 3: + vc_record.out_value.logic_value = vclX; + break; + } + break; + + + case REG_VECTOR_DECL: + vc_record.vc_reason = vregister_value_change; + goto vector_common; + + case NET_VECTOR_DECL: + vc_record.vc_reason = vector_value_change; + goto vector_common; + + case INTEGER_DECL: + vc_record.vc_reason = integer_value_change; + goto vector_common; + + case TIME_DECL: + vc_record.vc_reason = time_value_change; + vector_common: + vc_record.out_value.vector_handle = (handle) vcl->decl; + break; + + case REAL_DECL: + vc_record.vc_reason = real_value_change; + vc_record.out_value.real_value = REAL_(g); + break; + + case EVENT_DECL: + vc_record.vc_reason = event_value_change; + goto vector_common; + + + default: + tf_error("Unknown type while dispatching vcl"); + return; + } + (vcl->routine) (&vc_record); +} + +/************************************************************************ + * acc_vcl_delete * +/***********************************************************************/ + +void +acc_vcl_delete(handle hobject, int (*routine) (s_vc_record *), + char *user_data, int VCL_flags) +{ + Marker *vcl_marker; + tree object = (tree) hobject; + + acc_error_flag = FALSE; + if (VCL_flags != vcl_verilog_logic) { + acc_error_flag = TRUE; + tf_error + ("only 'vcl_verilog_logic' flag is supported in acc_vcl_delete()"); + return; + } + + if (lookup_vcl(object, routine, user_data, &vcl_marker)) { + event_undo(vcl_marker); + free(vcl_marker); + } +} + +/**************************************************************** + acc_handle_simulated_net + *****************************************************************/ + +handle acc_handle_simulated_net(handle collapsed_net_handle) +{ + acc_error_flag = FALSE; + // collapsed nets current aren't created + return collapsed_net_handle; +} + +/**************************************************************** + acc_compare_handles + *****************************************************************/ + +bool acc_compare_handles(handle object1, handle object2) +{ + + acc_error_flag = FALSE; + + if (acc_fetch_type(object1) == acc_fetch_type(object2) && + acc_handle_parent(object1) == acc_handle_parent(object2) && + !strcmp(acc_fetch_name(object1), acc_fetch_name(object2))) { + return TRUE; + } + return FALSE; +} + +/**************************************************************** + acc_set_scope +*****************************************************************/ +char *acc_set_scope(handle module, char *name) +{ + acc_error_flag = FALSE; + if (!pli_info.config.accEnableArgsSetScope_) { + if (module == NULL) { + pli_info.scope = acc_next_topmod(NULL); + } else { + pli_info.scope = module; + } + } else { + if (module == NULL && name == NULL) { + pli_info.scope = acc_next_topmod(NULL); + } else if (module == NULL) { + pli_info.scope = resolve_path(NULL, name); + } else { + pli_info.scope = module; + } + } + if (pli_info.scope == NULL) { + tf_error("Unable to set scope in acc_set_scope()"); + acc_error_flag = TRUE; + return (NULL); + } + + return acc_fetch_fullname(pli_info.scope); +} + + + +/*************************************************************** + + append_hierarchy + - add name of parents to string + +****************************************************************/ + +static void append_hierarchy(handle object) +{ + handle parent; + + if (object == NULL) { + return; + } + + parent = acc_handle_parent(object); + if (parent != NULL) { + append_hierarchy(parent); + } + append_name(object); + pli_append_string("."); +} + +/*************************************************************** + + acc_fetch_fullname + - return full name of object + +****************************************************************/ +char *acc_fetch_fullname(handle object) +{ + acc_error_flag = FALSE; + + if (object == NULL) { + acc_error_flag = TRUE; + tf_error("Bad handle in acc_fetch_fullname()"); + return (NULL); + } + + pli_write_string(NULL); // start a new string + append_hierarchy(acc_handle_parent(object)); + return (append_name(object)); +} + +/**************************************************************** + + acc_handle_object + - return the handle to named object + +*****************************************************************/ + +handle acc_handle_object(char *path) +{ + handle object; + acc_error_flag = FALSE; + object = acc_handle_by_name(path, pli_info.scope); + if (object == NULL) { + object = acc_handle_by_name(path, null); + } + if (object == NULL) { + acc_error_flag = TRUE; + } + return (object); +} + +/************************************************************************ + * acc_next_scope * +/***********************************************************************/ + +handle acc_next_scope(handle module, handle scope) +{ + + acc_error_flag = FALSE; + if (!module) + return acc_next_topmod(scope); + else if (!scope) + return (handle) BLOCK_DOWN((tree) module); + else + return (handle) TREE_CHAIN((tree) scope); +} + +/************************************************************************ + * acc_reset_buffer * +/***********************************************************************/ + +void acc_reset_buffer(void) +{ + acc_error_flag = FALSE; + pli_info.p = pli_info.stringbuf; + pli_info.lastCopy = NULL; +} + +/************************************************************************ + * acc_set_interactive_scope * +/***********************************************************************/ + +handle acc_set_interactive_scope(void) +{ + acc_error_flag = FALSE; + pli_info.scope = (handle) current_scope; + return (pli_info.scope); +} + +/************************************************************************ + * acc_handle_interactive_scope * +/***********************************************************************/ + +handle acc_handle_interactive_scope(void) +{ + acc_error_flag = FALSE; + return (handle) current_scope; +} + +/************************************************************************ + * acc_handle_tfinst * +/***********************************************************************/ + +handle acc_handle_tfinst(void) +{ + acc_error_flag = FALSE; + return (handle) tf_getinstance(); +} + +/************************************************************************ + * tf_write_save * +/***********************************************************************/ + +int tf_write_save(char *blockptr, int blocklen) +{ + tf_error("tf_write_save() is not supported"); + return (0); +} + +/************************************************************************ + * tf_read_restart * +/***********************************************************************/ + +int tf_read_restart(char *blockptr, int blocklen) +{ + tf_error("tf_read_restart() is not supported"); + return (0); +} + +/************************************************************************ + * acc_handle_scope * +/***********************************************************************/ + +handle acc_handle_scope(handle object) +{ + return acc_handle_parent(object); +} + +/************************************************************************ + * acc_fetch_tfarg * +/***********************************************************************/ + +double acc_fetch_tfarg(int argumentNumber) +{ + int type; + int high; + int low; + double result; + int size; + + acc_error_flag = FALSE; + + if (argumentNumber < 1 || argumentNumber > tf_nump()) { + tf_warning + ("argument number %d is out of range in acc_fetch_tfarg()", + argumentNumber); + return (0.0); + } + + type = tf_typep(argumentNumber); + size = tf_sizep(argumentNumber); + + switch (type) { + case tf_readonly: + case tf_readwrite: + case tf_rwbitselect: + case tf_rwpartselect: + if (size <= 32) { + high = 0; + low = tf_getp(argumentNumber); + tf_long_to_real(low, high, &result); + return (result); + } else { + low = tf_getlongp(&high, argumentNumber); + tf_long_to_real(low, high, &result); + return (result); + } + case tf_readonlyreal: + case tf_readwritereal: + return (tf_getrealp(argumentNumber)); + case tf_nullparam: + case tf_string: + default: + tf_warning + ("argument number %d in acc_fetch_tfarg() is not representable", + argumentNumber); + return (0.0); + } + +} + +/************************************************************************ + * acc_fetch_tfarg_int * +/***********************************************************************/ + +int acc_fetch_tfarg_int(int argumentNumber) +{ + int type; + int high; + int low; + double real; + int size; + + acc_error_flag = FALSE; + + if (argumentNumber < 1 || argumentNumber > tf_nump()) { + tf_warning + ("argument number %d is out of range in acc_fetch_tfarg_int()", + argumentNumber); + return (0); + } + + type = tf_typep(argumentNumber); + size = tf_sizep(argumentNumber); + + switch (type) { + case tf_readonly: + case tf_readwrite: + case tf_rwbitselect: + case tf_rwpartselect: + return tf_getp(argumentNumber); + case tf_readonlyreal: + case tf_readwritereal: + real = tf_getrealp(argumentNumber); + tf_real_to_long(real, &low, &high); + return (low); + case tf_nullparam: + case tf_string: + default: + tf_warning + ("argument number %d in acc_fetch_tfarg_int() is not representable", + argumentNumber); + return (0); + } + +} + +/************************************************************************ + * acc_fetch_tfarg_str * +/***********************************************************************/ + +char *acc_fetch_tfarg_str(int argumentNumber) +{ + int type; + char buffer[64]; + + + acc_error_flag = FALSE; + + if (argumentNumber < 1 || argumentNumber > tf_nump()) { + tf_warning + ("argument number %d is out of range in acc_fetch_tfarg_str()", + argumentNumber); + return (NULL); + } + + type = tf_typep(argumentNumber); + + switch (type) { + case tf_string: + return (tf_getcstringp(argumentNumber)); + case tf_readonly: + case tf_readwrite: + case tf_rwbitselect: + case tf_rwpartselect: + sprintf(buffer, "%d", tf_getp(argumentNumber)); + return pli_write_string(buffer); + case tf_readonlyreal: + case tf_readwritereal: + sprintf(buffer, "%g", tf_getrealp(argumentNumber)); + return pli_write_string(buffer); + case tf_nullparam: + default: + tf_warning + ("argument number %d in acc_fetch_tfarg_str() is not representable", + argumentNumber); + return (NULL); + } + +} + +/************************************************************************ + * acc_handle_tfarg * +/***********************************************************************/ + +handle acc_handle_tfarg(int argnum) +{ + tree arg; + int type; + + acc_error_flag = FALSE; + + arg = nth_arg(argnum, (tree) tf_getinstance()); + type = tf_typep(argnum); + switch (type) { + case tf_nullparam: + return (NULL); + case tf_string: + return (acc_handle_object(tf_getcstringp(argnum))); + case tf_readwrite: + case tf_rwpartselect: + case tf_rwbitselect: + case tf_readwritereal: + case tf_readonlyreal: + return ((handle) arg); + } + + switch (TREE_CODE(arg)) { + case BLOCK_DECL: + return (acc_handle_object(IDENT(DECL_NAME(arg)))); + case IDENTIFIER_NODE: + return (acc_handle_object(IDENT(arg))); + case NET_SCALAR_DECL: + case NET_VECTOR_DECL: + case MODULE_BLOCK: + return ((handle) arg); + + } + + return (handle) NULL; +} + +/**************************************************************** + + acc_next_parameter + +*****************************************************************/ +handle acc_next_parameter(handle reference, handle param) +{ + tree next; + + acc_error_flag = FALSE; + + if (param == NULL) { + next = BLOCK_DECL((tree) reference); + } else { + next = TREE_CHAIN((tree) param); + } + + while (next != NULL && acc_fetch_type((handle) next) != accParameter) { + next = TREE_CHAIN(next); + } + return ((handle) next); +} + +/**************************************************************** + + acc_next_specparam + +*****************************************************************/ +handle acc_next_specparam(handle reference, handle param) +{ + tree next; + + acc_error_flag = FALSE; + + if (param == NULL) { + next = BLOCK_DECL((tree) reference); + } else { + next = TREE_CHAIN((tree) param); + } + + while (next != NULL && acc_fetch_type((handle) next) != accSpecparam) { + next = TREE_CHAIN(next); + } + return ((handle) next); +} + +/**************************************************************** + + acc_fetch_delay_mode + +*****************************************************************/ +int acc_fetch_delay_mode(handle module) +{ + acc_error_flag = FALSE; + return (accDelayModeNone); +} + +/**************************************************************** + + acc_fetch_paramtype + +*****************************************************************/ +int acc_fetch_paramtype(handle param) +{ + int type; + + acc_error_flag = FALSE; + type = acc_fetch_type(param); + if (type != accParameter && type != accSpecparam) { + acc_error_flag = TRUE; + return (0); + } + return (acc_fetch_fulltype(param)); +} + +/**************************************************************** + + acc_fetch_paramval + +*****************************************************************/ +double acc_fetch_paramval(handle param) +{ + int type; + s_acc_value value; + + acc_error_flag = FALSE; + type = acc_fetch_paramtype(param); + switch (type) { + case accRealParam: + value.format = accRealVal; + acc_fetch_value(param, "%%", &value); + return (value.value.real); + case accIntegerParam: + value.format = accIntVal; + acc_fetch_value(param, "%%", &value); + return ((double) value.value.integer); + case accStringParam: + value.format = accStringVal; + acc_fetch_value(param, "%%", &value); + return ((double) (long) value.value.str); + default: + acc_error_flag = TRUE; + return (0); + } +} + +/**************************************************************** + acc_next_portout +*****************************************************************/ +handle acc_next_portout(handle reference, handle port) +{ + while (TRUE) { + port = acc_next_port(reference, port); + if (port == NULL || acc_fetch_direction(port) != accInput) { + return (port); + } + } +} + +/**************************************************************** + tf_getworkarea + tf_igetworkarea +*****************************************************************/ + +char *tf_getworkarea(void) +{ + return (tf_igetworkarea(tf_getinstance())); +} + +char *tf_igetworkarea(char *instance) +{ + tree node; + + node = (tree) instance; + switch (TREE_CODE(node)) { + case SYSTASK_STMT: + return STMT_SYSTASK_WORKAREA(node); + case SYSFUNCTION_REF: + return FUNC_REF_WORKAREA(node); + default: + return (NULL); + } +} + +/**************************************************************** + tf_setworkarea + tf_isetworkarea +*****************************************************************/ + +void tf_setworkarea(char *area) +{ + tf_isetworkarea(area, tf_getinstance()); +} + +void tf_isetworkarea(char *area, char *instance) +{ + tree node; + + node = (tree) instance; + switch (TREE_CODE(node)) { + case SYSTASK_STMT: + STMT_SYSTASK_WORKAREA(node) = area; + break; + case SYSFUNCTION_REF: + FUNC_REF_WORKAREA(node) = area; + break; + } +} + +/**************************************************************** + freePliDelayNode +*****************************************************************/ + +void freePliDelayNode(tree node) +{ + if (PLI_DELAY_STORAGE(node)) { + free(PLI_DELAY_STORAGE(node)); + } + + PLI_DELAY_NEXT(node) = delayFreeList; + delayFreeList = node; +} + +/**************************************************************** + tf_setlongdelay + tf_isetlongdelay +*****************************************************************/ + +int tf_setlongdelay(int low, int high) +{ + return (tf_isetlongdelay(low, high, tf_getinstance())); +} + +int tf_isetlongdelay(int low, int high, char *instance) +{ + tree delayNode; + tree t; + time64 delay; + time64 newTime; + tree pliNode; + struct SCB *scb; + tree *prev; + + pliNode = (tree) instance; + tf_scale_longdelay(instance, low, high, (int *) &delay.timel, + (int *) &delay.timeh); + + if (pliNode == NULL) { + return (0); + } + + switch (TREE_CODE(pliNode)) { + case SYSTASK_STMT: + scb = STMT_SYSTASK_DELAYSCB(pliNode); + break; + case SYSFUNCTION_REF: + scb = FUNC_REF_DELAYSCB(pliNode); + break; + default: + return (0); + } + + + if (delayFreeList) { + delayNode = delayFreeList; + delayFreeList = PLI_DELAY_NEXT(delayNode); + } else { + delayNode = make_node(PLI_DELAY); + } + + ADDTIME6464(&newTime, &CurrentTime, &delay); + PLI_DELAY_NODE(delayNode) = pliNode; + + PLI_DELAY_TIME(delayNode) = newTime; + PLI_DELAY_LVAL(delayNode) = NULL; + PLI_DELAY_STORAGE(delayNode) = NULL; + + if (scb != NULL) { + for (prev = &scb->pc, t = scb->pc; t; + prev = &PLI_DELAY_NEXT(t), t = PLI_DELAY_NEXT(t)) { + if (CMPTIME64(&newTime, &PLI_DELAY_TIME(t)) < 0) { + break; + } + } + *prev = delayNode; + PLI_DELAY_NEXT(delayNode) = t; + } else { + PLI_DELAY_NEXT(delayNode) = NULL; + scb = BuildSCB(delayNode, NOLIST); + + switch (TREE_CODE(pliNode)) { + case SYSTASK_STMT: + STMT_SYSTASK_DELAYSCB(pliNode) = scb; + break; + case SYSFUNCTION_REF: + FUNC_REF_DELAYSCB(pliNode) = scb; + break; + default: + ASSERT(FALSE); + } + } + if (scb->pc == delayNode && scb != readylist) { + Schedule64(&newTime, scb, FALSE); + } + + return (1); +} + +/**************************************************************** + tf_setdelay + tf_isetdelay +*****************************************************************/ + +int tf_setdelay(int delay) +{ + return (tf_isetdelay(delay, tf_getinstance())); +} + +int tf_isetdelay(int delay, char *instance) +{ + return (tf_isetlongdelay(delay, 0, instance)); +} + +/**************************************************************** + tf_setrealdelay + tf_isetrealdelay +*****************************************************************/ + +int tf_setrealdelay(double delay) +{ + return (tf_isetrealdelay(delay, tf_getinstance())); +} + +int tf_isetrealdelay(double delay, char *instance) +{ + int high; + int low; + double scaledDelay; + + tf_scale_realdelay(instance, delay, &scaledDelay); + tf_real_to_long(scaledDelay, &low, &high); + tf_unscale_longdelay(instance, low, high, &low, &high); + return (tf_isetlongdelay(low, high, instance)); + +} + +/**************************************************************** + tf_clearalldelays + tf_iclearalldelays +*****************************************************************/ + +void tf_clearalldelays(void) +{ + tf_clearalldelays(); +} + +void tf_iclearalldelays(char *instance) +{ + tree delayNode; + tree pliNode; + SCB *scb; + tree prev; + + pliNode = (tree) instance; + + if (pliNode == NULL) { + return; + } + + switch (TREE_CODE(pliNode)) { + case SYSTASK_STMT: + scb = STMT_SYSTASK_DELAYSCB(pliNode); + break; + case SYSFUNCTION_REF: + scb = FUNC_REF_DELAYSCB(pliNode); + break; + default: + return; + } + + + if (scb == NULL) { + return; + } + delayNode = scb->pc; + while (delayNode != NULL) { + prev = delayNode; + delayNode = PLI_DELAY_NEXT(delayNode); + freePliDelayNode(prev); + } + scb->pc = NULL; + FreeSCB(scb); +} + +/**************************************************************** + tf_spname + tf_ispname +*****************************************************************/ +char *tf_spname(void) +{ + return tf_ispname(tf_getinstance()); +} + +char *tf_ispname(char *instance) +{ + handle object = (handle) instance; + + return (acc_fetch_fullname(acc_handle_parent(object))); +} + +/**************************************************************** + acc_fetch_argc +*****************************************************************/ +int acc_fetch_argc(void) +{ + acc_error_flag = FALSE; + return globalArgc; +} + +/**************************************************************** + acc_fetch_argv +*****************************************************************/ +char **acc_fetch_argv(void) +{ + acc_error_flag = FALSE; + return globalArgv; +} + + + +/*************************************************** + tf_text +****************************************************/ + +void tf_text(char *format, ...) +{ + va_list ap; + int oldOffset; + + // this assumes that the text is less than 512 bytes + + oldOffset = pli_info.nextText - pli_info.text; + if (pli_info.textSize - oldOffset < 512) { + pli_info.textSize += 512; + pli_info.text = + (char *) xrealloc(pli_info.text, pli_info.textSize); + if (pli_info.text == NULL) { + tf_error("Out of Memory"); + return; + } + pli_info.nextText = pli_info.text + oldOffset; + } + + va_start(ap, format); + pli_info.nextText += vsprintf(pli_info.nextText, format, ap); + va_end(ap); + return; +} + +/*************************************************** + tf_message +****************************************************/ + +void tf_message(int level, char *facility, char *code, char *format, ...) +{ + va_list ap; + + switch (level) { + case ERR_ERROR: + if (!pli_info.config.accDisplayErrors_) { + return; + } + printf_V("ERROR!\t"); + count_error(FALSE); + break; + case ERR_SYSTEM: + printf_V("SYSTEM!\t"); + count_error(FALSE); + break; + case ERR_INTERNAL: + count_error(FALSE); + printf_V("INTERNAL!\t"); + break; + case ERR_WARNING: + if (!pli_info.config.accDisplayWarnings_) { + return; + } + count_error(TRUE); + printf_V("WARNING!\t"); + break; + case ERR_MESSAGE: + printf_V("MESSAGE!\t"); + break; + } + + *pli_info.nextText = 0; + printf_V(pli_info.text); + pli_info.nextText = pli_info.text; + + va_start(ap, format); + vprintf_V(format, ap); + va_end(ap); + + return; +} + +/*************************************************** + tf_error +****************************************************/ + + +void tf_error(char *format, ...) +{ + va_list ap; + + if (!pli_info.config.accDisplayErrors_) { + return; + } + count_error(FALSE); + printf_V("ERROR! "); + va_start(ap, format); + vprintf_V(format, ap); + va_end(ap); + printf_V("\t[User-PLI]\n"); + return; +} + +/*************************************************** + tf_warning +****************************************************/ + +void tf_warning(char *format, ...) +{ + va_list ap; + + if (!pli_info.config.accDisplayWarnings_) + return; + count_error(TRUE); + printf_V("WARNING! "); + va_start(ap, format); + vprintf_V(format, ap); + va_end(ap); + printf_V("\t[User-PLI]\n"); + return; +} + +/**************************************************************** + + tf_nodeinfo + tf_inodeinfo + +*****************************************************************/ + +struct t_tfnodeinfo *tf_nodeinfo(int nparam, + struct t_tfnodeinfo *nodeinfo_p) +{ + return (tf_inodeinfo(nparam, nodeinfo_p, tf_getinstance())); +} + +struct t_tfnodeinfo *tf_inodeinfo(int nparam, + struct t_tfnodeinfo *nodeinfo_p, + char *instance) +{ + int type; + tree arg; + tree param; + int bits; + + /* this isn't fully implemented + strengths missing + memorys missing + */ + + param = nth_parameter(nparam, (tree) instance); + if (param == NULL) { + return (NULL); + } + arg = TREE_PURPOSE(param); + type = acc_fetch_type((handle) arg); + + bits = tf_isizep(nparam, instance); + + switch (type) { + case accRealVar: + nodeinfo_p->node_type = tf_real_node; + nodeinfo_p->node_value.real_val_p = (double *) DECL_STORAGE(arg); + nodeinfo_p->node_ngroups = 0; + nodeinfo_p->node_vec_size = 0; + nodeinfo_p->node_sign = (*nodeinfo_p->node_value.real_val_p < 0); + break; + case accIntegerVar: + nodeinfo_p->node_type = tf_integer_node; + nodeinfo_p->node_value.vecval_p = + (struct t_vecval *) DECL_STORAGE(arg); + nodeinfo_p->node_ngroups = (bits + 31) / 32; + nodeinfo_p->node_vec_size = bits; + nodeinfo_p->node_sign = (AVAL(DECL_STORAGE(arg)) < 0); + break; + case accTimeVar: + nodeinfo_p->node_type = tf_time_node; + nodeinfo_p->node_value.vecval_p = + (struct t_vecval *) DECL_STORAGE(arg); + nodeinfo_p->node_ngroups = (bits + 31) / 32; + nodeinfo_p->node_vec_size = bits; + nodeinfo_p->node_sign = 0; + break; + case accRegister: + nodeinfo_p->node_type = tf_reg_node; + nodeinfo_p->node_value.vecval_p = + (struct t_vecval *) DECL_STORAGE(arg); + nodeinfo_p->node_ngroups = (bits + 31) / 32; + nodeinfo_p->node_vec_size = bits; + nodeinfo_p->node_sign = 0; + break; + case accNet: + case accPort: + nodeinfo_p->node_type = tf_netvector_node; + nodeinfo_p->node_value.vecval_p = + (struct t_vecval *) DECL_STORAGE(arg); + nodeinfo_p->node_ngroups = (bits + 31) / 32; + nodeinfo_p->node_vec_size = bits; + nodeinfo_p->node_sign = 0; + break; + default: + nodeinfo_p->node_type = tf_null_node; + return nodeinfo_p; + } + + nodeinfo_p->node_symbol = IDENT(DECL_NAME(arg)); + nodeinfo_p->node_handle = NULL; + nodeinfo_p->node_mem_size = 0; + + return (nodeinfo_p); +} + +/**************************************************************** + tf_strlongdelputp + tf_istrlongdelputp +*****************************************************************/ + +int +tf_strlongdelputp(int nparam, int bitlength, int format_char, + char *value_p, int low, int high, int delaytype) +{ + return (tf_istrlongdelputp(nparam, bitlength, format_char, + value_p, low, high, delaytype, + tf_getinstance())); +} + +int +tf_istrlongdelputp(int nparam, int bitlength, int format_char, + char *value_p, int low, int high, int delaytype, + char *instance) +{ + handle object; + s_setval_delay delay; + s_setval_value value; + + object = (handle) nth_arg(nparam, (tree) instance); + if (object == NULL) { + return (0); + } + + delay.time.type = accTime; + delay.time.low = low; + delay.time.high = high; + switch (delaytype) { + case 0: + delay.model = accInertialDelay; + break; + case 1: + delay.model = accTransportDelay; + break; + case 2: + delay.model = accPureTransportDelay; + break; + default: + return (0); + } + + switch (format_char) { + case 'b': + case 'B': + value.format = accBinStrVal; + break; + case 'd': + case 'D': + value.format = accDecStrVal; + break; + case 'h': + case 'H': + value.format = accHexStrVal; + break; + case 'o': + case 'O': + value.format = accOctStrVal; + break; + default: + return (0); + } + value.value.str = value_p; + + return (acc_set_value(object, &value, &delay)); +} + +/**************************************************************** + tf_strdelputp + tf_istrdelputp +*****************************************************************/ + +int +tf_strdelputp(int nparam, int bitlength, int format_char, + char *value_p, int delay, int delaytype) +{ + return (tf_istrdelputp(nparam, bitlength, format_char, + value_p, delay, delaytype, tf_getinstance())); +} + +int +tf_istrdelputp(int nparam, int bitlength, int format_char, + char *value_p, int delay, int delaytype, char *instance) +{ + return (tf_istrlongdelputp(nparam, bitlength, format_char, + value_p, delay, 0, delaytype, instance)); +} + +/**************************************************************** + tf_strrealdelputp + tf_istrrealdelputp +*****************************************************************/ + +int +tf_strrealdelputp(int nparam, int bitlength, int format_char, + char *value_p, double delay, int delaytype) +{ + return (tf_istrrealdelputp(nparam, bitlength, format_char, + value_p, delay, delaytype, + tf_getinstance())); +} + +int +tf_istrrealdelputp(int nparam, int bitlength, int format_char, + char *value_p, double delay, int delaytype, + char *instance) +{ + int high; + int low; + double scaledDelay; + + tf_scale_realdelay(instance, delay, &scaledDelay); + tf_real_to_long(scaledDelay, &low, &high); + tf_unscale_longdelay(instance, low, high, &low, &high); + return (tf_istrlongdelputp(nparam, bitlength, format_char, + value_p, low, high, delaytype, instance)); + +} + +/**************************************************************** + tf_getpchange + tf_igetpchange +*****************************************************************/ +int tf_getpchange(int nparam) +{ + return (tf_igetpchange(nparam, tf_getinstance())); +} + +int tf_igetpchange(int nparam, char *instance) +{ + tree param; + int index; + PliInfo_t *info; + + index = nparam + 1; + while (TRUE) { + param = nth_parameter(index, (tree) instance); + if (param == NULL) { + return (0); + } + info = (PliInfo_t *) TREE_PLIINFO(param); + if (info->saved_pvc) { + return (index); + } + index++; + } + +} + +/**************************************************************** + tf_copypvc_flag + tf_icopypvc_flag +*****************************************************************/ +int tf_copypvc_flag(int nparam) +{ + return (tf_icopypvc_flag(nparam, tf_getinstance())); +} + +int tf_icopypvc_flag(int nparam, char *instance) +{ + tree param; + int index; + int acc; + PliInfo_t *info; + + if (nparam == -1) { + index = 1; + } else { + index = nparam; + } + + acc = FALSE; + while (TRUE) { + param = nth_parameter(index, (tree) instance); + if (param == NULL) { + break; + } + info = (PliInfo_t *) TREE_PLIINFO(param); + info->saved_pvc = info->pvc; + acc |= info->saved_pvc; + if (nparam != -1) { + break; + } + index++; + } + + return (acc); + +} + +/**************************************************************** + tf_movepvc_flag + tf_imovepvc_flag +*****************************************************************/ +int tf_movepvc_flag(int nparam) +{ + return (tf_imovepvc_flag(nparam, tf_getinstance())); +} + +int tf_imovepvc_flag(int nparam, char *instance) +{ + tree param; + int index; + int acc; + PliInfo_t *info; + + if (nparam == -1) { + index = 1; + } else { + index = nparam; + } + + acc = FALSE; + while (TRUE) { + param = nth_parameter(index, (tree) instance); + if (param == NULL) { + break; + } + info = (PliInfo_t *) TREE_PLIINFO(param); + info->saved_pvc = info->pvc; + info->pvc = FALSE; + acc |= info->saved_pvc; + if (nparam != -1) { + break; + } + index++; + } + + return (acc); + +} + +/**************************************************************** + tf_testpvc_flag + tf_itestpvc_flag +*****************************************************************/ +int tf_testpvc_flag(int nparam) +{ + return (tf_itestpvc_flag(nparam, tf_getinstance())); +} + +int tf_itestpvc_flag(int nparam, char *instance) +{ + tree param; + int index; + int acc; + PliInfo_t *info; + + if (nparam == -1) { + index = 1; + } else { + index = nparam; + } + + acc = FALSE; + while (TRUE) { + param = nth_parameter(index, (tree) instance); + if (param == NULL) { + break; + } + info = (PliInfo_t *) TREE_PLIINFO(param); + acc |= info->saved_pvc; + if (nparam != -1) { + break; + } + index++; + } + + return (acc); + +} + +/**************************************************************** + tf_getnextlongtime +*****************************************************************/ +int tf_getnextlongtime(int *aof_lowtime, int *aof_hightime) +{ + tree gate; + int timeh; + int timel; + int result; + + + if (!roFlag) { + timel = CurrentTime.timel; + timeh = CurrentTime.timeh; + result = 2; + goto DONE; + } + + gate = PeekGate(); + + if (gate != NULL && timelist != NULL) { + if (CMPTIME64(&GATE_TIMEQ(gate)->timeIndex, &timelist->time) > 0) { + gate = NULL; + } + } + + if (gate != NULL) { + timel = GATE_TIMEQ(gate)->timeIndex.timel; + timeh = GATE_TIMEQ(gate)->timeIndex.timeh; + result = 0; + goto DONE; + } + + if (timelist != NULL) { + timel = timelist->time.timel; + timeh = timelist->time.timeh; + result = 0; + goto DONE; + } + + + + timeh = 0; + timel = 0; + result = 1; + DONE: + + /* + * in this call time is unscaled (vcs behavior) + * ieee 95 contradicts this + */ + *aof_lowtime = timel; + *aof_hightime = timeh; + + return result; +} + +/**************************************************************** + + acc_fetch_direction + - return port or terminal direction type + +*****************************************************************/ +int acc_fetch_direction(handle object) +{ + tree t = (tree) object; + tree gate; + + acc_error_flag = FALSE; + + if (t == NULL_TREE || TREE_CODE(t) != TREE_LIST) { + acc_error_flag = TRUE; + return (0); + } + + gate = GATE_TERMINAL_GATE(t); + if (gate == NULL || TREE_CODE(gate) != GATE_INSTANCE) { + t = TREE_PURPOSE(t); + } + + if (PORT_INPUT_ATTR(t) && PORT_OUTPUT_ATTR(t)) { + return (accInout); + } + if (PORT_INPUT_ATTR(t)) { + return (accInput); + } + + if (PORT_OUTPUT_ATTR(t)) { + return (accOutput); + } + + acc_error_flag = TRUE; + return (0); + +} + +/**************************************************************** + + acc_handle_tchk + - return specified timing check + +*****************************************************************/ + +handle +acc_handle_tchk(handle module, int tchk_type, char *net1_name, + int edge1, char *net2_name, int edge2, ...) +{ + handle tchk; + handle object; + char *name1; + char *name2; + va_list args; + + name1 = net1_name; + name2 = net2_name; + if (pli_info.config.accEnableArgsTchk_) { + va_start(args, edge2); + if (net1_name == NULL) { + object = va_arg(args, handle); + name1 = acc_fetch_name(object); + } + if (net2_name == NULL && tchk_type != accWidth && + tchk_type != accPeriod) { + object = va_arg(args, handle); + name2 = acc_fetch_name(object); + } + va_end(args); + } + + tchk = null; + while (TRUE) { + tchk = acc_next_tchk(module, tchk); + if (tchk == null) { + return (null); + } + if (acc_fetch_fulltype(tchk) != tchk_type) { + continue; + } + if (strcmp + (name1, + acc_fetch_name(acc_handle_conn(acc_handle_tchkarg1(tchk)))) + || (edge1 != 0 + && TIMING_CHECK_EDGESPEC((tree) tchk, 0) != edge1)) { + continue; + } + if (name2 != NULL && name2[0] != 0 && + (strcmp + (name2, + acc_fetch_name(acc_handle_conn(acc_handle_tchkarg2(tchk)))) + || (edge2 != 0 + && TIMING_CHECK_EDGESPEC((tree) tchk, 1) != edge2))) { + continue; + } + return (tchk); + } +} + +/**************************************************************** + + acc_handle_tchkarg1 + - return first net of timing check + +*****************************************************************/ + +handle acc_handle_tchkarg1(handle tchk) +{ + tree instance; + tree decl; + + instance = (tree) tchk; + if (tchk == null || TREE_CODE(instance) != TIMING_CHECK) { + return (null); + } + + decl = TIMING_CHECK_EXPRESSION(instance, 0); + if (decl != NULL && STMT_SURROGATE_ATTR(decl)) { + decl = TREE_CHAIN(decl); + } + return ((handle) decl); +} + + +/**************************************************************** + + acc_handle_tchkarg2 + - return first net of timing check + +*****************************************************************/ + +handle acc_handle_tchkarg2(handle tchk) +{ + tree instance; + tree decl; + + instance = (tree) tchk; + if (tchk == null || TREE_CODE(instance) != TIMING_CHECK) { + return (null); + } + + decl = TIMING_CHECK_EXPRESSION(instance, 1); + if (decl != NULL && STMT_SURROGATE_ATTR(decl)) { + decl = TREE_CHAIN(decl); + } + return ((handle) decl); +} + + + +/**************************************************************** + + acc_next_driver + - return the next driver of net + +*****************************************************************/ + +handle acc_next_driver(handle net, handle driver) +{ + tree tnet = (tree) net; + tree tdriver = (tree) driver; + tree surrogate; + tree ndriver; + + + // make sure the net is not one of the surrogates + + if (STMT_SURROGATE_ATTR(tnet)) { + tnet = TREE_CHAIN(tnet); + } + // if driver is null start with net as home + // if driver is not null, scan net surrogate until current + // driver is found. + + if (tdriver == NULL_TREE) { + surrogate = tnet; + } else { + for (surrogate = tnet; surrogate; + surrogate = NET_SOURCE(surrogate)) { + ndriver = NET_ASSIGNMENT(surrogate); + if (ndriver == tdriver) { + break; + } + } + ASSERT(surrogate != NULL_TREE); + } + + // keep getting surrogates until a valid driver is found + + do { + surrogate = NET_SOURCE(surrogate); + if (surrogate == NULL) { + return (null); + } + + ndriver = NET_ASSIGNMENT(surrogate); + if (ndriver != null + && acc_fetch_type((handle) ndriver) != accTerminal) { + ndriver = NULL; + } + } + while (ndriver == NULL); + + return ((handle) ndriver); +} + + +/**************************************************************** + + acc_handle_loconn + - return lo net connected to port + +*****************************************************************/ +handle acc_handle_loconn(handle terminal) +{ + tree t = (tree) terminal; + tree decl; + + acc_error_flag = FALSE; + + if (t == NULL) { + acc_error_flag = TRUE; + return NULL; + } + + if (TREE_CODE(t) == TREE_LIST) { + decl = TREE_PURPOSE(t); + } else { + decl = t; + } + + if (PORT_REDEFINED_ATTR(decl)) { + decl = DECL_THREAD(decl); + } +// loconn will have to return registers +/* if( TREE_CODE(decl) != NET_SCALAR_DECL && + TREE_CODE(decl) != NET_VECTOR_DECL ) { + return NULL; + } +*/ + if (decl != NULL && STMT_SURROGATE_ATTR(decl)) { + decl = TREE_CHAIN(decl); + } + return ((handle) decl); +} + +/**************************************************************** + + acc_fetch_index + +*****************************************************************/ +int acc_fetch_index(handle object) +{ + tree t = (tree) object; + tree gate; + tree decl; + tree module; + int pin; + tree port; + + acc_error_flag = FALSE; + + if (t == NULL_TREE || TREE_CODE(t) != TREE_LIST) { + acc_error_flag = TRUE; + return (0); + } + + gate = GATE_TERMINAL_GATE(t); + if (gate != NULL && TREE_CODE(gate) == GATE_INSTANCE) { + return (GATE_TERMINAL_NUMBER(t)); + } + + /* must be a port */ + + decl = TREE_PURPOSE(t); + module = DECL_CONTEXT(decl); + pin = 0; + if (acc_fetch_type((handle) module) == accModule) { + port = MODULE_PORT_LIST(module); + } else { + port = BLOCK_PORTS(module); + } + for (; port != NULL && port != t; port = TREE_CHAIN(port), pin++); + + + if (port == NULL) { + acc_error_flag = TRUE; + } + + return (pin); + +} + +/**************************************************************** + + acc_next_terminal + - return the next terminal of primitive + +*****************************************************************/ + +handle acc_next_terminal(handle primitive, handle terminal) +{ + tree next; + + acc_error_flag = FALSE; + + if (terminal == NULL) { + next = GATE_OUTPUT_LIST((tree) primitive); + } else { + + next = TREE_CHAIN((tree) terminal); + if (next == NULL_TREE && PORT_OUTPUT_ATTR((tree) terminal)) { + next = GATE_INPUT_LIST((tree) primitive); + } + // skip inout that are in input list + while (next != NULL && !PORT_OUTPUT_ATTR(next) && + !PORT_INPUT_ATTR(next)) { + next = TREE_CHAIN(next); + + } + } + return ((handle) next); + + +} + +/**************************************************************** + + acc_handle_path + +*****************************************************************/ +handle acc_handle_path(handle port_output_handle, handle port_input_handle) +{ + acc_error_flag = FALSE; + return null; +} + +/**************************************************************** + + acc_handle_terminal + +*****************************************************************/ +handle acc_handle_terminal(handle primitive_handle, int terminal_index) +{ + handle terminal; + int count; + + terminal = null; + for (count = terminal_index; count >= 0; count--) { + terminal = acc_next_terminal(primitive_handle, terminal); + if (terminal == null) { + break; + } + } + return (terminal); +} + +/**************************************************************** + + acc_handle_modpath + - retrieve a given module path + +*****************************************************************/ + +handle +acc_handle_modpath(handle module, char *src_name, char *dest_name, ...) +{ + handle path; + handle src; + handle dest; + va_list args; + handle inpath; + handle outpath; + + acc_error_flag = FALSE; + + va_start(args, dest_name); + if (pli_info.config.accEnableArgsModpath_) { + src = va_arg(args, handle); + dest = va_arg(args, handle); + } + va_end(args); + + if (src_name != NULL) { + src = acc_handle_by_name(src_name, module); + } + if (dest_name != NULL) { + dest = acc_handle_by_name(dest_name, module); + } + + if (src == NULL || dest == NULL) { + acc_error_flag = TRUE; + return NULL; + } + + path = NULL; + for (path = acc_next_modpath(module, path); + path != NULL; path = acc_next_modpath(module, path)) { + inpath = acc_handle_pathin(path); + outpath = acc_handle_pathout(path); + if (!acc_compare_handles(src, inpath)) { + continue; + } + if (acc_compare_handles(dest, outpath)) { + return path; + } + } + + acc_error_flag = TRUE; + return NULL; + +} + + +/**************************************************************** + + acc_handle_pathin + - retrieve first input of module path + +*****************************************************************/ + +handle acc_handle_pathin(handle mod_path) +{ + handle terminal; + handle net; + + acc_error_flag = FALSE; + + terminal = acc_next_input(mod_path, null); + net = acc_handle_conn(terminal); + acc_release_object(terminal); + return net; + +#if 0 + tree pathInstance; + tree pathDesc; + tree instance; + tree constraint; + tree decl; + tree module; + + acc_error_flag = FALSE; + + pathInstance = (tree) mod_path; + if (TREE_CODE(pathInstance) != PATH_INSTANCE) { + acc_error_flag = TRUE; + return (null); + } + + pathDesc = PATH_INSTANCE_PATHDESC(pathInstance); + ASSERT(TREE_CODE(pathDesc) == PATH_NODE); + + module = PATH_INSTANCE_MODULE(pathInstance); + ASSERT(TREE_CODE(module) == MODULE_BLOCK); + + for (instance = MODULE_SPECINST(module); + instance != NULL_TREE; instance = TREE_CHAIN(instance)) { + + if (TREE_CODE(instance) != PATH_OUTPUT) { + continue; + } + + + for (constraint = PATH_OUTPUT_CONSTRAINTS(instance); + constraint != NULL_TREE; constraint = TREE_CHAIN(constraint)) + { + + ASSERT(TREE_CODE(constraint) == PATH_CONSTRAINT); + if (PATH_CONSTRAINT_PATHDESC(constraint) == pathDesc) { + decl = + TREE_PURPOSE(PATH_CONSTRAINT_DEPENDENCIES(constraint)); + if (STMT_SURROGATE_ATTR(decl)) { + decl = TREE_CHAIN(decl); + } + return ((handle) decl); + } + } + } + + /* this is an error case */ + + acc_error_flag = TRUE; + return (NULL); +#endif +} + +/**************************************************************** + + acc_handle_pathout + - retrieve first output of module path + +*****************************************************************/ + +handle acc_handle_pathout(handle mod_path) +{ + handle terminal; + handle net; + + acc_error_flag = FALSE; + + terminal = acc_next_output(mod_path, null); + net = acc_handle_conn(terminal); + acc_release_object(terminal); + return net; +#if 0 + tree pathInstance; + tree pathDesc; + tree instance; + tree constraint; + tree decl; + tree module; + tree gate; + + acc_error_flag = FALSE; + + pathInstance = (tree) mod_path; + if (TREE_CODE(pathInstance) != PATH_INSTANCE) { + acc_error_flag = TRUE; + return (null); + } + + pathDesc = PATH_INSTANCE_PATHDESC(pathInstance); + ASSERT(TREE_CODE(pathDesc) == PATH_NODE); + + module = PATH_INSTANCE_MODULE(pathInstance); + ASSERT(TREE_CODE(module) == MODULE_BLOCK); + + for (instance = MODULE_SPECINST(module); + instance != NULL_TREE; instance = TREE_CHAIN(instance)) { + + if (TREE_CODE(instance) != PATH_OUTPUT) { + continue; + } + + + for (constraint = PATH_OUTPUT_CONSTRAINTS(instance); + constraint != NULL_TREE; constraint = TREE_CHAIN(constraint)) + { + + ASSERT(TREE_CODE(constraint) == PATH_CONSTRAINT); + if (PATH_CONSTRAINT_PATHDESC(constraint) == pathDesc) { + gate = PATH_OUTPUT_GATE(instance); + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + ASSERT(TREE_CODE(GATE_OUTPUT_LIST(gate)) == TREE_LIST); + decl = TREE_PURPOSE(GATE_OUTPUT_LIST(gate)); + if (STMT_SURROGATE_ATTR(decl)) { + decl = TREE_CHAIN(decl); + } + return ((handle) decl); + } + } + } + /* this is an error case */ + + acc_error_flag = TRUE; + return (NULL); + +#endif + +} + +/**************************************************************** + + acc_next_nput + +*****************************************************************/ + +handle acc_next_input(handle mod_path, handle terminal) +{ + tree pathInstance; + tree pathDesc; + tree instance; + tree constraint; + tree module; + + acc_error_flag = FALSE; + + pathInstance = (tree) mod_path; + if (TREE_CODE(pathInstance) != PATH_INSTANCE) { + acc_error_flag = TRUE; + return (null); + } + + pathDesc = PATH_INSTANCE_PATHDESC(pathInstance); + ASSERT(TREE_CODE(pathDesc) == PATH_NODE); + + module = PATH_INSTANCE_MODULE(pathInstance); + ASSERT(TREE_CODE(module) == MODULE_BLOCK); + + if (terminal == NULL) { + for (instance = MODULE_SPECINST(module); + instance != NULL_TREE; instance = TREE_CHAIN(instance)) { + + if (TREE_CODE(instance) != PATH_OUTPUT) { + continue; + } + + for (constraint = PATH_OUTPUT_CONSTRAINTS(instance); + constraint != NULL_TREE; + constraint = TREE_CHAIN(constraint)) { + + ASSERT(TREE_CODE(constraint) == PATH_CONSTRAINT); + if (PATH_CONSTRAINT_INSTANCE(constraint) == pathInstance) { + return (handle) PATH_CONSTRAINT_DEPENDENCIES((tree) + constraint); + } + } + } + } else { + return ((handle) TREE_CHAIN((tree) terminal)); + } + + /* this is an error case */ + + acc_error_flag = TRUE; + return (NULL); +} + +/**************************************************************** + + acc_next_output + +*****************************************************************/ + +handle acc_next_output(handle mod_path, handle terminal) +{ + tree pathInstance; + tree pathDesc; + tree instance; + tree constraint; + tree module; + + acc_error_flag = FALSE; + + pathInstance = (tree) mod_path; + if (TREE_CODE(pathInstance) != PATH_INSTANCE) { + acc_error_flag = TRUE; + return (null); + } + + pathDesc = PATH_INSTANCE_PATHDESC(pathInstance); + ASSERT(TREE_CODE(pathDesc) == PATH_NODE); + + module = PATH_INSTANCE_MODULE(pathInstance); + ASSERT(TREE_CODE(module) == MODULE_BLOCK); + + for (instance = MODULE_SPECINST(module); + instance != NULL_TREE; instance = TREE_CHAIN(instance)) { + + if (TREE_CODE(instance) != PATH_OUTPUT) { + continue; + } + + for (constraint = PATH_OUTPUT_CONSTRAINTS(instance); + constraint != NULL_TREE; constraint = TREE_CHAIN(constraint)) + { + + ASSERT(TREE_CODE(constraint) == PATH_CONSTRAINT); + if (PATH_CONSTRAINT_INSTANCE(constraint) == pathInstance) { + if (terminal == NULL && + PATH_CONSTRAINT_OUTPUT_NUMBER(constraint) == 0) { + return ((handle) constraint); + } else if (terminal != NULL && + PATH_CONSTRAINT_OUTPUT_NUMBER((tree) terminal) + + 1 == + PATH_CONSTRAINT_OUTPUT_NUMBER(constraint)) { + return ((handle) constraint); + } + } + } + } + + /* this is an error case */ + + acc_error_flag = TRUE; + return (NULL); +} + +/**************************************************************** + + resolve_path + - find next item in path + +*****************************************************************/ +static int resolveList[] = { + accIntegerVar, + accModule, + accNamedEvent, + accNet, + accPrimitive, + accRealVar, + accRegister, + accTimeVar, + accParameter, + accSpecparam, + 0 +}; + +static handle resolve_path(handle anchor, char *path) +{ + handle object; + char *startPtr; + char *endPtr; + int length; + + + startPtr = path; + endPtr = strchr(startPtr, '.'); + if (endPtr == NULL) { + length = strlen(startPtr); + endPtr = startPtr + length; + } else { + length = endPtr - startPtr; + endPtr++; + } + + if (length <= 0) { + return (anchor); + } + + object = NULL; + for (object = acc_next_child(anchor, object); + object != NULL; object = acc_next_child(anchor, object)) { + char *name = acc_fetch_name(object); + if (!strncmp(startPtr, name, length) && strlen(name) == length) { + return (resolve_path(object, endPtr)); + } + } + + if (*endPtr != 0) { + return (NULL); + } + + object = NULL; + for (object = acc_next(resolveList, anchor, object); + object != NULL; object = acc_next(resolveList, anchor, object)) { + char *name = acc_fetch_name(object); + if (!strncmp(startPtr, name, length) && strlen(name) == length) { + return (object); + } + } + + return (NULL); + +} + + + +/**************************************************************** + + acc_handle_by_name + - return the handle to named object in given scope + + ****************************************************************/ + +handle acc_handle_by_name(char *path, handle scope) +{ + handle object; + char *startPtr; + char *endPtr; + int length; + + + acc_error_flag = FALSE; + + /* search scope */ + + if (scope != NULL) { + object = resolve_path(scope, path); + if (object != NULL) { + return (object); + } + } else { + + /* start resolution at top level */ + + startPtr = path; + endPtr = strchr(startPtr, '.'); + if (endPtr == NULL) { + length = strlen(startPtr); + endPtr = startPtr + length; + } else { + length = endPtr - startPtr; + endPtr++; + } + + object = NULL; + for (object = acc_next_topmod(object); + object != NULL; object = acc_next_topmod(object)) { + char *name = acc_fetch_name(object); + if (!strncmp(startPtr, name, length) && strlen(name) == length) { + return (resolve_path(object, endPtr)); + } + } + } + + acc_error_flag = TRUE; + return (NULL); +} + +/**************************************************************** + + acc_release_object + + ****************************************************************/ +int acc_release_object(handle object) +{ + acc_error_flag = FALSE; + return TRUE; +} + +/**************************************************************** + + acc_handle_datapath + + ****************************************************************/ +handle acc_handle_datapath(handle modpath) +{ + // data paths are not supported + acc_error_flag = FALSE; + return null; +} + +/**************************************************************** + + acc_next_loconn + + ****************************************************************/ +handle acc_next_loconn(handle port, handle bit) +{ + // vector net expansion is not supported + acc_error_flag = TRUE; + return null; +} + +/**************************************************************** + + acc_next_hiconn + + ****************************************************************/ +handle acc_next_hiconn(handle port, handle bit) +{ + // vector net expansion is not supported + acc_error_flag = TRUE; + return null; +} + + +/**************************************************************** + + acc_fetch_polarity + +*****************************************************************/ +int acc_fetch_polarity(handle object) +{ + tree pathNode; + + acc_error_flag = FALSE; + + pathNode = PATH_INSTANCE_PATHDESC((tree) object); + switch (PATH_POLARITY(pathNode)) { + case 0: + return accUnknown; + case 1: + return accPositive; + case 2: + return accNegative; + } + acc_error_flag = TRUE; + return 0; + +} + +/**************************************************************** + + acc_fetch_edge + +*****************************************************************/ +int acc_fetch_edge(handle object) +{ + tree t = (tree) object; + tree timingCheck; + tree instance; + tree pathNode; + tree constraint; + + acc_error_flag = FALSE; + + if (t == NULL_TREE || + (TREE_CODE(t) != TREE_LIST && TREE_CODE(t) != PATH_CONSTRAINT)) { + acc_error_flag = TRUE; + return (0); + } + + if (TREE_CODE(t) == PATH_CONSTRAINT) { + instance = PATH_CONSTRAINT_INSTANCE(t); + pathNode = PATH_INSTANCE_PATHDESC(instance); + return (PATH_EDGE(pathNode)); + } + + constraint = MODPATH_INPUT_TERMINAL_PARENT((tree) object); + if (constraint != NULL && TREE_CODE(constraint) == PATH_CONSTRAINT) { + instance = PATH_CONSTRAINT_INSTANCE(constraint); + pathNode = PATH_INSTANCE_PATHDESC(instance); + return (PATH_EDGE(pathNode)); + } + + + timingCheck = TIMING_TERMINAL_CHECK(t); + if (timingCheck != NULL && TREE_CODE(timingCheck) == TIMING_CHECK) { + if (t == TIMING_CHECK_EXPRESSION(t, 0)) { + return (TIMING_CHECK_EDGESPEC(t, 0)); + } else if (t == TIMING_CHECK_EXPRESSION(t, 1)) { + return (TIMING_CHECK_EDGESPEC(t, 1)); + } + acc_error_flag = TRUE; + return (0); + } + + acc_error_flag = TRUE; + return (0); + +} + +/**************************************************************** + + acc_handle_condition + +*****************************************************************/ +handle acc_handle_condition(handle object) +{ + tree t = (tree) object; + tree timingCheck; + tree instance; + tree pathNode; + tree constraint; + + acc_error_flag = FALSE; + + if (t == NULL_TREE || (TREE_CODE(t) != TREE_LIST && + TREE_CODE(t) != PATH_CONSTRAINT)) { + acc_error_flag = TRUE; + return (NULL); + } + + if (TREE_CODE(t) == PATH_CONSTRAINT) { + instance = PATH_CONSTRAINT_INSTANCE(t); + pathNode = PATH_INSTANCE_PATHDESC(instance); + return ((handle) PATH_CONDITION(pathNode)); + } + + constraint = MODPATH_INPUT_TERMINAL_PARENT((tree) object); + if (constraint != NULL && TREE_CODE(constraint) == PATH_CONSTRAINT) { + instance = PATH_CONSTRAINT_INSTANCE(constraint); + pathNode = PATH_INSTANCE_PATHDESC(instance); + return ((handle) PATH_CONDITION(pathNode)); + } + + + timingCheck = TIMING_TERMINAL_CHECK(t); + if (timingCheck != NULL && TREE_CODE(timingCheck) == TIMING_CHECK) { + if (t == TIMING_CHECK_EXPRESSION(t, 0)) { + return ((handle) TIMING_CHECK_CONDITION(t, 0)); + } else if (t == TIMING_CHECK_EXPRESSION(t, 1)) { + return ((handle) TIMING_CHECK_CONDITION(t, 1)); + } + acc_error_flag = TRUE; + return (NULL); + } + + acc_error_flag = TRUE; + return (NULL); + +} + +/**************************************************************** + + acc_handle_notifier + +*****************************************************************/ +handle acc_handle_notifier(handle object) +{ + tree t = (tree) object; + + acc_error_flag = FALSE; + + if (t == NULL_TREE || TREE_CODE(t) != TIMING_CHECK) { + acc_error_flag = TRUE; + return (NULL); + } + + return ((handle) TIMING_CHECK_NOTIFIER(t)); + +} + + /**************************************************************** + acc_fetch_location +*****************************************************************/ + +void acc_fetch_location(p_location loc_p, handle object) +{ + int fulltype; + + switch (acc_fetch_type(object)) { + case accTask: + case accFunction: + case accModule: + loc_p->line_no = BLOCK_SOURCE_LINE((tree) object); + loc_p->filename = BLOCK_SOURCE_FILE((tree) object); + break; + case accPort: + acc_fetch_location(loc_p, acc_handle_parent(object)); + break; + case accPrimitive: + fulltype = acc_fetch_fulltype(object); + switch (fulltype) { + case accCombPrim: + case accSeqPrim: // not sure about this + loc_p->line_no = + BLOCK_SOURCE_LINE(GATE_UDP_DEF((tree) object)); + loc_p->filename = + BLOCK_SOURCE_FILE(GATE_UDP_DEF((tree) object)); + break; + default: + loc_p->filename = GATE_FILE((tree) object); + loc_p->line_no = GATE_LINE((tree) object); + break; + } + break; + case accPath: + loc_p->filename = PATH_SOURCE_FILE((tree) object); + loc_p->line_no = PATH_SOURCE_LINE((tree) object); + break; + case accNamedEvent: + loc_p->line_no = STMT_SOURCE_LINE((tree) object); + loc_p->filename = STMT_SOURCE_FILE((tree) object); + break; + case accNet: + case accNetBit: + case accRealVar: + case accRegister: + case accRegBit: + case accTimeVar: + case accIntegerVar: + case accParameter: + case accSpecparam: + loc_p->filename = DECL_SOURCE_FILE((tree) object); + loc_p->line_no = DECL_SOURCE_LINE((tree) object); + break; + case accPortBit: + case accStatement: + case accTchkTerminal: + case accTerminal: + case accTchk: + case accPathTerminal: + case accPartSelect: + case accDataPath: + case accConstant: + case accOperator: + default: + break; + } +} + +/**************************************************************** + acc_fetch_attribute +*****************************************************************/ +double acc_fetch_attribute(handle object, char *string, double def) +{ + acc_error_flag = TRUE; + tf_error("acc_fetch_attribute() is not supported\n"); + return def; +} + + +/**************************************************************** + acc_fetch_attribute_int +*****************************************************************/ +int acc_fetch_attribute_int(handle object, char *string, int def) +{ + acc_error_flag = TRUE; + tf_error("acc_fetch_attribute() is not supported\n"); + return def; +} + +/**************************************************************** + acc_fetch_attribute_str +*****************************************************************/ +char *acc_fetch_attribute_str(handle object, char *string, char *def) +{ + acc_error_flag = TRUE; + tf_error("acc_fetch_attribute() is not supported\n"); + return def; +} + +/**************************************************************** + handleLcb +*****************************************************************/ +void handleLcb(tree pc) +{ + tree block; + pli_lcb *lcb; + + switch (*tree_code_type[TREE_CODE(pc)]) { + case 'd': + block = DECL_CONTEXT(pc); + break; + case 's': + block = STMT_SCOPE(pc); + break; + default: + return; + } + for (; block && + TREE_CODE(block) != MODULE_BLOCK && + TREE_CODE(block) != FUNCTION_BLOCK && + TREE_CODE(block) != TASK_BLOCK; block = BLOCK_UP(block)); + if (block == NULL) { + return; + } + lcb = (pli_lcb *) BLOCK_LCB_LIST(block); + while (lcb) { + (*lcb->routine) (STMT_SOURCE_FILE(pc), + STMT_SOURCE_LINE(pc), lcb->userdata); + lcb = lcb->next; + } +} + + /**************************************************************** + acc_mod_lcb_add +*****************************************************************/ + +void +acc_mod_lcb_add(handle module, + void (*routine) (char *, unsigned int, char *), + char *userdata) +{ + pli_lcb *lcb; + + acc_error_flag = FALSE; + + for (lcb = (pli_lcb *) BLOCK_LCB_LIST((tree) module); lcb; + lcb = lcb->next) { + if (lcb->module == (tree) module && lcb->routine == routine + && lcb->userdata == userdata) { + tf_error("lcb already exists in acc_mod_lcb_add()"); + acc_error_flag = TRUE; + return; + } + } + + lcb = (pli_lcb *) xmalloc(sizeof(pli_lcb)); + lcb->routine = routine; + lcb->userdata = userdata; + lcb->module = (tree) module; + lcb->next = (pli_lcb *) BLOCK_LCB_LIST((tree) module); + BLOCK_LCB_LIST((tree) module) = (tree) lcb; + lcbCount++; +} + + /**************************************************************** + acc_mod_lcb_delete +*****************************************************************/ + +void +acc_mod_lcb_delete(handle module, + void (*routine) (char *, unsigned int, char *), + char *userdata) +{ + pli_lcb *lcb; + pli_lcb **pptr; + + + acc_error_flag = FALSE; + + for (pptr = ((pli_lcb **) & BLOCK_LCB_LIST((tree) module)), lcb = + *pptr; lcb; pptr = &lcb->next, lcb = lcb->next) { + if (lcb->module == (tree) module && lcb->routine == routine + && lcb->userdata == userdata) { + break; + } + } + + if (lcb == NULL) { + tf_error("lcb in acc_mod_lcb_delete() does not exist"); + acc_error_flag = TRUE; + return; + } + + *pptr = lcb->next; + free(lcb); + lcbCount--; + +} + + + +/************************************************************************ + * acc_fetch_name * +/***********************************************************************/ + +char *acc_fetch_name(handle object) +{ + acc_error_flag = FALSE; + + if (object == NULL) { + acc_error_flag = TRUE; + tf_error("Illegal object in acc_fetch_name()"); + return (NULL); + } + + pli_write_string(NULL); // start a new string + return (append_name(object)); +} + +/************************************************************************ + * append_name + * - append name to pli string, return + * pointer to start of string +/***********************************************************************/ + +char *append_name(handle object) +{ + char *result; + char buffer[1024]; + tree t; + + result = NULL; + switch (TREE_CODE((tree) object)) { + case PATH_CONSTRAINT: + return (append_name(acc_handle_conn(object))); + + case IDENTIFIER_NODE: + return (pli_append_string(IDENT((tree) object))); + + case TREE_LIST: + object = (handle) TREE_PURPOSE((tree) object); + break; +// case TIMING_CHECK: +// result = append_name( acc_handle_conn( +// acc_handle_tchkarg1(object) ) ); +// result = pli_append_string( pli_info.config.accPathDelimStr_ ); +// if( acc_handle_tchkarg2(object) != null ) { +// result = append_name( acc_handle_conn( +// acc_handle_tchkarg2(object) ) ); +// } +// return( result ); + case PATH_INSTANCE: + { + tree pathDesc; + tree t; + tree decl; + + pathDesc = PATH_INSTANCE_PATHDESC((tree) object); + ASSERT(pathDesc != NULL_TREE); + ASSERT(TREE_CODE(pathDesc) == PATH_NODE); + + t = PATH_OUTPUTS(pathDesc); + ASSERT(t != NULL_TREE); + ASSERT(TREE_CODE(t) == TREE_LIST); + + decl = TREE_PURPOSE(t); + ASSERT(decl != NULL_TREE); + + result = append_name((handle) decl); + result = pli_append_string(pli_info.config.accPathDelimStr_); + + t = PATH_INPUTS(pathDesc); + ASSERT(t != NULL_TREE); + ASSERT(TREE_CODE(t) == TREE_LIST); + + decl = TREE_PURPOSE(t); + ASSERT(decl != NULL_TREE); + + result = append_name((handle) decl); + } + return (result); + } + + + t = (tree) object; + switch (*tree_code_type[TREE_CODE(t)]) { + case 'd': /* decl nodes */ + return pli_append_string(IDENT(DECL_NAME((tree) object))); + case 'b': /* blocks */ + return pli_append_string(IDENT(BLOCK_NAME((tree) object))); + case 'g': /* primitive */ + return pli_append_string(GATE_NAME((tree) object)); + case 'r': /* storage reference */ + switch (TREE_CODE(t)) { + case PART_REF: + { + tree name = PART_NAME(t); + + if (TREE_CODE(name) != IDENTIFIER_NODE) { + name = DECL_NAME(name); + } + + sprintf(buffer, "%s[%d:%d]", + IDENT(name), + get_range(PART_MSB_(t), IDENT(name)), + get_range(PART_LSB_(t), IDENT(name))); + } + return (pli_append_string(buffer)); + case BIT_REF: + { + tree name = BIT_REF_NAME(t); + + if (TREE_CODE(name) != IDENTIFIER_NODE) { + name = DECL_NAME(name); + } + + sprintf(buffer, "%s[%d]", + IDENT(name), get_range(BIT_EXPR(t), IDENT(name))); + } + return (pli_append_string(buffer)); + default: + return NULL; + } + + default: + return NULL; + } +} + +/************************************************************************ + * acc_handle_calling_mod_m +/***********************************************************************/ + +handle acc_handle_calling_mod_m(void) +{ + return (acc_handle_parent((handle) tf_getinstance())); +} + +/******************************************* + mdh - left off here +********************************************/ + + +/************************************************************************ + * acc_set_value * +/***********************************************************************/ + +int +acc_set_value(handle object, p_setval_value value_p, + p_setval_delay delay_p) +{ + time64 delay; + double scaledDelay; + Group *g; + tree constant; + int nbits; + int ngroups; + Group g1; + tree t = (tree) object; + int type; + int fulltype; + tree stmt; + SCB *scb; + time64 newTime; + + acc_error_flag = FALSE; + + // calculate delay first + switch (delay_p->time.type) { + case accTime: + tf_scale_longdelay(tf_getinstance(), delay_p->time.low, + delay_p->time.high, (int *) &delay.timel, + (int *) &delay.timeh); + break; + case accSimTime: + delay.timeh = delay_p->time.high; + delay.timel = delay_p->time.low; + break; + case accRealTime: + tf_scale_realdelay(tf_getinstance(), delay_p->time.real, + &scaledDelay); + tf_real_to_long(scaledDelay, (int *) &delay.timel, + (int *) &delay.timeh); + break; + default: + tf_error("Illegal time type in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + } + + + fulltype = acc_fetch_fulltype(object); + type = acc_fetch_type(object); + + // get pointer to storage area + + switch (delay_p->model) { + case accNoDelay: + if (type != accRegister && fulltype != accSeqPrim) { + tf_error + ("Object must be either a register or sequential UDP in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + } + if (fulltype == accSeqPrim) { + nbits = 1; + ngroups = 1; + g = &g1; + } else { + nbits = acc_fetch_size(object); + ngroups = (nbits + 31) / 32; + g = DECL_STORAGE(t); + } + break; + case accPureTransportDelay: + if (type != accRegister) { + tf_error("Object must be a register in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + } + nbits = acc_fetch_size(object); + ngroups = (nbits + 31) / 32; + g = malloc_Z(ngroups); + break; + case accAssignFlag: + if (type != accRegister) { + tf_error("Object must be a register in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + } + nbits = acc_fetch_size(object); + ngroups = (nbits + 31) / 32; + constant = build_bit_cst(nbits, BIN); + g = BIT_CST_GROUP(constant); + break; + case accDeassignFlag: + if (type != accRegister) { + tf_error("Object must be a register in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + } + nbits = acc_fetch_size(object); + ngroups = (nbits + 31) / 32; + g = NULL; + break; + case accForceFlag: + if (type != accRegister && type != accNet) { + tf_error + ("Object must be either a register or net in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + } + nbits = acc_fetch_size(object); + ngroups = (nbits + 31) / 32; + constant = build_bit_cst(nbits, BIN); + g = BIT_CST_GROUP(constant); + break; + case accReleaseFlag: + if (type != accRegister && type != accNet) { + tf_error + ("Object must be either a register or net in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + } + nbits = acc_fetch_size(object); + ngroups = (nbits + 31) / 32; + g = NULL; + break; + + case accInertialDelay: + tf_error("accInertialDelay not supported in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + case accTransportDelay: + tf_error("accTransportDelay not supported in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + default: + tf_error("Illegal time model in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + } + + // parse input value + + if (g) + switch (value_p->format) { + case accScalarVal: + if (ngroups > 1) { + memset(g, 0, ngroups * sizeof(Group)); + } + switch (value_p->value.scalar) { + case acc0: + AVAL(g) = 0; + BVAL(g) = 0; + break; + case acc1: + AVAL(g) = 1; + BVAL(g) = 0; + break; + case accX: + AVAL(g) = 1; + BVAL(g) = 1; + break; + case accZ: + AVAL(g) = 0; + BVAL(g) = 1; + break; + } + break; + case accVectorVal: + memcpy(g, value_p->value.vector, ngroups * sizeof(Group)); + break; + case accIntVal: + AVAL(g) = value_p->value.integer; + BVAL(g) = 0; + break; + case accRealVal: + REAL_(g) = value_p->value.real; + break; + case accStringVal: + StringToGroup(value_p->value.str, g, nbits, ngroups); + break; + case accBinStrVal: + parse_base_const1g(BIN, + value_p->value.str + + strlen(value_p->value.str) - 1, nbits, + strlen(value_p->value.str), g); + break; + case accOctStrVal: + parse_base_const1g(OCT, + value_p->value.str + + strlen(value_p->value.str) - 1, nbits, + strlen(value_p->value.str), g); + break; + case accDecStrVal: + parse_base_const1g(DEC, + value_p->value.str + + strlen(value_p->value.str) - 1, nbits, + strlen(value_p->value.str), g); + break; + case accHexStrVal: + parse_base_const1g(HEX, + value_p->value.str + + strlen(value_p->value.str) - 1, nbits, + strlen(value_p->value.str), g); + break; + default: + tf_error("Illegal format in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + } + // apply new value + + + switch (delay_p->model) { + case accNoDelay: + if (fulltype == accSeqPrim) { + tf_error("accSeqPrim are not supported in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + } else { + notify(t, DECL_STATE(t), 1, NULL); + } + break; + case accPureTransportDelay: + if (delayFreeList) { + stmt = delayFreeList; + delayFreeList = PLI_DELAY_NEXT(stmt); + } else { + stmt = make_node(PLI_DELAY); + } + + ADDTIME6464(&newTime, &CurrentTime, &delay); + PLI_DELAY_TIME(stmt) = newTime; + + PLI_DELAY_LVAL(stmt) = t; + PLI_DELAY_STORAGE(stmt) = g; + TREE_NBITS(stmt) = nbits; + + PLI_DELAY_NEXT(stmt) = NULL; + scb = BuildSCB(stmt, NOLIST); + + Schedule64(&newTime, scb, FALSE); + break; + case accAssignFlag: + stmt = make_node(ASSIGN_PROC_STMT); + TREE_CHAIN(stmt) = dump; + STMT_ASSIGN_RVAL(stmt) = constant; + STMT_ASSIGN_LVAL(stmt) = t; + scb = BuildSCB(stmt, NOLIST); + pass3_assignment(stmt); + Schedule64(&CurrentTime, scb, FALSE); + break; + case accDeassignFlag: + stmt = make_node(DEASSIGN_STMT); + TREE_CHAIN(stmt) = dump; + STMT_BODY(stmt) = t; + scb = BuildSCB(stmt, NOLIST); + Schedule64(&CurrentTime, scb, FALSE); + break; + case accForceFlag: + stmt = make_node(FORCE_STMT); + TREE_CHAIN(stmt) = dump; + STMT_ASSIGN_RVAL(stmt) = constant; + STMT_ASSIGN_LVAL(stmt) = t; + scb = BuildSCB(stmt, NOLIST); + pass3_assignment(stmt); + Schedule64(&CurrentTime, scb, FALSE); + break; + case accReleaseFlag: + stmt = make_node(RELEASE_STMT); + TREE_CHAIN(stmt) = dump; + STMT_BODY(stmt) = t; + scb = BuildSCB(stmt, NOLIST); + Schedule64(&CurrentTime, scb, FALSE); + break; + case accInertialDelay: + tf_error("accInertialDelay is not supported in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + case accTransportDelay: + tf_error("accTransportDelay is not supported in acc_set_value()"); + acc_error_flag = TRUE; + return 1; + } + + return 0; +} + + +/**************************************************************** + + acc_handle_hiconn + - return hi net connected to port + +*****************************************************************/ +handle acc_handle_hiconn(handle terminal) +{ + tree t = (tree) terminal; + + tf_error("acc_handle_hiconn() is not supported"); + return null; +#if 0 + acc_error_flag = FALSE; + if (TREE_CODE((tree) terminal) != TREE_LIST) { + acc_error_flag = TRUE; + return NULL; + } + return ((handle) PORT_TERMINAL_HICONN((tree) terminal)); +#endif +} + + + +/************************************************************************ + * acc_handle_defn + * - does nothing for now + *********************************************************************** * + */ +void *acc_handle_defn() +{ + return 0; +} diff --git a/src/pli.h b/src/pli.h new file mode 100644 index 0000000..05ed631 --- /dev/null +++ b/src/pli.h @@ -0,0 +1,89 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* PLI.H - PLI structures and routine prototypes */ + +#ifndef PLI_H +#define PLI_H + +// public methods + + +//#define PLI_ARG_MARKERS(NODE) (TREE_VALUE (TREE_STMT (NODE))) +//#define PLI_ARG_PVC(NODE) (TREE_PURPOSE (TREE_STMT (NODE))) +//#define PLI_ARG_INFO(NODE) (TREE_3RD (TREE_STMT (NODE))) + +enum pli_arg_type { PLI_FREE, PLI_ASYNCH, PLI_VCL }; + +typedef tree instance_t; + +typedef struct PliInfo_tag { + int pvc:1; /* This argument has changed */ + int saved_pvc:1; /* Saved for the user */ + int vclSet:1; /* driver vcls are set */ + int pad:29; /* bit padding */ + int argNumber; /* number of argument,starting at 1 */ + tree instance; /* Pointer to the task or function */ + Group *storage; /* Pointer to data storage */ + struct Marker *marker; /* placeholder for markers */ +} PliInfo_t; + + +struct pli_vcl { + struct Marker *marker; + int (*routine) (s_vc_record *); + tree decl; + char *user_data; +}; + +typedef struct pli_lcb { + struct pli_lcb *next; + void (*routine) (char *, unsigned int, char *); + tree module; + char *userdata; +} pli_lcb; + +extern tree current_tf_instance; +extern int lcbCount; + +void vcl_dispatch(struct pli_vcl *); /* pli.i 17/05/94 22.58.34 */ +void freePliDelayNode(tree); +void handleLcb(tree); +void init_pli(void); + +// private methods + +#ifdef PLI_C +static Group *fetch_storage(tree object); +static char *pli_write_string(char *string); +static int lookup_vcl(tree object, int (*routine) (s_vc_record *), + char *user_data, struct Marker **marker); +static tree nth_arg(int n, tree instance); +static tree nth_parameter(int n, tree instance); +static int is_scalar(handle object); +static int is_vector(handle object); +static int is_expanded(handle object); +static int is_collapsed(handle object); +static char *GroupToString(Group * g, int nbits, int ngroups); +static void StringToGroup(char *string, Group * g, int nbits, int ngroups); +char *append_name(handle object); +static handle resolve_path(handle anchor, char *path); +#endif // PLI_C + +#endif // PLI_H diff --git a/src/plihacks.cc b/src/plihacks.cc new file mode 100644 index 0000000..b739a16 --- /dev/null +++ b/src/plihacks.cc @@ -0,0 +1,1781 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/****************************************************************************** + * + * plihacks.c + * this is a set of useful pli calls + * + ******************************************************************************/ +#define PLIHACKS_C + +#include +#include +#include +#include "veriuser.h" +#include "acc_user.h" +#include "glue.h" +#include "plihacks.h" +#include "vtypes.h" + + +#define HASH_SIZE (4096) +#define HASH(h) ((((long)(h)>>16) ^ ((long)(h)&0xffff))%HASH_SIZE); + +typedef struct LogEntry_tag { + handle object; + struct LogEntry_tag *next; +} LogEntry_t; + +static int depth; +static int declList[] = + { accNamedEvent, accTimeVar, accIntegerVar, accRealVar, accRegister, +0 }; +static int enableReason = FALSE; +static LogEntry_t *hashTable[HASH_SIZE]; + +/************************************************************************* + + $$abort + - this routine will execute an exit(2) system call + +**************************************************************************/ + +int abort_call(int data, int reason) +{ + + acc_initialize(); + + shell_exit(2); + + acc_close(); + return (0); + +} + +/************************************************************************* + + push + - increase the current depth + +**************************************************************************/ +static void push() +{ + ASSERT(depth >= 0); + depth++; +} + +/************************************************************************* + + pop + - decrease the current depth + +**************************************************************************/ +static void pop() +{ + ASSERT(depth > 0); + depth--; +} + +/************************************************************************* + + indent + - indent the correct number of spaces for the given level + +**************************************************************************/ +static void indent() +{ + int count; + + for (count = 0; count < depth; count++) { + io_printf(" "); + } +} + +/************************************************************************* + + DumpPath + - output all information about the given module path + +**************************************************************************/ +static void DumpPath(handle object) +{ + double d1; + double d2; + double d3; + double d4; + double d5; + double d6; + handle terminal; + handle parent; + handle in1; + handle out1; + + + push(); + + indent(); + parent = acc_handle_parent(object); + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + + indent(); + if (acc_handle_condition(object)) { + io_printf("- condition is present\n"); + } else { + io_printf("- condition is not present\n"); + } + + indent(); + io_printf("- polarity is "); + switch (acc_fetch_polarity(object)) { + case accPositive: + io_printf("accPositive"); + break; + case accNegative: + io_printf("accNegative"); + break; + case accUnknown: + io_printf("accUnknown"); + break; + default: + io_printf("unknown"); + } + io_printf("\n"); + + acc_fetch_delays(object, &d1, &d2, &d3, &d4, &d5, &d6); + indent(); + io_printf("- delay1 = %g\n", d1); + indent(); + io_printf("- delay2 = %g\n", d2); + indent(); + io_printf("- delay3 = %g\n", d3); + indent(); + io_printf("- delay4 = %g\n", d4); + indent(); + io_printf("- delay5 = %g\n", d5); + indent(); + io_printf("- delay6 = %g\n", d6); + + indent(); + io_printf("=> acc_handle_pathin()\n"); + in1 = acc_handle_pathin(object); + DumpObject(in1); + + indent(); + io_printf("=> acc_handle_pathout()\n"); + out1 = acc_handle_pathout(object); + DumpObject(out1); + + // test acc_handle_modpath + if (acc_handle_modpath + (parent, acc_fetch_name(in1), acc_fetch_name(out1)) + != object) { + tf_error("acc_handle_modpath() test failure"); + } + + indent(); + io_printf("=> acc_next_output()\n"); + terminal = null; + while (TRUE) { + terminal = acc_next_output(object, terminal); + if (terminal == null) { + break; + } + DumpObject(terminal); + } + indent(); + io_printf("=> acc_next_input()\n"); + terminal = null; + while (TRUE) { + terminal = acc_next_input(object, terminal); + if (terminal == null) { + break; + } + DumpObject(terminal); + } + pop(); +} + +/************************************************************************* + + DumpTimingCheck + - output all information about the given timing check + +**************************************************************************/ +static void DumpTimingCheck(handle object) +{ + double d1; + double d2; + double d3; + double d4; + double d5; + double d6; + handle parent; + handle arg1; + handle arg2; + int edge1; + int edge2; + + push(); + + parent = acc_handle_parent(object); + indent(); + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + + + acc_fetch_delays(object, &d1, &d2, &d3, &d4, &d5, &d6); + indent(); + io_printf("- delay1 = %g\n", d1); + + arg1 = acc_handle_tchkarg1(object); + if (arg1 != null) { + edge1 = acc_fetch_edge(arg1); + } + + arg2 = acc_handle_tchkarg2(object); + if (arg2 != null) { + edge2 = acc_fetch_edge(arg2); + } + + if (object != acc_handle_tchk(parent, acc_fetch_fulltype(object), + acc_fetch_name(arg1), edge1, + acc_fetch_name(arg2), edge2)) { + tf_error("ERROR: acc_handle_tchk() test failure"); + } + + indent(); + arg1 = acc_handle_tchkarg1(object); + io_printf("- arg 1 is %s\n", acc_fetch_name(arg1)); + if (arg1) { + DumpObject(arg1); + } + + indent(); + arg2 = acc_handle_tchkarg2(object); + io_printf("- arg 2 is %s\n", acc_fetch_name(arg2)); + if (arg2) { + DumpObject(arg2); + } + + pop(); +} + +/************************************************************************* + + DumpParam + - output all information about the given param + +**************************************************************************/ +static void DumpParam(handle object) +{ + handle parent; + handle newObject; + int type; + + push(); + + parent = acc_handle_parent(object); + indent(); + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + + type = acc_fetch_paramtype(object); + indent(); + io_printf("- is type "); + switch (type) { + case accIntegerParam: + io_printf("accIntegerParam"); + break; + case accRealParam: + io_printf("accRealParam"); + break; + case accStringParam: + io_printf("accStringParam"); + break; + default: + io_printf("unknown"); + } + io_printf("\n"); + + indent(); + switch (type) { + case accIntegerParam: + io_printf("- value is %d\n", (int) acc_fetch_paramval(object)); + break; + case accRealParam: + io_printf("- value is %f\n", acc_fetch_paramval(object)); + break; + case accStringParam: + io_printf("- value is %s\n", + (char *) (int) acc_fetch_paramval(object)); + break; + } + + pop(); +} + +/************************************************************************* + + DumpDecl + - output all information about the given Decl + +**************************************************************************/ +static void DumpDecl(handle object) +{ + handle parent; + handle newObject; + + push(); + + parent = acc_handle_parent(object); + indent(); + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + + + if (acc_fetch_type(object) != accNamedEvent) { + indent(); + io_printf("value(b) = %s\n", acc_fetch_value(object, "%b")); + indent(); + io_printf("value(o) = %s\n", acc_fetch_value(object, "%o")); + indent(); + io_printf("value(h) = %s\n", acc_fetch_value(object, "%h")); + indent(); + io_printf("value(d) = %s\n", acc_fetch_value(object, "%d")); + } + + pop(); +} + +/************************************************************************* + + DumpReg + - output all information about the given Reg + +**************************************************************************/ +static void DumpReg(handle object) +{ + int msb; + int lsb; + handle parent; + handle newObject; + + push(); + + parent = acc_handle_parent(object); + indent(); + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + + indent(); + io_printf("- is "); + if (acc_object_of_type(object, accScalar)) { + io_printf("accScalar, "); + } + if (acc_object_of_type(object, accVector)) { + io_printf("accVector, "); + } + io_printf("\n"); + + if (acc_fetch_size(object) > 1) { + indent(); + acc_fetch_range(object, &msb, &lsb); + io_printf("- range is [%d:%d]\n", msb, lsb); + } + + indent(); + io_printf("- size is %d\n", acc_fetch_size(object)); + + indent(); + io_printf("value(b) = %s\n", acc_fetch_value(object, "%b")); + indent(); + io_printf("value(o) = %s\n", acc_fetch_value(object, "%o")); + indent(); + io_printf("value(h) = %s\n", acc_fetch_value(object, "%h")); + indent(); + io_printf("value(d) = %s\n", acc_fetch_value(object, "%d")); + + newObject = null; + while (TRUE) { + newObject = acc_next_load(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + pop(); +} + +/************************************************************************* + + DumpNet + - output all information about the given Net + +**************************************************************************/ +static void DumpNet(handle object) +{ + int msb; + int lsb; + handle parent; + handle newObject; + + push(); + + parent = acc_handle_parent(object); + indent(); + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + + indent(); + io_printf("- is "); + if (acc_object_of_type(object, accScalar)) { + io_printf("accScalar, "); + } + if (acc_object_of_type(object, accVector)) { + io_printf("accVector, "); + } + if (acc_object_of_type(object, accCollapsedNet)) { + io_printf("accCollapsedNet, "); + } + if (acc_object_of_type(object, accExpandedVector)) { + io_printf("accExpandedVector, "); + } + if (acc_object_of_type(object, accUnexpandedVector)) { + io_printf("accUnexpandedVector, "); + } + if (acc_object_of_type(object, accScope)) { + io_printf("accScope, "); + } + if (acc_object_of_type(object, accModPathHasIfnone)) { + io_printf("accModPathHasIfnone, "); + } + io_printf("\n"); + + if (acc_fetch_size(object) > 1) { + indent(); + acc_fetch_range(object, &msb, &lsb); + io_printf("- range is [%d:%d]\n", msb, lsb); + } + + indent(); + io_printf("- size is %d\n", acc_fetch_size(object)); + + indent(); + io_printf("value(b) = %s\n", acc_fetch_value(object, "%b")); + indent(); + io_printf("value(o) = %s\n", acc_fetch_value(object, "%o")); + indent(); + io_printf("value(h) = %s\n", acc_fetch_value(object, "%h")); + indent(); + io_printf("value(d) = %s\n", acc_fetch_value(object, "%d")); + + newObject = acc_handle_simulated_net(object); + indent(); + io_printf("=> acc_handle_simulated_net()\n"); + DumpObject(newObject); + + indent(); + io_printf("=> acc_next_driver()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_driver(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + indent(); + io_printf("=> acc_next_load()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_load(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + indent(); + io_printf("=> acc_next_cell_load()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_cell_load(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + pop(); +} + +/************************************************************************* + + DumpPrimitive + - output all information about the given primitive + +**************************************************************************/ +static void DumpPrimitive(handle object) +{ + double d1; + double d2; + double d3; + double d4; + double d5; + double d6; + handle terminal; + char *type; + handle parent; + + push(); + + indent(); + io_printf("- defname %s\n", acc_fetch_defname(object)); + + parent = acc_handle_parent(object); + indent(); + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + + indent(); + io_printf("=> acc_next_terminal()\n"); + terminal = null; + while (true) { + terminal = acc_next_terminal(object, terminal); + if (terminal == null) { + break; + } + DumpObject(terminal); + } + + acc_fetch_delays(object, &d1, &d2, &d3, &d4, &d5, &d6); + indent(); + io_printf("- rising = %g\n", d1); + indent(); + io_printf("- falling = %g\n", d2); + indent(); + io_printf("- z = %g\n", d3); + pop(); +} + +/************************************************************************* + + lineTrace + trace execution + +**************************************************************************/ + +void lineTrace(char *file, unsigned int line, char *udata) +{ + io_printf("Executing: %s[%d]\n", file, line); +} + +/************************************************************************* + + TimescaleToString + - convert time unit to a string + +**************************************************************************/ + +static char *TimescaleToString(int t) +{ + switch (t) { + case 2: + return "100 s"; + case 1: + return "10 s"; + case 0: + return "1 s"; + case -1: + return "100 ms"; + case -2: + return "10 ms"; + case -3: + return "1 ms"; + case -4: + return "100 us"; + case -5: + return "10 us"; + case -6: + return "1 us"; + case -7: + return "100 ns"; + case -8: + return "10 ns"; + case -9: + return "1 ns"; + case -10: + return "100 ps"; + case -11: + return "10 ps"; + case -12: + return "1 ps"; + case -13: + return "100 fs"; + case -14: + return "10 fs"; + case -15: + return "1 fs"; + default: + return "unknown"; + } +} + +/************************************************************************* + + DumpTerminal + - output all information about the given primitive terminal + +**************************************************************************/ + +static void DumpTerminal(handle object) +{ + handle parent; + handle newObject; + int index; + + push(); + parent = acc_handle_parent(object); + indent(); + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + + index = acc_fetch_index(object); + indent(); + io_printf("- index is %d\n", index); + if (acc_handle_terminal(parent, index) != object) { + tf_error("acc_handle_terminal() test failure\n"); + } + + indent(); + io_printf("- direction is "); + switch (acc_fetch_direction(object)) { + case accInput: + io_printf("accInput"); + break; + case accOutput: + io_printf("accOutput"); + break; + case accInout: + io_printf("accInout"); + break; + case accMixedIo: + io_printf("accMixedIo"); + break; + default: + io_printf("unknown"); + } + io_printf("\n"); + + + indent(); + io_printf("=> acc_handle_conn()\n"); + newObject = acc_handle_conn(object); + DumpObject(newObject); + + pop(); + +} + +/************************************************************************* + + DumpTchkTerminal + - output all information about the given timing check terminal + +**************************************************************************/ + +static void DumpTchkTerminal(handle object) +{ + handle parent; + handle newObject; + int index; + int edge; + + push(); + parent = acc_handle_parent(object); + indent(); + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + + indent(); + io_printf("- edge is "); + edge = acc_fetch_edge(object); + switch (edge) { + case accNoedge: + io_printf("accNoedge"); + break; + case accPosedge: + io_printf("accPosedge"); + break; + case accNegedge: + io_printf("accNegedge"); + break; + default: + io_printf("["); + if (edge & accEdge01) { + io_printf("accEdge01,"); + } + if (edge & accEdge10) { + io_printf("accEdge10,"); + } + if (edge & accEdge0x) { + io_printf("accEdge0x,"); + } + if (edge & accEdgex1) { + io_printf("accEdgex0,"); + } + if (edge & accEdgex1) { + io_printf("accEdgex1,"); + } + if (edge & accEdge1x) { + io_printf("accEdge1x,"); + } + io_printf("]"); + } + io_printf("\n"); + + + if (acc_handle_condition(object)) { + indent(); + io_printf("- has condition\n"); + } + + indent(); + io_printf("=> acc_handle_conn()\n"); + newObject = acc_handle_conn(object); + DumpObject(newObject); + + pop(); + +} + +/************************************************************************* + + DumpPathTerminal + - output all information about the given path terminal + +**************************************************************************/ + +static void DumpPathTerminal(handle object) +{ + handle parent; + handle newObject; + int index; + int edge; + + push(); + parent = acc_handle_parent(object); + indent(); + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + + indent(); + io_printf("- edge is "); + edge = acc_fetch_edge(object); + switch (edge) { + case accNoedge: + io_printf("accNoedge"); + break; + case accPosedge: + io_printf("accPosedge"); + break; + case accNegedge: + io_printf("accNegedge"); + break; + default: + io_printf("["); + if (edge & accEdge01) { + io_printf("accEdge01,"); + } + if (edge & accEdge10) { + io_printf("accEdge10,"); + } + if (edge & accEdge0x) { + io_printf("accEdge0x,"); + } + if (edge & accEdgex1) { + io_printf("accEdgex0,"); + } + if (edge & accEdgex1) { + io_printf("accEdgex1,"); + } + if (edge & accEdge1x) { + io_printf("accEdge1x,"); + } + io_printf("]"); + } + io_printf("\n"); + + indent(); + io_printf("=> acc_handle_conn()\n"); + newObject = acc_handle_conn(object); + DumpObject(newObject); + + pop(); + +} + +/************************************************************************* + + DumpPort + - output all information about the given port + +**************************************************************************/ + +static void DumpPort(handle object) +{ + handle parent; + handle newObject; + int index; + + push(); + parent = acc_handle_parent(object); + indent(); + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + + index = acc_fetch_index(object); + indent(); + io_printf("- index is %d\n", index); + if (acc_handle_port(parent, index) != object) { + tf_error("acc_handle_port() test failure\n"); + } + + indent(); + io_printf("- direction is "); + switch (acc_fetch_direction(object)) { + case accInput: + io_printf("accInput"); + break; + case accOutput: + io_printf("accOutput"); + break; + case accInout: + io_printf("accInout"); + break; + case accMixedIo: + io_printf("accMixedIo"); + break; + default: + io_printf("unknown"); + } + io_printf("\n"); + + indent(); + io_printf("=> acc_handle_loconn()\n"); + newObject = acc_handle_loconn(object); + DumpObject(newObject); + +/* + indent(); + io_printf( "=> acc_handle_hiconn()\n" ); + newObject = acc_handle_hiconn( object ); + DumpObject( newObject ); +*/ + pop(); + +} + +/************************************************************************* + + DumpFunction + - output all information about the given function + +**************************************************************************/ + +static void DumpFunction(handle object) +{ + handle child; + handle path; + handle gate; + handle port; + char *type; + handle driver; + handle check; + handle net; + handle firstNet; + s_location loc; + handle newObject; + int delayMode; + s_timescale_info timescale_info; + handle parent; + + + push(); + + acc_mod_lcb_add(object, lineTrace, NULL); + indent(); + io_printf("- defname is %s\n", acc_fetch_defname(object)); + + indent(); + acc_fetch_location(&loc, object); + io_printf("- location is %s[%d]\n", loc.filename, loc.line_no); + + indent(); + io_printf("- is of type %s[%s]\n", + acc_fetch_type_str(acc_fetch_type(object)), + acc_fetch_type_str(acc_fetch_fulltype(object))); + + parent = acc_handle_parent(object); + indent(); + if (parent != null) { + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + } else { + io_printf("- is child of %s\n", ""); + } + + + + + + // test acc_next_child + indent(); + io_printf("=> acc_next_child()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_child(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + // test acc_next_cell + indent(); + io_printf("=> acc_next_cell()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_cell(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + + // test acc_next_net + indent(); + io_printf("=> acc_next_net()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_net(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + // test acc_next_parameter + indent(); + io_printf("=> acc_next_parameter()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_parameter(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_port + indent(); + io_printf("=> acc_next_port()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_port(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_portout + indent(); + io_printf("=> acc_next_portout()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_portout(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_primitive + indent(); + io_printf("=> acc_next_primitive()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_primitive(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_scope + indent(); + io_printf("=> acc_next_scope()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_scope(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + + // test acc_next + indent(); + io_printf("=> acc_next()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next(declList, object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + pop(); +} + +/************************************************************************* + + DumpTask + - output all information about the given task + +**************************************************************************/ + +static void DumpTask(handle object) +{ + handle child; + handle path; + handle gate; + handle port; + char *type; + handle driver; + handle check; + handle net; + handle firstNet; + s_location loc; + handle newObject; + int delayMode; + s_timescale_info timescale_info; + handle parent; + + + push(); + + acc_mod_lcb_add(object, lineTrace, NULL); + indent(); + io_printf("- defname is %s\n", acc_fetch_defname(object)); + + indent(); + acc_fetch_location(&loc, object); + io_printf("- location is %s[%d]\n", loc.filename, loc.line_no); + + indent(); + io_printf("- is of type %s[%s]\n", + acc_fetch_type_str(acc_fetch_type(object)), + acc_fetch_type_str(acc_fetch_fulltype(object))); + + parent = acc_handle_parent(object); + indent(); + if (parent != null) { + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + } else { + io_printf("- is child of %s\n", ""); + } + + + + // test acc_next_child + indent(); + io_printf("=> acc_next_child()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_child(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + // test acc_next_cell + indent(); + io_printf("=> acc_next_cell()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_cell(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_net + indent(); + io_printf("=> acc_next_net()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_net(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + // test acc_next_parameter + indent(); + io_printf("=> acc_next_parameter()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_parameter(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_port + indent(); + io_printf("=> acc_next_port()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_port(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_portout + indent(); + io_printf("=> acc_next_portout()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_portout(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_primitive + indent(); + io_printf("=> acc_next_primitive()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_primitive(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_scope + indent(); + io_printf("=> acc_next_scope()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_scope(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next + indent(); + io_printf("=> acc_next()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next(declList, object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + pop(); +} + +/************************************************************************* + + DumpModule + - output all information about the given module + +**************************************************************************/ + +static void DumpModule(handle object) +{ + handle child; + handle path; + handle gate; + handle port; + char *type; + handle driver; + handle check; + handle net; + handle firstNet; + s_location loc; + handle newObject; + int delayMode; + s_timescale_info timescale_info; + handle parent; + + + push(); + + acc_mod_lcb_add(object, lineTrace, NULL); + indent(); + io_printf("- defname is %s\n", acc_fetch_defname(object)); + + indent(); + acc_fetch_location(&loc, object); + io_printf("- location is %s[%d]\n", loc.filename, loc.line_no); + + indent(); + io_printf("- is of type %s[%s]\n", + acc_fetch_type_str(acc_fetch_type(object)), + acc_fetch_type_str(acc_fetch_fulltype(object))); + + parent = acc_handle_parent(object); + indent(); + if (parent != null) { + io_printf("- is child of %s\n", acc_fetch_fullname(parent)); + } else { + io_printf("- is child of %s\n", ""); + } + + indent(); + io_printf("- delay mode is "); + delayMode = acc_fetch_delay_mode(object); + switch (delayMode) { + case accDelayModeNone: + io_printf("accDelayModeNone"); + break; + case accDelayModeZero: + io_printf("accDelayModeZero"); + break; + case accDelayModeUnit: + io_printf("accDelayModeUnit"); + break; + case accDelayModeDistrib: + io_printf("accDelayModeDistrib"); + break; + case accDelayModePath: + io_printf("accDelayModePath"); + break; + case accDelayModeMTM: + io_printf("accDelayModeMTM"); + break; + default: + io_printf("unknown"); + + } + io_printf("\n"); + + acc_fetch_timescale_info(object, ×cale_info); + indent(); + io_printf("- timescale is %s/%s\n", + TimescaleToString(timescale_info.unit), + TimescaleToString(timescale_info.precision)); + + + + + // test acc_next_child + indent(); + io_printf("=> acc_next_child()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_child(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + // test acc_next_cell + indent(); + io_printf("=> acc_next_cell()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_cell(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + // test acc_next_modpath + indent(); + io_printf("=> acc_next_modpath()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_modpath(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_net + indent(); + io_printf("=> acc_next_net()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_net(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + // test acc_next_parameter + indent(); + io_printf("=> acc_next_parameter()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_parameter(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_port + indent(); + io_printf("=> acc_next_port()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_port(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_portout + indent(); + io_printf("=> acc_next_portout()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_portout(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_primitive + indent(); + io_printf("=> acc_next_primitive()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_primitive(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_scope + indent(); + io_printf("=> acc_next_scope()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_scope(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + // test acc_next_specparam + indent(); + io_printf("=> acc_next_specparam()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_specparam(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + + // test acc_next_tchk + indent(); + io_printf("=> acc_next_tchk()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next_tchk(object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + + // test acc_next + indent(); + io_printf("=> acc_next()\n"); + newObject = null; + while (TRUE) { + newObject = acc_next(declList, object, newObject); + if (newObject == null) { + break; + } + DumpObject(newObject); + } + pop(); +} + +/************************************************************************* + + DumpObject + - log object and dispatch if not yet visited + +**************************************************************************/ + +static void DumpObject(handle object) +{ + int index; + int type; + LogEntry_t *logEntry; + + index = HASH(object); + + for (logEntry = hashTable[index]; + logEntry && logEntry->object != object; + logEntry = logEntry->next); + + indent(); + io_printf("%s[%s] is %s<%s>\n", acc_fetch_name(object), + acc_fetch_fullname(object), + acc_fetch_type_str(acc_fetch_type(object)), + acc_fetch_type_str(acc_fetch_fulltype(object))); + + if (logEntry && logEntry->object == object) { + return; + } + + logEntry = (LogEntry_t *) xmalloc(sizeof(LogEntry_t)); + + logEntry->object = object; + logEntry->next = hashTable[index]; + hashTable[index] = logEntry; + + type = acc_fetch_type(object); + switch (type) { + case accTchkTerminal: + DumpTchkTerminal(object); + break; + case accTchk: + DumpTimingCheck(object); + break; + case accParameter: + case accSpecparam: + DumpParam(object); + break; + case accIntegerVar: + case accRealVar: + case accTimeVar: + case accNamedEvent: + DumpDecl(object); + break; + case accReg: + DumpReg(object); + break; + case accNet: + DumpNet(object); + break; + case accTerminal: + DumpTerminal(object); + break; + case accPathTerminal: + DumpPathTerminal(object); + break; + case accPath: + DumpPath(object); + break; + case accPort: + DumpPort(object); + break; + case accFunction: + DumpFunction(object); + break; + case accTask: + DumpTask(object); + break; + case accModule: + DumpModule(object); + break; + case accPrimitive: + DumpPrimitive(object); + break; + default: + indent(); + io_printf("Object of type %s, not yet supported\n", + acc_fetch_type_str(type)); + } +} + + +/************************************************************************* + + $$dumpstructure + - this routine will dump out all information for the entire model + +**************************************************************************/ + +int dumpstructure_call(int data, int reason) +{ + handle scope; + int i; + + acc_initialize(); + + switch (reason) { + case reason_calltf: + io_printf("reason type %s\n", "calltf"); + break; + case reason_checktf: + enableReason = TRUE; + io_printf("reason type %s\n", "checktf"); + return 0; + case reason_sizetf: + io_printf("reason type %s\n", "sizetf"); + return 0; + case reason_disable: + if (!enableReason) { + return 0; + } + io_printf("reason type %s\n", "disable"); + return 0; + case reason_paramvc: + if (!enableReason) { + return 0; + } + io_printf("reason type %s\n", "paramvc"); + return 0; + case reason_synch: + if (!enableReason) { + return 0; + } + io_printf("reason type %s\n", "synch"); + return 0; + case reason_finish: + if (!enableReason) { + return 0; + } + io_printf("reason type %s\n", "finish"); + return 0; + case reason_reactivate: + if (!enableReason) { + return 0; + } + io_printf("reason type %s\n", "reactivate"); + return 0; + case reason_rosynch: + if (!enableReason) { + return 0; + } + io_printf("reason type %s\n", "rosynch"); + return 0; + case reason_paramdrc: + if (!enableReason) { + return 0; + } + io_printf("reason type %s\n", "paramdrc"); + return 0; + case reason_interactive: + if (!enableReason) { + return 0; + } + io_printf("reason type %s\n", "interactive"); + return 0; + case reason_endofcompile: + if (!enableReason) { + return 0; + } + io_printf("reason type %s\n", "endofcompile"); + for (i = 0; i < HASH_SIZE; i++) { + hashTable[i] = NULL; + } + return 0; + case reason_force: + if (!enableReason) { + return 0; + } + io_printf("reason type %s\n", "force"); + return 0; + case reason_release: + if (!enableReason) { + return 0; + } + io_printf("reason type %s\n", "release"); + return 0; + case reason_scope: + if (!enableReason) { + return 0; + } + io_printf("reason type %s\n", "scope"); + return 0; + default: + if (!enableReason) { + return 0; + } + io_printf("unknown reason type %d\n", reason); + return 0; + } + + depth = 0; + + tf_asynchon(); + scope = null; + while (true) { + scope = acc_next_topmod(scope); + if (scope == null) { + break; + } + DumpObject(scope); + } + + + acc_close(); + return (0); +} + +/************************************************************************* + + $$setvalue + - this will allow set value to be tested + $$setvalue( mode, decl, value, radix,delay ) + mode is string eg "accForce: + decl is net or reg + value is string or parameter value + radix is string eg "accStringVal" + delay is a time variable + +**************************************************************************/ + +int setvalue_call(int data, int reason) +{ + handle decl; + s_acc_vecval vecval; + s_acc_value value; + s_setval_delay delay; + char *ptr; + + if (reason != reason_calltf) { + return 0; + } + + acc_initialize(); + + if (tf_nump() != 5) { + tf_error + (" Error: $$setvalue( \"mode\", decl, \"value\", \"format\", delay );"); + return 0; + } + + + ptr = acc_fetch_tfarg_str(1); + if (!strcmp(ptr, "accNoDelay")) { + delay.model = accNoDelay; + } else if (!strcmp(ptr, "accInertialDelay")) { + delay.model = accInertialDelay; + } else if (!strcmp(ptr, "accTransportDelay")) { + delay.model = accTransportDelay; + } else if (!strcmp(ptr, "accPureTransportDelay")) { + delay.model = accPureTransportDelay; + } else if (!strcmp(ptr, "accAssignFlag")) { + delay.model = accAssignFlag; + } else if (!strcmp(ptr, "accDeassignFlag")) { + delay.model = accDeassignFlag; + } else if (!strcmp(ptr, "accForceFlag")) { + delay.model = accForceFlag; + } else if (!strcmp(ptr, "accReleaseFlag")) { + delay.model = accReleaseFlag; + } + + decl = acc_handle_tfarg(2); + + ptr = acc_fetch_tfarg_str(4); + if (!strcmp(ptr, "accScalarVal")) { + ptr = acc_fetch_tfarg_str(3); + value.format = accScalarVal; + if (!strcmp(ptr, "acc0")) { + value.value.scalar = acc0; + } else if (!strcmp(ptr, "acc1")) { + value.value.scalar = acc1; + } else if (!strcmp(ptr, "accX")) { + value.value.scalar = accX; + } else { + value.value.scalar = accZ; + } + } else if (!strcmp(ptr, "accVectorVal")) { + s_tfexprinfo info; + tf_exprinfo(3, &info); + value.format = accVectorVal; + value.value.vector = (p_acc_vecval) info.expr_value_p; + } else if (!strcmp(ptr, "accIntVal")) { + value.value.integer = acc_fetch_tfarg_int(3); + value.format = accIntVal; + } else if (!strcmp(ptr, "accRealVal")) { + value.value.real = acc_fetch_tfarg(3); + value.format = accRealVal; + } else if (!strcmp(ptr, "accStringVal")) { + value.value.str = acc_fetch_tfarg_str(3); + value.format = accStringVal; + } else if (!strcmp(ptr, "accBinStrVal")) { + value.value.str = acc_fetch_tfarg_str(3); + value.format = accBinStrVal; + } else if (!strcmp(ptr, "accOctStrVal")) { + value.value.str = acc_fetch_tfarg_str(3); + value.format = accOctStrVal; + } else if (!strcmp(ptr, "accDecStrVal")) { + value.value.str = acc_fetch_tfarg_str(3); + value.format = accDecStrVal; + } else if (!strcmp(ptr, "accHexStrVal")) { + value.value.str = acc_fetch_tfarg_str(3); + value.format = accHexStrVal; + } + + delay.time.low = tf_getlongp(&delay.time.high, 5); + delay.time.type = accSimTime; + + acc_set_value(decl, &value, &delay); + + acc_close(); + + return 0; +} diff --git a/src/plihacks.h b/src/plihacks.h new file mode 100644 index 0000000..2536755 --- /dev/null +++ b/src/plihacks.h @@ -0,0 +1,51 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/****************************************************************************** + * + * plihacks.h + * definitions for plihacks.c + * + ******************************************************************************/ + +#ifndef PLIHACKS_H +#define PLIHACKS_H + +// global definitions + +int abort_call(int data, int reason); +int dumpstructure_call(int data, int reason); +int setvalue_call(int data, int reason); +void lineTrace(char *file, unsigned int line, char *udata); + +#ifdef PLIHACKS_C + +// private definitions + +static void push(void); +static void pop(void); +static void indent(void); +static void DumpTask(handle object); +static void DumpFunction(handle object); +static void DumpModule(handle object); +static void dumpDecl(handle object); +static void DumpObject(handle); +#endif // PLIHACKS_C + +#endif // PLIHACKS_H diff --git a/src/print.cc b/src/print.cc new file mode 100644 index 0000000..539faad --- /dev/null +++ b/src/print.cc @@ -0,0 +1,1470 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* PRINT.C - Print numbers, text, statements to screen, files, log */ +#define PRINT_C + +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "io.h" +#include "print.h" +#include "glue.h" +#include "runtime.h" +#include "veriwell.h" + +static int print_indent; +char indent_spaces[100] = ""; +static char *doubler = NULL; +static unsigned int dd = 0; +static char *acc = NULL; +static unsigned int aa = 0; + +static char *print_buf; +static int print_buf_size; + +char *set_print_buf(unsigned_32_t size) +{ + if (size > print_buf_size) { + if (!print_buf) + print_buf = (char *) xmalloc(size); + else + print_buf = (char *) xrealloc(print_buf, size); + print_buf_size = size; + if (!print_buf) { + error("Out of memory while displaying a constant", NULL, NULL); + } + } + return print_buf; +} + +void +print_bcd(handle_t handle, Group * val, nbits_t nbits, int integer_attr, + int pad) +{ + print_bcd_(val, nbits, integer_attr, pad); + fprintf_V(handle, "%s", print_buf); +} + +static void print_char(handle_t handle, int c, int fill) +{ + if (!c) { + if (fill) + fprintf_V(handle, " "); + } else if (c == '\n') + fprintf_V(handle, "\\n"); + else if (c == ('\"')) + fprintf_V(handle, "\\\""); + else if (c == '\\') + fprintf_V(handle, "\\\\"); + else if (c == '\t') + fprintf_V(handle, "\\t"); + else if (c < ' ' || c >= 127) /* 177 octal */ + fprintf_V(handle, "\\%.3o", c); + else + fprintf_V(handle, "%c", c); +} + +static void +print_string(handle_t handle, Group * g_base, nbits_t nbits, int fill) +{ + ngroups_t i, ngroups = bits_to_groups(nbits); + int num_chars, starting_char_offset, j, c; + Group *g; + +// fprintf_V (handle, "\""); + num_chars = nbits / 8; + starting_char_offset = (num_chars - 1) % sizeof(Bit) + 1; + g = g_base + ngroups; + for (j = starting_char_offset - 1; j >= 0; j--) { + c = (AVAL(g) >> j * 8) & 255; + print_char(handle, c, fill); + } + --g; + for (i = 1; i <= ngroups; i++, --g) + for (j = sizeof(Bit) - 1; j >= 0; j--) { + c = (AVAL(g) >> j * 8) & 255; + print_char(handle, c, fill); + } +// fprintf_V (handle, "\""); +} + +/* Print a decimal number. If all bits are X, print "x". If some bits + are X, print "X". If all bits are Z, print "z". If some bits are + Z, print "Z". Else print the number. +*/ + +void +print_dec(handle_t handle, Group * g, nbits_t nbits, int int_attr, int pad) +{ + Group *g1 = g; + ngroups_t i, ngroups = bits_to_groups(nbits); + Bit tmp, mask = mask_right1[nbits & NBITS_MASK]; + enum { START, NO_XZ, SOME_Z, ALL_Z, SOME_X, ALL_X } state; + + state = START; + for (i = 0; i < ngroups; i++, g1++) { + tmp = AVAL(g1) & BVAL(g1); /* Look for Xs */ + if (tmp == -1) /* All Xs */ + state = (state == START || state == ALL_X) ? ALL_X : SOME_X; + else if (tmp || state == ALL_X) { /* Some Xs */ + state = SOME_X; + break; /* SOME_X has highest precedence */ + } else { /* No Xs, look for Zs */ + + tmp = ~AVAL(g1) & BVAL(g1); /* Look for Zs */ + if (tmp == -1) /* All Zs */ + state = (state == START + || state == ALL_Z) ? ALL_Z : SOME_Z; + else if (tmp || state == ALL_Z) /* Some Zs */ + state = SOME_Z; + else + state = NO_XZ; + } + } + + switch (state) { + case START: + tmp = AVAL(g1) & BVAL(g1) & mask; /* mask, fill w/1s */ + if (tmp == mask) + fprintf_V(handle, "x"); + else if (tmp) + fprintf_V(handle, "X"); + else if ((tmp = ~AVAL(g1) & BVAL(g1) & mask) == mask) + fprintf_V(handle, "z"); + else if (tmp) + fprintf_V(handle, "Z"); + else + print_bcd(handle, g, nbits, int_attr, pad); + break; + case NO_XZ: + print_bcd(handle, g, nbits, int_attr, pad); + break; + case SOME_X: + fprintf_V(handle, "X"); + break; + case SOME_Z: + fprintf_V(handle, "Z"); + break; + case ALL_X: + if ((AVAL(g1) & BVAL(g1) & mask) == mask) + fprintf_V(handle, "x"); + else + fprintf_V(handle, "X"); + break; + case ALL_Z: + if ((~AVAL(g1) & BVAL(g1) & mask) == mask) + fprintf_V(handle, "z"); + else if (AVAL(g1) & BVAL(g1) & mask) + fprintf_V(handle, "X"); + else + fprintf_V(handle, "Z"); + break; + } +} + +static enum print_state +print_group(Bit aval, Bit bval, int size, enum print_state state, int last, + enum radii radix, int *octal_shift, + Bit * residue_aval, Bit * residue_bval) +{ + int i; + Bit temp1, temp2; + Bit digit_mask, size_mask, radix_mask; + int decrement; + char *pb = print_buf; + int any_xs; + + switch (radix) { + case (HEX): + radix_mask = 15; + size_mask = (Bit) - 4; + decrement = 4; + break; + + case (OCT): + radix_mask = 7; + size_mask = (Bit) - 1; + decrement = 3; + break; + + case (BIN): + radix_mask = 1; + size_mask = (Bit) - 1; + decrement = 1; + break; + } + + aval = aval & mask_right[size]; + bval = bval & mask_right[size]; + + /* if radix is octal, digits may be unaligned. Print residue from previous + group, if applicable, and start from the right place. + */ + if (radix == OCT) { + /* Note: this formula works for 32-bit groups only!! */ +#if NBITS_MASK != 0x1f +#error Octal only supports 32 bits +#endif + int unaligned = size % 3 - *octal_shift; + + /* Carry forward bits from prev group */ + if (size == BITS_IN_GROUP && unaligned > 0) { + i = 32 - unaligned; + temp1 = (aval >> i) | (*residue_aval << unaligned); + temp2 = (bval >> i) | (*residue_bval << unaligned); + goto oct_continue; /* yeah, yeah; clean this up later */ + } else { + i = (size - 1) - ((size - 1) % 3) + *octal_shift; + if (i == 32) + i -= 3; + } + } else + i = (size - 1) & size_mask; + + for (; i >= 0; i = i - decrement) { + temp1 = (aval >> i) & radix_mask; + temp2 = (bval >> i) & radix_mask; + oct_continue: + digit_mask = (mask_right[size] >> i) & radix_mask; + + if (!temp2) /* Zero or one */ + switch (state) { + case START: + case EXTEND_0: + if (temp1) { /* not zero */ + state = EXTEND_DONE; + sprintf(pb++, "%1x", temp1); + } else { /* zero */ + + state = EXTEND_0; + *pb = '\0'; + } + break; + + case EXTEND_X: + sprintf(pb, "x%1x", temp1); + pb += 2; + state = EXTEND_DONE; + break; + + case EXTEND_Z: + sprintf(pb, "z%1x", temp1); + pb += 2; + state = EXTEND_DONE; + break; + + case EXTEND_DONE: + sprintf(pb++, "%1x", temp1); + break; + } + + else if ((any_xs = temp1 & temp2) != 0) /* One or more X's */ + switch (state) { + case START: + state = EXTEND_X; + case EXTEND_X: + *pb = '\0'; + break; + + case EXTEND_Z: + if (any_xs == digit_mask) + sprintf(pb, "zx"); + else + sprintf(pb, "zX"); + pb += 2; + state = EXTEND_DONE; + break; + + case EXTEND_0: + if (any_xs == digit_mask) + sprintf(pb, "0x"); + else + sprintf(pb, "0X"); + pb += 2; + state = EXTEND_DONE; + break; + + case EXTEND_DONE: + if ((any_xs & digit_mask) == digit_mask) + sprintf(pb++, "x"); + else + sprintf(pb++, "X"); + break; + } + + else /* All Z's */ + switch (state) { + case START: + state = EXTEND_Z; + case EXTEND_Z: + *pb = '\0'; + break; + + case EXTEND_X: + if (temp1) + sprintf(pb, "xZ"); + else + sprintf(pb, "xz"); + pb += 2; + state = EXTEND_DONE; + break; + + case EXTEND_0: + if (temp1) + sprintf(pb, "0Z"); + else + sprintf(pb, "0z"); + pb += 2; + state = EXTEND_DONE; + break; + + case EXTEND_DONE: + if (temp1) + sprintf(pb++, "Z"); + else + sprintf(pb++, "z"); + break; + } + + } + + /* Nothing was printed? */ + if (last && state != EXTEND_DONE) { + if (state == EXTEND_0) + sprintf(pb++, "0"); + else if (state == EXTEND_X) + sprintf(pb++, "x"); + else + sprintf(pb++, "z"); + } + + if (radix == OCT) { + if (i < 0) { + *residue_aval = aval & mask_right[*octal_shift]; + *residue_bval = bval & mask_right[*octal_shift]; + *octal_shift = (*octal_shift + 2) % 3; + } else { + *octal_shift = 0; + *residue_aval = 0; + *residue_bval = 0; + } + } + return state; +} + +/* Print a binary number to a "c"-style FILE handle (e.g. for dump files) */ + +void print_binary_file(FILE * file, Group * g, nbits_t nbits) +{ + ngroups_t i, ngroups = bits_to_groups(nbits); + int octal_shift; /* These aren't relavent */ + Bit r_aval, r_bval; /* ... */ + enum print_state state; + + set_print_buf(sizeof(Bit) * 8 + 2); /* One for \0 and one for just in case */ + + if (!ngroups) { /* sizeof (Bit) is in bytes */ + print_group(AVAL(g), BVAL(g), (int) nbits, START, 1, BIN, + &octal_shift, &r_aval, &r_bval); + fprintf(file, "%s", print_buf); + } else { + g = g + ngroups; + state = print_group(AVAL(g), BVAL(g), + (int) ((nbits - 1) % (sizeof(Bit) * 8) + 1), + START, 0, BIN, &octal_shift, &r_aval, &r_bval); + fprintf(file, "%s", print_buf); + g--; + for (i = ngroups - 1; i > 0; i--, g--) { + state = print_group(AVAL(g), BVAL(g), sizeof(Bit) * 8, + state, 0, BIN, &octal_shift, &r_aval, + &r_bval); + fprintf(file, "%s", print_buf); + } + state = print_group(AVAL(g), BVAL(g), sizeof(Bit) * 8, + state, 1, BIN, &octal_shift, &r_aval, &r_bval); + fprintf(file, "%s", print_buf); + } +} + +/* print number pointed to by 'g' in given radix. If "print_nbits" is + supplied, print in the form of "32h'xxxx", else leave out radix + info and pad with spaces. +*/ + +void +print_datum_file(handle_t handle, Group * g, nbits_t print_nbits, + nbits_t nbits, enum radii radix, int is_integer, + int fill_space, char *spec) +{ + ngroups_t i; + ngroups_t ngroups = bits_to_groups(nbits); + int octal_shift; + Bit r_aval = 0, r_bval = 0; + enum print_state state; + + set_print_buf(sizeof(Bit) * 8 + 3); + + switch (radix) { + case (HEX): + if (print_nbits) + printf_V("%d'h", print_nbits); + break; + case (OCT): + if (print_nbits) + printf_V("%d'o", print_nbits); + octal_shift = ngroups % 3; +// residue = residue ? 3 - residue : 0; + r_aval = r_bval = 0; + break; + case (BIN): + if (print_nbits) + printf_V("%d'b", print_nbits); + break; + case (DEC): + print_bcd(handle, g, nbits, is_integer, fill_space); + return; +// print_dec (handle, g, nbits, is_integer, fill_space); +// return; + case STRING_: + print_string(handle, g, nbits, fill_space); + return; + case CHAR_: + printf_V("%c", AVAL(g)); + return; + case EXP_: + case FLOAT_: + case EXPFLOAT_: + printf_V(spec, REAL_(g)); + return; + case TIME_: +// timeformatprint (REAL_ (g)); /* "%t", this is a timeformat */ + return; + } + +// if (fill_space) +// fill = ' '; +// else +// { + if (print_nbits || !fill_space) + state = START; /* space fill */ + else + state = EXTEND_DONE; /* zero fill */ +// } + + if (!ngroups) { /* sizeof (Bit) is in bytes */ + print_group(AVAL(g), BVAL(g), (int) nbits, state, 1, radix, + &octal_shift, &r_aval, &r_bval); + fprintf_V(handle, "%s", print_buf); + } else { + g = g + ngroups; + state = print_group(AVAL(g), BVAL(g), + (int) ((nbits - 1) % (sizeof(Bit) * 8) + 1), + state, 0, radix, &octal_shift, &r_aval, + &r_bval); + fprintf_V(handle, "%s", print_buf); + g--; + for (i = ngroups - 1; i > 0; i--, g--) { + state = print_group(AVAL(g), BVAL(g), sizeof(Bit) * 8, + state, 0, radix, &octal_shift, &r_aval, + &r_bval); + fprintf_V(handle, "%s", print_buf); + } + state = print_group(AVAL(g), BVAL(g), sizeof(Bit) * 8, + state, 1, radix, &octal_shift, &r_aval, + &r_bval); + fprintf_V(handle, "%s", print_buf); + } +} + +void +print_datum(Group * g, nbits_t print_nbits, nbits_t nbits, + enum radii radix, int is_integer, int fill_space) +{ + print_datum_file((handle_t) 1, g, print_nbits, nbits, radix, + is_integer, fill_space, NULL); +} + +void print_common(tree node) +{ + printf_error_V("%s%s @ %p; chain: %p; len: %i; type: %u\n", + indent_spaces, tree_code_name[TREE_CODE(node)], node, + TREE_CHAIN(node), tree_code_length[TREE_CODE(node)], + TREE_TYPE(node)); +} + +static void print_block_common(tree node) +{ + printf("%sdecl: %p; ports: %p; params: %p; up: %p; down: %p\n", + indent_spaces, BLOCK_DECL(node), BLOCK_PORTS(node), + BLOCK_PARAM(node), BLOCK_UP(node), BLOCK_DOWN(node)); +} + +static void print_decl_common(tree node) +{ + printf("%s%s[]; context: %p\n", indent_spaces, + IDENTIFIER_POINTER(DECL_NAME(node)), DECL_CONTEXT(node)); +} + +void print_stats(void) +{ + extern unsigned long mem; + extern int num_nodes; + extern int num_nodes_g; + extern int num_nodes_e; + extern int num_nodes_b; + extern int num_nodes_s; + extern int num_nodes_r; + extern int num_nodes_c; + extern int num_nodes_d; + extern int num_nodes_x; + extern int big_label; + extern int max_label; + extern ngroups_t stack_size; + + + extern int serial; + + + + printf_V("%s\nVersion %s\n\n", VERIWELL, VERSION); + printf_V("\n"); + printf_V("Number of objects: %u\n", num_nodes); + printf_V(" Primitive objects: %u\n", num_nodes_g); + printf_V(" Expression objects: %u\n", num_nodes_e); + printf_V(" Block objects: %u\n", num_nodes_b); + printf_V(" Statement objects: %u\n", num_nodes_s); + printf_V(" Reference objects: %u\n", num_nodes_r); + printf_V(" Constant objects: %u\n", num_nodes_c); + printf_V(" Decl objects: %u\n", num_nodes_d); + printf_V(" Misc objects: %u\n", num_nodes_x); + printf_V("Largest Expression: %u\n", big_label); + printf_V("Stack size: %u\n", stack_size); + printf_V("Stack objects: %u\n", max_label); +} + +static void print_args(tree node) +{ + tree t; + + for (t = node; t; t = TREE_CHAIN(t)) { + if (TREE_EXPR(t)) + print_expr(TREE_EXPR(t)); + if (TREE_CHAIN(t)) + printf_V(", "); + } +} + +static void print_ref(tree node) +{ + enum tree_code code = TREE_CODE(node); + tree t; + + switch (code) { + case (IDENTIFIER_NODE): + printf_V("%s", IDENTIFIER_POINTER(node)); + break; + case (TREE_LIST): + printf_V("{"); + for (t = TREE_VALUE(node); t; t = TREE_CHAIN(t)) + print_ref(t); + printf_V("}"); + break; + case ARRAY_REF: + if (HIERARCHICAL_ATTR(node)) + printf_V("%s", IDENT(ARRAY_REF_NAME(node))); + else + printf_V("%s", IDENT(DECL_NAME(ARRAY_REF_DECL(node)))); + printf_V("["); + print_expr(TREE_OPERAND(node, 1)); + printf_V("]"); + break; + case (BIT_REF): + if (HIERARCHICAL_ATTR(node)) + printf_V("%s", IDENT(BIT_REF_NAME(node))); + else + printf_V("%s", IDENT(DECL_NAME(BIT_REF_DECL(node)))); + printf_V("["); + print_expr(BIT_EXPR(node)); + printf_V("]"); + break; + case CONCAT_REP_REF: + printf_V("{"); + print_expr(CONCAT_EXPR(node)); + printf_V(" "); + case CONCAT_REF: + printf_V("{"); + CONCAT_LIST(node) = nreverse(CONCAT_LIST(node)); + for (t = CONCAT_LIST(node); t; t = TREE_CHAIN(t)) { + print_expr(TREE_PURPOSE(t)); + if (TREE_CHAIN(t)) + printf_V(", "); + } + CONCAT_LIST(node) = nreverse(CONCAT_LIST(node)); + printf_V("}"); + if (code == CONCAT_REP_REF) + printf_V("}"); + break; + case (PART_REF): + if (HIERARCHICAL_ATTR(node)) + printf_V("%s", IDENT(PART_NAME(node))); + else + printf_V("%s", IDENT(DECL_NAME(PART_DECL(node)))); + printf_V("["); + print_expr(PART_MSB_(node)); + printf_V(": "); + print_expr(PART_LSB_(node)); + printf_V("]"); + break; + case SHADOW_REF: + print_expr(TREE_CHAIN(node)); + break; + case SHADOW_LVAL_REF: + printf_V("%s", IDENT(REF_NAME(node))); + break; + case SYSFUNCTION_REF: + case FUNCTION_REF: + printf_V("%s", FUNC_REF_NAME(node)); + printf_V(" ("); + print_args(FUNC_REF_ARGS(node)); + printf_V(")"); + break; + + default: + printf_V("Unimplemeted reference in trace: %s", + tree_code_name[TREE_CODE(node)]); + break; + } +} + +void print_delay(tree node) +{ + int i; + + if (!node) + return; + + printf_V("#"); + if (TREE_LABEL(node) != 1 || + *tree_code_type[TREE_CODE(TREE_OPERAND(node, 0))] != 'd' && + *tree_code_type[TREE_CODE(TREE_OPERAND(node, 0))] != 'c') + printf_V("("); + + for (i = 0;;) { + print_expr(TREE_OPERAND(node, i)); + if (++i < TREE_LABEL(node)) + printf_V(", "); + else + break; + } + + if (TREE_LABEL(node) != 1 || + *tree_code_type[TREE_CODE(TREE_OPERAND(node, 0))] != 'd' && + *tree_code_type[TREE_CODE(TREE_OPERAND(node, 0))] != 'c') + printf_V(")"); + printf_V(" "); +} + +static void print_delay_stmt(tree node) +{ + printf_V("#"); + if (*tree_code_type[TREE_CODE(STMT_DELAY_EXPR(node))] == 'e') + printf_V("("); + print_expr(STMT_DELAY_EXPR(node)); + if (*tree_code_type[TREE_CODE(STMT_DELAY_EXPR(node))] == 'e') + printf_V(")"); +} + +static void print_event_stmt(tree node) +{ + tree t; + + printf_V("@"); + + /* @ identifier */ +// if (TREE_CODE (TREE_EXPR (STMT_EVENT_EXPR_LIST (node))) == ANYEDGE_EXPR) + if (!TREE_CHAIN(STMT_EVENT_EXPR_LIST(node)) && + TREE_CODE(TREE_EXPR(STMT_EVENT_EXPR_LIST(node))) == ANYEDGE_EXPR) { + tree op = TREE_OPERAND(TREE_EXPR(STMT_EVENT_EXPR_LIST(node)), 0); + if (*tree_code_type[TREE_CODE(op)] + == 'd' && !TREE_CHAIN(STMT_EVENT_EXPR_LIST(node))) + print_expr(TREE_EXPR(STMT_EVENT_EXPR_LIST(node))); + } + /* @(expression) */ + else { + printf_V("("); + for (t = STMT_EVENT_EXPR_LIST(node); t; t = TREE_CHAIN(t)) { + print_expr(TREE_EXPR(t)); + if (TREE_CHAIN(t)) + printf_V(" OR "); + } + printf_V(")"); + } +} + +void print_assignment(tree node) +{ + print_expr(STMT_ASSIGN_LVAL(node)); + printf_V(" = "); + +// if (TREE_CODE (node) != ASSIGN_STMT) +// print_delay (STMT_ASSIGN_CONTROL (node)); + print_expr(STMT_ASSIGN_RVAL(node)); +} + +void print_expr(tree node) +{ + enum tree_code code = TREE_CODE(node); + tree right_op; + char *type = tree_code_type[TREE_CODE(node)]; + + switch (*type) { + case ('d'): + printf_V("%s", IDENTIFIER_POINTER(DECL_NAME(node))); + break; + + case ('c'): + if (code == INTEGER_CST) { +// signed_32_t i; +// HIGH_INT (i) = INT_CST_HIGH (node); +// LOW_INT (i) = INT_CST_LOW (node); + printf_V("%ld", INT_CST_DATA(node)); + } else if (code == REAL_CST) { +// signed_32_t i; +// HIGH_INT (i) = INT_CST_HIGH (node); +// LOW_INT (i) = INT_CST_LOW (node); + printf_V("%lf", REAL_CST_DATA(node)); + } else if (BIT_CST_RADIX(node) == STRING_) { + fprintf_V((handle_t) 1, "\""); + print_string((handle_t) 1, BIT_CST_GROUP(node), + BIT_CST_NBITS(node), 0); + fprintf_V((handle_t) 1, "\""); +// print_datum (BIT_CST_GROUP (node), R_nbits, BIT_CST_NBITS (node), BIT_CST_RADIX (node)); + } else + print_datum(BIT_CST_GROUP(node), BIT_CST_NBITS(node), + BIT_CST_NBITS(node), BIT_CST_RADIX(node), 0, 0); + break; + + case ('e'): + switch (*++type) { + case 'x': + case '1': + print_expr(TREE_OPERAND(node, 0)); + right_op = TREE_OPERAND(node, 1); + printf_V(" %s ", tree_code_name[code]); + break; + case 'u': + case 'r': + right_op = TREE_OPERAND(node, 0); + if (code != ANYEDGE_EXPR) + printf_V("%s", tree_code_name[code]); + break; + case 's': + print_expr(SHIFT_OPERAND(node)); + right_op = NULL_TREE; + printf_V(" %s ", tree_code_name[code]); + print_expr(SHIFT_COUNT(node)); + break; + case '3': + printf_V("("); + print_expr(COND_EXPR(node)); + printf_V(" ? "); + print_expr(COND_TRUE(node)); + printf_V(" : "); + print_expr(COND_FALSE(node)); + printf_V(")"); + break; + case 'c': + right_op = NULL_TREE; + if (code == NOP_EXPR) { + print_expr(TREE_OPERAND(node, 0)); + break; + } + printf_V(" %s ", tree_code_name[code]); + printf_V("("); + print_expr(TREE_OPERAND(node, 0)); + printf_V(")"); + break; + default: + printf_V("Expression type not implemented in trace\n"); + } + if ((*type != '3') && right_op) { + if (*tree_code_type[TREE_CODE(right_op)] == 'e' + && tree_code_length[TREE_CODE(right_op)] == 2) { + printf_V("("); + print_expr(right_op); + printf_V(")"); + } else + print_expr(right_op); + } + break; + + case ('r'): + print_ref(node); + break; + + case 'x': + if (code == IDENTIFIER_NODE) + printf_V("%s", IDENTIFIER_POINTER(node)); + else + printf_V("Unimplemeted reference in Trace: %s", + tree_code_name[TREE_CODE(node)]); + break; + + + default: + printf_V("Unimplemeted reference in Trace: %s", + tree_code_name[TREE_CODE(node)]); + break; + } +} + +int print_node(tree node) +{ + enum tree_code code = TREE_CODE(node); + + switch (code) { + case ALWAYS_BLOCK: + printf_V("ALWAYS"); + break; + + case INITIAL_BLOCK: + printf_V("INITIAL"); + break; + + case BEGIN_STMT: + printf_V("BEGIN"); + break; + + case END_STMT: + printf_V("END"); + break; + + case BEGIN_NAMED_STMT: + printf_V("BEGIN : %s", IDENT(BLOCK_NAME(STMT_BLOCK(node)))); + break; + + case END_NAMED_STMT: + printf_V("END : %s", IDENT(BLOCK_NAME(STMT_BLOCK(node)))); + break; + + case FORK_STMT: + printf_V("FORK"); + break; + + case JOIN_STMT: + printf_V("JOIN"); + break; + + case FOREVER_STMT: + printf_V("FOREVER"); + break; + + case WHILE_STMT: + printf_V("WHILE ("); + print_expr(STMT_WHILE_COND(node)); + printf_V(")"); + break; + + case (IF_STMT): + printf_V("IF ("); + print_expr(STMT_COND(node)); + printf_V(")"); + break; + + case REPEAT_STMT: + case REPEAT_INIT_STMT: + printf_V("REPEAT ("); + print_expr(STMT_REPEAT_EXPR(node)); + printf_V(")"); + break; + + case CASE_STMT: + printf_V("CASE ("); + goto case_common; + case CASEX_STMT: + printf_V("CASEX ("); + goto case_common; + case CASEZ_STMT: + printf_V("CASEZ ("); + case_common: + print_expr(STMT_CASE_EXPR(node)); + printf_V(")"); + break; + + case ASSIGN_PROC_STMT: + printf_V("ASSIGN "); + goto assign_common; + + case FORCE_STMT: + printf_V("FORCE "); + goto assign_common; + + case ASSIGN_STMT: + assign_common: + print_assignment(node); + printf_V(";"); + break; + + case ASSIGN_DELAY_STMT: + case ASSIGN_EVENT_STMT: + print_expr(STMT_ASSIGN_LVAL(node)); + printf_V(" = "); + if (code == ASSIGN_DELAY_STMT) + print_delay_stmt(STMT_ASSIGN_DELAY(node)); + else if (code == ASSIGN_EVENT_STMT) + print_event_stmt(STMT_ASSIGN_EVENT(node)); + printf_V(" "); + print_expr(STMT_ASSIGN_RVAL(node)); + printf_V(";"); + break; + + case ASSIGN_NONBLK_DELAY_STMT: + case ASSIGN_NONBLK_EVENT_STMT: + print_expr(STMT_ASSIGN_LVAL(node)); + printf_V(" <= "); + if (code == ASSIGN_NONBLK_DELAY_STMT) + print_delay_stmt(STMT_ASSIGN_DELAY(node)); + else if (code == ASSIGN_NONBLK_EVENT_STMT) + print_event_stmt(STMT_ASSIGN_EVENT(node)); + printf_V(" "); + print_expr(STMT_ASSIGN_RVAL(node)); + printf_V(";"); + break; + + case (FOR_STMT): + printf_V("For ("); + if (!STMT_SURROGATE_ATTR(node)) + print_assignment(STMT_FOR_ASSIGN(node)); + printf_V("; "); + print_expr(STMT_FOR_COND(node)); + printf_V(";"); + if (STMT_SURROGATE_ATTR(node)) { + printf_V(" "); + print_assignment(STMT_FOR_ASSIGN(node)); + } + break; + + case DELAY_STMT: + print_delay_stmt(node); + break; + + case WAIT_STMT: + printf_V("WAIT "); + print_expr(STMT_WAIT_EXPR(node)); + break; + + case EVENT_STMT: + print_event_stmt(node); + break; + + case ARROW_STMT: + printf_V("-> "); + print_expr(STMT_BODY(node)); + break; + + case TASK_STMT: + case SYSTASK_STMT: + printf_V("%s", STMT_TASK_NAME(node)); + if (STMT_TASK_ARGS(node)) { + printf_V(" ("); + print_args(STMT_TASK_ARGS(node)); + printf_V(")"); + } + break; + +/* + case TASK_BLOCK: + case FUNCTION_BLOCK: + printf_V ("%s; >>> RETURNING\n", IDENT (BLOCK_NAME (node))); + break; +*/ + + case FUNCTION_REF: + printf_V("%s", FUNC_REF_NAME(node)); + printf_V(" ("); + print_args(FUNC_REF_ARGS(node)); + printf_V(")"); + break; + + case DISABLE_STMT: + printf_V("DISABLE %s", + IDENTIFIER_POINTER(STMT_DISABLE_NAME(node))); + break; + + case DEASSIGN_STMT: + printf_V("DEASSIGN %s", IDENT(DECL_NAME(STMT_BODY(node)))); + break; + + case RELEASE_STMT: + printf_V("RELEASE %s;", IDENT(DECL_NAME(STMT_BODY(node)))); + break; + + case NULL_STMT: + printf_V(";"); + break; + + default: + printf_V("Statement not known to print_node: %s\n", + tree_code_name[code]); + break; + } + return (0); +} + +static unsigned int bcd_add(char a[], char b[], unsigned int ndigits) +{ + unsigned i; + char aa, carry = 0; + + HEAPTEST("bcd_add 1"); + for (i = 0; i < ndigits; i++) { + aa = a[i] + b[i] + carry; + if (aa > 9) { + carry = 1; + aa -= 10; + } else + carry = 0; + + a[i] = aa; + } + HEAPTEST("bcd_add 2"); + if (carry) { + a[i] = 1; + HEAPTEST("bcd_add 3"); + return ndigits + 1; + } else + return ndigits; +} + +static unsigned int bcd_inc(char a[], unsigned int ndigits) +{ + unsigned i; + char aa, carry = 1; + + for (i = 0; i < ndigits; i++) { + aa = a[i] + carry; + if (aa > 9) { + carry = 1; + aa -= 10; + } else + carry = 0; + + a[i] = aa; + } + if (carry) { + a[i] = 1; + HEAPTEST("bcd_inc 3"); + return ndigits + 1; + } else + return ndigits; +} + +#define ACCINC 5 + +static void +print_bcd_(Group * val, nbits_t nbits, int integer_attr, int pad) +{ + Group *g; + ngroups_t ngroups = bits_to_groups(nbits), i; + int j; +// int xflag = 0, zflag = 0; + + char *acc_tmp; + char *doubler_tmp; + char *pb; /* print buffer pointer */ + unsigned est_digits, res_digits; + Bit aval, bval, negative, mask, x = 0, z = 0; + int lastbit, xx = 0, XX = 1, zz = 0, ZZ = 1; + +/* guestimate the number of digits needed to support nbits and make sure + there is enough buffer space to handle the conversion */ + + est_digits = (nbits / 3) + 1; /* Make sure there is at least one */ + if (est_digits > dd) { + if (!doubler) + doubler_tmp = (char *) xmalloc(100); + else + doubler_tmp = (char *) xrealloc(doubler, 1000); + if (!doubler_tmp) { + printf_V("*No memory for decimal conversion*"); + return; + } else { + doubler = doubler_tmp; + dd = est_digits; + } + } + +/* initialize */ + + for (i = 0; i < aa; i++) + acc[i] = 0; + for (i = 0; i < dd; i++) + doubler[i] = 0; + + HEAPTEST("print_bcd 1"); + doubler[0] = 1; + res_digits = 1; + if (integer_attr + && ((AVAL(val + ngroups) >> ((nbits - 1) % BITS_IN_GROUP)) & 1) == + 1) + negative = (Bit) - 1; + else + negative = (Bit) 0; + + for (i = 0, g = val; i <= ngroups; i++, g++) { /* # groups */ + if (i == ngroups) { + lastbit = (nbits - 1) % BITS_IN_GROUP + 1; + mask = mask_right[lastbit]; + } else { + lastbit = sizeof(Bit) * 8; + mask = (Bit) - 1; + } + aval = (AVAL(g) ^ negative) & mask; + bval = BVAL(g) & mask; + x |= aval & bval; + z |= ~aval & bval; +// x |= AVAL (g) & BVAL (g); +// z |= ~AVAL (g) & BVAL (g); + XX &= !~z; + ZZ &= !~z; + xx |= x; + zz |= z; + for (j = 0; j < lastbit; j++) { /* bits/group */ + if ((aval >> j) & 1) { + if (aa <= res_digits) { + HEAPTEST("print_bcd 1.5"); + if (acc) + acc_tmp = + (char *) xrealloc(acc, + (size_t) (res_digits + + ACCINC)); + else + acc_tmp = + (char *) + xmalloc((size_t) (res_digits + ACCINC)); + HEAPTEST("print_bcd 1.6"); + if (!acc_tmp) { + printf_V + ("*Not enough memory for decimal conversion*"); + return; + } else { + acc = acc_tmp; + { + int i; + HEAPTEST("print_bcd 1.7"); + for (i = aa; i < res_digits + ACCINC; i++) + acc_tmp[i] = 0; + HEAPTEST("print_bcd 2"); + } + aa = res_digits + ACCINC; + } + } + bcd_add(acc, doubler, res_digits); + HEAPTEST("print_bcd 3"); + } + res_digits = bcd_add(doubler, doubler, res_digits); + HEAPTEST("print_bcd 4"); + } + } + /* print number first skipping leading zeros */ + if (!aa) { + acc_tmp = (char *) xmalloc(1); + if (!acc_tmp) { + printf_V("*Not enough memory for decimal conversion*"); + return; + } else { + acc = acc_tmp; + aa = 1; + acc[0] = 0; + } + } + HEAPTEST("print_bcd 5"); + if (negative) { +// fprintf_V (handle, "-"); +// bcd_inc (acc, res_digits); + bcd_inc(acc, aa); + } + HEAPTEST("print_bcd 6"); + pb = set_print_buf(res_digits + 1); + + if (xx || zz) { + for (i = 0; i < aa; i++) + acc[i] = 0; + negative = 0; + } + + + if (pad) { /* print spaces */ + /* Fill with spaces up to the size of the accumulator (aa), then start + looking at the digits. If the number is negative, then the "-" needs + to be printed before the first non-zero digit, so there needs to be a + look ahead. + */ + +// int still_zero = 1; + + i = res_digits - 1; + /* aa (size of the accumulator) may be smaller than the reserved size + (the maximum size for the given number of bits). Fill with spaces + until the space before acc starts, in case a negative sign is needed. + */ + + for (; i >= aa; i--) + sprintf(pb++, " "); + + /* Now scan acc until a non-zero is found */ + for (; i > 0; i--) { + if (acc[i] == 0) + sprintf(pb++, " "); + else +// { +// still_zero = 0; + break; +// } + } + + /* Either we are just before the last digit, or we found a non-zero, + or both. + */ + +// if (still_zero) /* Implies 0 */ +// fprintf_V (handle, "%d", acc[i]); + +// else /* Found a non-zero */ + { + if (integer_attr) { + if (negative) + sprintf(pb++, "-"); /* last leading zero */ + else + sprintf(pb++, " "); + } + /* Print the res of the digits */ + if (XX) + sprintf(pb++, "X"); + else if (ZZ) + sprintf(pb++, "Z"); + else if (xx) + sprintf(pb++, "x"); + else if (zz) + sprintf(pb++, "z"); + else + for (; i >= 0; i--) + sprintf(pb++, "%d", acc[i]); + } + } else { + i = aa; + do { + if (acc[--i] != 0) + break; + } + while (i > 0); +// if (i) + if (negative) + sprintf(pb++, "-"); + for (; i >= 0; i--) + sprintf(pb++, "%d", acc[i]); + } + +//else +// printf ("0"); +} + +void print_scope(handle_t handle, tree scope) +{ + if (BLOCK_UP(scope)) { + print_scope(handle, BLOCK_UP(scope)); + fprintf_V(handle, "."); + } + fprintf_V(handle, "%s", IDENT(BLOCK_NAME(scope))); +} + +/* These two routines print the raw simulation time. See timescale.c + for routines that print times based on the current timescales. */ + +void print_time(time64 * time_p) +{ + Group v[2]; + AVAL(&v[0]) = time_p->timel; + AVAL(&v[1]) = time_p->timeh; + BVAL(&v[0]) = BVAL(&v[1]) = 0; + print_bcd((handle_t) 1, v, (nbits_t) 64, 0, 0); +} + +char *time_string(time64 * time_p) +{ + Group v[2]; + AVAL(&v[0]) = time_p->timel; + AVAL(&v[1]) = time_p->timeh; + BVAL(&v[0]) = BVAL(&v[1]) = 0; + print_bcd_(v, (nbits_t) 64, 0, 0); + return print_buf; +} + +char *sprint_decimal(Group * val, nbits_t nbits) +{ + print_bcd_(val, nbits, 0, 0); + return (print_buf); +} + +char *sprint_hex(Group * val, nbits_t nbits) +{ + int i; + int j; + Group *g; + int bitCount; + char *result; + int digit; + int abit; + int bbit; + char *ptr; + int xCount; + int zCount; + int count; + char c; + + g = val; + bitCount = 0; + + ptr = set_print_buf((nbits + 3) / 4 + 1); + ptr += (nbits + 3) / 4; + *ptr-- = 0; + + for (i = 0; i <= R_ngroups; i++, g++) { + for (j = 0; j < BITS_IN_GROUP; j++) { + if ((bitCount % 4) == 0) { + digit = 0; + xCount = 0; + zCount = 0; + count = 0; + } + abit = (AVAL(g) >> j) & 0x1; + bbit = (BVAL(g) >> j) & 0x1; + digit |= abit << (bitCount % 4); + if (bbit == 1) { + if (abit == 1) { + xCount++; + } else { + zCount++; + } + } + count++; + bitCount++; + if (bitCount == nbits || bitCount % 4 == 0) { + if (xCount == count) { + // x + c = 'x'; + } else if (zCount == count) { + // z + c = 'z'; + } else if (xCount == 0 && zCount == 0) { + // number + if (digit <= 9) { + c = '0' + digit; + } else { + c = 'A' + digit - 10; + } + } else if (xCount == 0) { + // Z + c = 'Z'; + } else { + // X + c = 'X'; + } + *ptr-- = c; + } + if (bitCount == nbits) { + return (print_buf); + } + } + } + while (ptr >= print_buf) { + *ptr-- = '0'; + } + return (print_buf); +} + + +char *sprint_binary(Group * val, nbits_t nbits) +{ + int i; + int j; + Group *g; + int bitCount; + char *result; + int abit; + int bbit; + char *ptr; + char c; + + g = val; + bitCount = 0; + + ptr = set_print_buf(nbits + 1); + ptr += nbits; + *ptr-- = 0; + + for (i = 0; i <= R_ngroups; i++, g++) { + for (j = 0; j < BITS_IN_GROUP; j++) { + abit = (AVAL(g) >> j) & 0x1; + bbit = (BVAL(g) >> j) & 0x1; + if (bbit == 1) { + if (abit == 1) { + *ptr-- = 'x'; + } else { + *ptr-- = 'z'; + } + } else { + if (abit == 1) { + *ptr-- = '1'; + } else { + *ptr-- = '0'; + } + } + bitCount++; + if (bitCount == nbits) { + return (print_buf); + } + } + } + while (ptr >= print_buf) { + *ptr-- = '0'; + } + return (print_buf); +} + +/************************************************************** + * init_print + * - initialize global and static variables for print.c + * + ************************************************************** + */ + +void init_print() +{ + indent_spaces[0] = 0; + print_indent = 0; + doubler = NULL; + dd = 0; + acc = NULL; + aa = 0; + print_buf_size = 0; + print_buf = NULL; +} diff --git a/src/print.h b/src/print.h new file mode 100644 index 0000000..1fc6079 --- /dev/null +++ b/src/print.h @@ -0,0 +1,80 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* PRINT.H - Print routine prototypes */ + +#ifndef PRINT_H +#define PRINT_H + +// public methods + +enum print_state { START, EXTEND_X, EXTEND_Z, EXTEND_0, EXTEND_DONE }; + +void print_bcd(handle_t handle, Group * val, nbits_t nbits, + int integer_attr, int pad); +void print_dec(handle_t handle, Group * g, nbits_t nbits, + int int_attr, int pad); +void print_binary_file(FILE * file, Group * g, nbits_t nbits); +void print_datum_file(handle_t handle, Group * g, nbits_t print_nbits, + nbits_t nbits, enum radii radix, int is_integer, + int fill_space, char *spec); +void print_datum(Group * g, nbits_t print_nbits, nbits_t nbits, + enum radii radix, int is_integer, int fill_space); +void print_common(tree node); +void print_stats(void); +void print_delay(tree node); +void print_expr(tree node); +int print_node(tree node); +void print_scope(handle_t handle, tree scope); +void print_time(time64 * time_p); +char *time_string(time64 * time_p); +void init_print(void); +char *set_print_buf(unsigned_32_t size); +void print_assignment(tree node); +char *sprint_decimal(Group * g, nbits_t nbits); +char *sprint_hex(Group * g, nbits_t nbits); +char *sprint_binary(Group * g, nbits_t nbits); + + +// private methods + +#ifdef PRINT_C + +static void print_char(handle_t handle, int c, int fill); +static void print_string(handle_t handle, Group * g_base, + nbits_t nbits, int fill); +static enum print_state print_group(Bit aval, Bit bval, int size, + enum print_state state, int last, + enum radii radix, int *octal_shift, + Bit * residue_aval, + Bit * residue_bval); +static void print_block_common(tree node); +static void print_decl_common(tree node); +static void print_args(tree node); +static void print_ref(tree node); +static void print_delay_stmt(tree node); +static void print_event_stmt(tree node); +static unsigned bcd_add(char a[], char b[], unsigned ndigits); +static unsigned bcd_inc(char a[], unsigned ndigits); +static void print_bcd_(Group * val, nbits_t nbits, + int integer_attr, int pad); + +#endif // PRINT_C + +#endif // PRINT_H diff --git a/src/runtime.h b/src/runtime.h new file mode 100644 index 0000000..8707ac7 --- /dev/null +++ b/src/runtime.h @@ -0,0 +1,55 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* RUNTIME.H - Global variables and routine prototypes used during execution */ + +/* cleared if either trace or single-step enabled */ +extern int normal_flag; + +extern int trace_flag; + +extern int single_step_flag; +extern int single_trace_flag; +extern int break_flag; + +extern int in_disable; /* for the DISABLE statment processing */ + +extern int is_interactive; +extern int cmd_level; +extern int new_cmd_level; + +extern int in_initial; /* set while initializing nets */ + +extern Group **R; /* Virtual register (accumulator) stack pointer */ +extern Group **R_base; /* Virtual register (accumulator) base pointer */ +extern nbits_t R_nbits; /* current expression length in bits */ +extern ngroups_t R_ngroups; /* Current expression size in groups */ +extern Bit R_mask; + +//extern void trace_stmt (); +// extern void print_datum (); +//extern void print_delay (); + +//extern void eval_1 (union tree_node *); +//extern void exec_sysfunc (union tree_node *, nbits_t); + +//extern tree systime_return; /* function $time return variable */ +//extern tree sysopen_return; /* function $open return variable */ +//extern tree sysrand_return; /* function $random return variable */ +//extern tree sysplus_return; /* function $test$plusargs return variable */ diff --git a/src/schedule.cc b/src/schedule.cc new file mode 100644 index 0000000..1069548 --- /dev/null +++ b/src/schedule.cc @@ -0,0 +1,1214 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* SCHED.C - Scheduler and queues for simulation engine */ + +#define SCHED_C + +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "schedule.h" +#include "flags.h" +#include "runtime.h" +#include "dumpvar.h" +#include "strobe.h" +#include "acc_user.h" +#include "gates.h" +#include "eval.h" +#include "glue.h" +#include "exec.h" +#include "nsched.h" +#include "veriwell.h" +#include "pli.h" +#include "systask.h" + +SCB *eventlist = NULL; /* List of SCBs waiting for an event */ +SCB *timelist = NULL; /* List of SCBs waiting for time to pass */ +SCB *timelist_currentTail = NULL; /* last entry for current time */ +SCB *netlist = NULL; /* List of SCBs containing pending net changes */ +SCB *netlist_last = NULL; /* Points to last SCB on net list */ +SCB *readylist = NULL; /* List of SCBs previously waiting for an event */ +SCB *readylist_last = NULL; /* Points to last SCB on ready list */ +SCB *freelist = NULL; /* List of available SCBs (eg. fork/join) */ + +tree deferred_markers = NULL_TREE; + +time64 CurrentTime; + +static int BLK_SIZE = 1024; + +SCB *BuildSCB(union tree_node *start, enum which_list list) +{ + SCB *scb, *tmp, *s; + int i; + extern tree current_scope; + + if (!freelist) { + SCB *scbArray = (SCB *) xmalloc(sizeof(SCB) * BLK_SIZE); + for (i = 0; i < BLK_SIZE; i++) { + ADD_LIST_SCB(FREE_LIST, &freelist, scbArray + i); + } + } + scb = freelist; + REMOVE_LIST_SCB(scb); + + scb->pc = start; +// scb->old_pc = NULL_TREE; + ASSIGNTIME64(&(scb->time), &CurrentTime); +// scb->type = NULL; + scb->prev = NULL; + scb->next = NULL; +// scb->drive[0] = scb->drive[1] = 0; +// scb->rising = scb->falling = scb->turnoff = 0; +// scb->tf_stack = NULL; + scb->fork_count = 0; + scb->fork = NULL; +// scb->thread = NULL; + scb->here.scb = NULL; + scb->mode = RUN; + scb->context = NULL; + enter_context(scb, current_scope, NULL_TREE); +// scb->list = TIMELIST; + + /* Each block points to all SCBs in scope (for DISABLE statement) */ +// if (current_scope) +// BLOCK_SCB_LIST (current_scope) = tree_cons ((tree)scb, NULL_TREE, BLOCK_SCB_LIST (current_scope)); +// scb->current_scope = current_scope; + + switch (list) { + case TIME_LIST: + if (!timelist) { + ADD_LIST_SCB(TIME_LIST, &timelist, scb); + } else { + /* put new entries at end of list */ + for (s = timelist; s->next; s = s->next); + ADD_LIST_SCB(TIME_LIST, &s->next, scb); + } + break; + case READY_LIST: + if (!readylist) { + ADD_LIST_SCB(READY_LIST, &readylist, scb); + } else { + /* put new entries at end of list */ + for (s = readylist; s->next; s = s->next); + ADD_LIST_SCB(READY_LIST, &s->next, scb); + } + break; + default: + ADD_LIST_SCB(NOLIST, &eventlist, scb); + } + +// PrintSCB(scb); + return scb; +} + +void PrintSCB(SCB * scb) +{ + printf("building SCB at %p\n", scb); +// printf(" scb->type: %d\n",scb->type); +// printf(" scb->new_pc: %p\n",scb->new_pc); +// printf(" scb->old_pc: %p\n",scb->old_pc); +// printf(" scb->time: %d\n",scb->time); + printf(" scb->prev: %p\n", scb->prev); +// printf(" scb->drive[0]: %d\n",scb->drive[0]); +// printf(" scb->drive[1]: %d\n",scb->drive[1]); +// printf(" scb->rising: %d\n",scb->rising); +// printf(" scb->falling: %d\n",scb->falling); +// printf(" scb->turnoff: %d\n",scb->turnoff); + printf(" scb->list: %p\n", scb->list); +} + +void BuildMarker(tree decl, struct Marker_info *marker_info) +{ + Marker *marker; + + /* First, ensure that only one marker per variable is used e.g. a = b + b; */ + for (marker = marker_info->first; marker; marker = marker->link) + if (marker->decl == decl) + return; + + marker = (Marker *) xmalloc(sizeof(Marker)); + marker->next = NULL; + marker->prev = NULL; + marker->scb = marker_info->current_scb; + marker->expr.expr = NULL; + marker->decl = decl; + marker->flags = marker_info->flags; + marker->delay = marker_info->delay; + marker->link = NULL; + + if (marker_info->last) + marker_info->last->link = marker; /* Link this to end of the list */ + else + marker_info->first = marker; + + marker_info->last = marker; + + if ((marker->flags & M_FIXED)) + WaitOnEvent(marker, marker_info->current_scb); + return; +} + +tree WaitOnTime(delay_t waittime, tree pc) +{ + SCB *scb = readylist; + + /* + Find the right spot in the timelist either at the end (index == NULL) + or when the next SCBs time field is bigger (ie we would come off + the wait list sooner). + */ + + scb->pc = pc; /* save next instruction to be executed */ +// scb->new_pc = next_pc; /* save next instruction to be executed */ +// scb->old_pc = this_pc; /* save this instruction for tracing */ + + ADDTIME6432(&(scb->time), &CurrentTime, waittime); +// scb->list = TIME_LIST; + scb->mode = WAIT; + + scb = dispatcher(TIME_LIST); +// *prev_pc = scb->old_pc; /* return the pc that got us here */ +// return scb->new_pc; /* as wll as the new pc */ + return scb->pc; /* as wll as the new pc */ +} + +tree WaitOnTime64(struct Time64 * waittime, tree pc) +{ + SCB *scb = readylist; + + /* + Find the right spot in the timelist either at the end (index == NULL) + or when the next SCBs time field is bigger (ie we would come off + the wait list sooner). + */ + + scb->pc = pc; /* save next instruction to be executed */ +// scb->new_pc = next_pc; /* save next instruction to be executed */ +// scb->old_pc = this_pc; /* save this instruction for tracing */ + + ADDTIME6464(&(scb->time), &CurrentTime, waittime); +// scb->list = TIME_LIST; + scb->mode = WAIT; + + scb = dispatcher(TIME_LIST); +// *prev_pc = scb->old_pc; /* return the pc that got us here */ +// return scb->new_pc; /* as wll as the new pc */ + return scb->pc; /* as wll as the new pc */ +} + +void Schedule64(struct Time64 *time, SCB * scb, int prepend) +{ + SCB *link, *tmp; + + /* + Find the right spot in the timelist either at the end (index == NULL) + or when the next SCBs time field is bigger (ie we would come off + the wait list sooner). + */ + + + scb->time = *time; + scb->mode = WAIT; + + REMOVE_LIST_SCB(scb); +//check_readylist(); +/* Caution: If the next 5 lines are changes, also change Dispatcher! */ + if (!timelist || (CMPTIME64(&(scb->time), &(timelist->time)) < 0)) { + ADD_LIST_SCB(TIME_LIST, &timelist, scb); /* empty waitlist; add us */ + } else if (!prepend) { /* else, find position in list (beg. of time) */ + for (link = timelist; + link->next + && (CMPTIME64(&(scb->time), &(link->next->time)) >= 0); + link = link->next); + ADD_LIST_SCB(TIME_LIST, &link->next, scb); + } else { + for (link = timelist; + link->next + && (CMPTIME64(&(scb->time), &(link->next->time)) > 0); + link = link->next); + ADD_LIST_SCB(TIME_LIST, &link->next, scb); + } + +} + +void ScheduleDelta64(struct Time64 *time, SCB * scb, int prepend) +{ + SCB *link, *tmp; + + /* + Find the right spot in the timelist either at the end (index == NULL) + or when the next SCBs time field is bigger (ie we would come off + the wait list sooner). + */ + + + ADDTIME6464(&(scb->time), &CurrentTime, time); + scb->mode = WAIT; + + REMOVE_LIST_SCB(scb); +//check_readylist(); +/* Caution: If the next 5 lines are changes, also change Dispatcher! */ + if (!timelist || (CMPTIME64(&(scb->time), &(timelist->time)) < 0)) { + ADD_LIST_SCB(TIME_LIST, &timelist, scb); /* empty waitlist; add us */ + } else if (!prepend + && CMPTIME64(&timelist_currentTail->time, &scb->time) == 0) + { + ADD_LIST_SCB(TIME_LIST, &timelist_currentTail->next, scb); + } else if (!prepend) { /* else, find position in list (beg. of time) */ + for (link = timelist; + link->next + && (CMPTIME64(&(scb->time), &(link->next->time)) >= 0); + link = link->next); + ADD_LIST_SCB(TIME_LIST, &link->next, scb); + } else { + for (link = timelist; + link->next + && (CMPTIME64(&(scb->time), &(link->next->time)) > 0); + link = link->next); + ADD_LIST_SCB(TIME_LIST, &link->next, scb); + } + +// *prev_pc = scb->old_pc; /* return the pc that got us here */ +// return scb->new_pc; /* as wll as the new pc */ +} + +void Schedule(delay_t waittime, SCB * scb, int prepend) +{ + SCB *link, *tmp; + + /* + Find the right spot in the timelist either at the end (index == NULL) + or when the next SCBs time field is bigger (ie we would come off + the wait list sooner). + */ + + + ADDTIME6432(&(scb->time), &CurrentTime, waittime); + scb->mode = WAIT; + + REMOVE_LIST_SCB(scb); +//check_readylist(); +/* Caution: If the next 5 lines are changes, also change Dispatcher! */ + if (!timelist || (CMPTIME64(&(scb->time), &(timelist->time)) < 0)) { + ADD_LIST_SCB(TIME_LIST, &timelist, scb); /* empty waitlist; add us */ + } else if (!prepend + && CMPTIME64(&timelist_currentTail->time, &scb->time) == 0) + { + ADD_LIST_SCB(TIME_LIST, &timelist_currentTail->next, scb); + } else if (!prepend) { /* else, find position in list (beg. of time) */ + for (link = timelist; + link->next + && (CMPTIME64(&(scb->time), &(link->next->time)) >= 0); + link = link->next); + ADD_LIST_SCB(TIME_LIST, &link->next, scb); + } else { + for (link = timelist; + link->next + && (CMPTIME64(&(scb->time), &(link->next->time)) > 0); + link = link->next); + ADD_LIST_SCB(TIME_LIST, &link->next, scb); + } + +// *prev_pc = scb->old_pc; /* return the pc that got us here */ +// return scb->new_pc; /* as wll as the new pc */ +} + +/* Schedule nets */ + +void ScheduleNet(Marker * marker, enum logical_value state) +{ + SCB *scb = marker->scb, *tmp; + +/* If a port has just been changed, propigate immediately (also during + continuous assignment initialization) */ + + if (marker->flags & M_PORT /*|| NET_ASSIGN_ATTR (marker->decl) */ ) // || in_initial) +// if (marker->flags & M_PORT || in_initial) + net_exec(scb->pc); + else { + delay_t delay = eval_delay(NET_DELAY(scb->pc), state); + +/* If there is no delay, schedule on net list, else put on time list. + Note that in the case of inouts, we could be working with our own + net in which case, we're finished. */ + if (!delay) { + if (scb->list != NET_LIST && scb != readylist) { + REMOVE_LIST_SCB(scb); +// if (!readylist) +// fatal ("Caught it in schedulenet1"); +//check_readylist(); + if (netlist) { + ADD_LIST_SCB(NET_LIST, &netlist_last->next, scb); + } else { + ADD_LIST_SCB(NET_LIST, &netlist, scb); + } + netlist_last = scb; + scb->time = CurrentTime; + } + } else { + Schedule(delay, scb, 0); +// if (!readylist) +// fatal ("Caught it in schedulenet2"); + } + } +} + +void thread_marker(Marker * marker) +{ + Marker *mark, *tmp; + tree decl = marker->decl; + + if (!DECL_EVENT_CHAIN(decl)) { + ADD_LIST(DECL_EVENT_CHAIN(decl), marker); + } +/* Add marker to the tail of the decl's event chain */ + else { + for (mark = DECL_EVENT_CHAIN(decl); mark->next; mark = mark->next); + ; + ADD_LIST(mark->next, marker); + } +} + +/* Start with a marker and thread on all markers on the link chain */ + +void thread_all_markers(Marker * marker) +{ + Marker *mark; + + for (mark = marker; mark->link != marker; mark = mark->link) + thread_marker(mark); + thread_marker(mark); +} + +/* Thread marker onto an event chain, headed by a decl node */ + +void WaitOnEvent(Marker * marker, SCB * scb) +{ +// EventQueue *queue; +// tree decl; +// Marker *link, *tmp; + +// decl = marker->decl; + +/* we could already be on the event chain */ +// for (link = queue->first; link; link=link->next) +// if (link == marker) return; + if (marker->prev) { + ASSERT(scb != 0); + + /* In a task, it is possible that more than one caller can be waiting on + the same event. If so, add the SCB to the list. */ + if (marker->scb != scb) { + scb->here.scb = marker->scb; + marker->scb = scb; + } + return; + } + + marker->scb = scb; +// marker->next = marker->prev = NULL; + thread_marker(marker); +/* + if (debug) { + printf ("Waiting On Event Queue at: %p\n", + DECL_EVENT_CHAIN (decl)); + for (marker = DECL_EVENT_CHAIN (decl); marker; marker = marker->next) +printf ("Marker[%p]: scb: %p prev: %p next: %p link: %p expr: %p scb: %p\n", + marker,marker->scb,marker->prev,marker->next,marker->link,marker->expr, +marker->scb); + } +*/ +} + +tree WaitOnEventAll(Marker * marker, tree pc) +{ + Marker *mark; + SCB *scb; + + readylist->pc = pc; +// readylist->old_pc = this_pc; + readylist->mode = WAIT; + + // pathological case: wait (0); -- wait forever, no markers, skip past Waits + if (marker) + { + for (mark = marker; mark->link != marker; mark = mark->link) + WaitOnEvent(mark, readylist); + WaitOnEvent(mark, readylist); + } + scb = dispatcher(EVENT_LIST); +// *prev_pc = scb->old_pc; /* return the pc that got us here */ + return scb->pc; +} + +void WaitOnEventOther(SCB * scb, Marker * marker, tree pc) +{ + Marker *mark; + SCB *tmp; + +// scb->new_pc = next_pc; +// scb->old_pc = this_pc; + scb->pc = pc; + scb->mode = WAIT; + + for (mark = marker; mark->link != marker; mark = mark->link) + WaitOnEvent(mark, scb); + WaitOnEvent(mark, scb); + + REMOVE_LIST_SCB(scb); + ADD_LIST_SCB(EVENT_LIST, &eventlist, scb); + return; +} + +/* Notify everything on the deferred list (used for lval concats) */ + +void NotifyDeferred(tree deferred_markers) +{ + tree tmp; + + while (deferred_markers) { + NotifyEvent((Marker *) TREE_PURPOSE(deferred_markers), + (enum logical_value) (unsigned long) + TREE_VALUE(deferred_markers), (int) 0); + + tmp = deferred_markers; + deferred_markers = TREE_CHAIN(deferred_markers); + free_link_list(tmp); + } +} + +/* Place marker's SCB onto ready list; unthread event chain if not fixed */ + +void NotifyEvent(Marker * marker, enum logical_value state, int deferred) +{ + Marker *ring, *NextEntry; + SCB *scb, *tmp, *next_scb; + + if (!marker) + return; + + if (deferred) { + deferred_markers = link_tree_cons((tree) marker, (tree) state, + deferred_markers); + return; + } + + do { + NextEntry = marker->next; + scb = marker->scb; + + /* If this is a primitive (built-in or UDP), call the processing routine */ + + if (marker->flags & M_PRIM) { + ASSERT(GATE_ROUTINE((tree) marker->scb)); + (*GATE_ROUTINE((tree) marker->scb)) (marker); + } + + /* If this is a continuous assignment marker, do it now */ + + + else if (marker->delay) { /* if cont assignment, put at beginning */ + if (in_initial) + do_net_assignment(scb->pc); + else + Schedule(eval_delay(marker->delay, state), scb, + marker->flags & M_CONT); + } else if ((marker->flags & M_CONT)) { + do_net_assignment(marker->expr.tree); + } + + /* If there is a ref to a net (from a cont assignment), schedule it + or do it now if we are in initialization or if we are a port. */ + + else if (marker->flags & M_NET) { + ScheduleNet(marker, state); + } + + else if (marker->flags & M_VCD) + dumpvars_dump(marker->decl, marker->expr.vcd_id); + + else if (marker->flags & M_IDLE) + tickle_monitor(&idle_strobe_queue, marker->expr.tree); /* in systask.c; points to mon info */ + + else if (marker->flags & M_STROBE) /* Special for $monitor */ + tickle_monitor_old(&final_strobe_queue, marker->expr.mon); /* in systask.c; points to mon info */ + + else if (marker->flags & M_VCL) + vcl_dispatch((struct pli_vcl *) marker->expr.vcl); + + else if (marker->flags & M_ASYNCH) { + pli_asynccall((PliInfo_t *) marker->expr.tree); + } + +/* If marker says test the expression (for edge triggered), then do + so. But, we may already be on the ready list, so we don't need to + do the threading of the SCB. */ + + else if (scb->list != READY_LIST && + (!(marker->flags & M_TEST) || test(marker->expr.expr))) { + for (; scb; scb = next_scb) { + SCB *last; + next_scb = scb->here.scb; + scb->here.scb = NULL; + + REMOVE_LIST_SCB(scb); +//check_readylist(); + +#if VDEBUG != 0 + if (debug) + printf + ("Adding Marker to Ready List[%p]: %p next: %p prev: %p\n", + marker, scb, scb->next, scb->prev); + + if (vdebug) + printf("*** Notifying line: %lu\n", + STMT_SOURCE_LINE(scb->pc)); +#endif + + /* Thread to the end of the ready list (don't let prev point + to readylist->last) */ + last = LAST_SCB(READY_LIST); + if (last) { + ADD_LIST_SCB(READY_LIST, &last->next, scb); + } else { + ADD_LIST_SCB(READY_LIST, &readylist, scb); + } + } + +//check_readylist (); +/* Now, unthread our marker and all the other markers associated with + this event, if the fixed bit is not set, of course. Note that the + markers are threaded by the links in a circular list. We know to + stop when we hit a marker that has its prev pointer set to NULL. */ + + if (!(marker->flags & M_FIXED)) + for (ring = marker; ring->prev; ring = ring->link) { + REMOVE_LIST(ring); + ring->prev = NULL; /* This tells us that the marker is not threaded */ + } + } + + /* else if... */ + marker = NextEntry; + } + while (marker); +} + +/* Disconnect the markers associate with this event or wait stmt; usually + called from disable. Watch for cases where marker was already notified. +*/ + +void event_undo(Marker * first) +{ + Marker *mark; + + if (!first) + return; + + for (mark = first; mark->link != NULL && mark->link != first; + mark = mark->link) { + if (mark->prev) { /* if null, marker was already notified */ + REMOVE_LIST(mark); + mark->prev = NULL; + } + + } /* handle the last one */ + if (mark->prev) { + REMOVE_LIST(mark); + mark->prev = NULL; + } +} + +/* Get the next process on the ready list, return a pointer to an + executable tree; place the incoming SCB onto the wait list (possibly + ordered by time). */ + +SCB *dispatcher(enum which_list remove_list) +{ + SCB *link, *scb = readylist, *tmp; + time64 new_time; +// int in_net; + +// in_net = 1; +// if (!readylist) +// goto go; + +// if (TREE_CODE (readylist -> pc) == NET_VECTOR_DECL || +// TREE_CODE (readylist -> pc) == NET_VECTOR_DECL) +// in_net = 1; +// else +// in_net = 0; + +/* If RemoveFlag is set, take scb off the list. This happens at the end + of INITIAL blocks. */ + + switch (remove_list) { + + case NOLIST: + REMOVE_LIST_SCB(scb); + ADD_LIST_SCB(NOLIST, &eventlist, scb); + break; + + case EVENT_LIST: + REMOVE_LIST_SCB(scb); + ADD_LIST_SCB(EVENT_LIST, &eventlist, scb); + break; + + case TIME_LIST: + REMOVE_LIST_SCB(scb); + if (!timelist || (CMPTIME64(&(scb->time), &(timelist->time)) < 0)) { + ADD_LIST_SCB(TIME_LIST, &timelist, scb); /* empty waitlist; add us */ + } else { /* else, find position in list */ +/* WARNING: this must be the same code as in Schedule!! */ + for (link = timelist; + link->next + && (CMPTIME64(&(scb->time), &(link->next->time)) >= 0); + link = link->next); + ADD_LIST_SCB(TIME_LIST, &link->next, scb); + } +//if (CMPTIME64 (&(scb->time), &CurrentTime) < 0) +// printf ("Time less than current time\n"); + break; + + case FREE_LIST: + REMOVE_LIST_SCB(scb); + ADD_LIST_SCB(FREE_LIST, &freelist, scb); + if (scb->context) + unwind_context(scb->context); + break; + } + +//printf ("In dispatch: just before checking readylist (%p)\n", readylist); + + +/* + Ready List Check: if we have something on the Ready list - go with it + */ + go: +// if (readylist) { +// if (debug) { +// printf ("Current Ready List: [%p]\n", +// readylist); +// for (link = readylist,cnt = 0; link; link = link->next) +// printf ("ENTRY[%d]: %p prev: %p next: %p\n", +// cnt++,link,link->prev,link->next); +// } + +// if (debug) PrintSCB(readylist); + +// } + + if (readylist) + return readylist; + +//DEBUGPRINT ("Dispatcher: nothing in readylist\n"); +/* Nothing in the ready list, see if any gates need to + be processed. */ + + { + tree gate; + + while (TRUE) { +// gate = PeekGate(); +// if( gate == NULL_TREE ) { +// break; +// } +// ASSERT( CMPTIME64 (&(GATE_TIME (gate)), &CurrentTime) >= 0); +// if( CMPTIME64 (&(GATE_TIME (gate)), &CurrentTime) == 0 ) { +// +// DEBUGPRINT ("Inside gatelist\n"); +// RemoveGate( gate ); +// handle_gate (gate); +// } else { +// break; +// } + gate = RemoveNextReadyGate(); + if (gate == NULL_TREE) { + break; + } + DEBUGPRINT("Inside gatelist\n"); + handle_gate(gate); + } + } + + if (readylist) + return readylist; + if (debug) + printf("This is a dummy stmt\n"); + +//DEBUGPRINT ("Dispatcher: (past gates) nothing in readylist\n"); + +/* See if there is a net change pending */ + + if (netlist) // && (!readylist || +// TREE_CODE (readylist -> pc) != NET_VECTOR_DECL && +// TREE_CODE (readylist -> pc) != NET_SCALAR_DECL)) + { + do { + scb = netlist; +//DEBUGPRINT ("inside netlist, scb is %p, readylist %p, last %p\n", scb, readylist, readylist_last); + if (debug) + printf + ("inside netlist, scb %p, prev %p, next %p, readylist %p, last %p, netlist %p, last %p, (at %p)\n", + scb, scb->prev, scb->next, readylist, readylist_last, + netlist, netlist_last, &netlist); + REMOVE_LIST_SCB(scb); + if (debug) + printf + ("inside netlist2, scb is %p, readylist %p, last %p, netlist %p, last %p\n", + scb, readylist, readylist_last, netlist, + netlist_last); + if (!netlist) + netlist_last = NULL; + if (!readylist) { + ADD_LIST_SCB(READY_LIST, &readylist, scb); + } else { + SCB *last = LAST_SCB(READY_LIST); + ADD_LIST_SCB(READY_LIST, &last->next, scb); + } + } + while (netlist); + } +//DEBUGPRINT ("Dispatcher: (past nets) nothing in readylist\n"); + if (debug) + printf("This is a dummy stmt\n"); + if (readylist) + return readylist; + + if (debug) + printf("This is a dummy stmt\n"); + +/* Nothing on the ready list; check the time list for SCBs that + are waiting for time to pass. */ + + if (timelist) { + +///* + if (debug) { + printf("Current Time List:\n"); +// for (link = timelist, cnt = 0; link ; link = link->next) +// printf ("ENTRY[%d]: %p prev: %p next: %p pc: %p time: %d\n", +// cnt++,link,link->prev,link->next,link->new_pc,link->vtime); + } +//*/ + + +/* ------------ added this here mdh */ + while (timelist + && (CMPTIME64(&(timelist->time), &CurrentTime) == 0)) { + scb = timelist; + REMOVE_LIST_SCB(scb); + if (!readylist) { + ADD_LIST_SCB(READY_LIST, &readylist, scb); + } else { + SCB *last = LAST_SCB(READY_LIST); + ADD_LIST_SCB(READY_LIST, &last->next, scb); + } + } + + if (readylist) + return (readylist); + +//DEBUGPRINT ("Dispatcher: (past time2) nothing in readylist\n"); + + if (netlist) { + goto go; + } + + if (IsGateReady()) { + goto go; + } +/* Before moving stuff on the readylist, check for things that want to happen + at the end of the current time unit. */ + + check_strobe(&idle_strobe_queue); +//DEBUGPRINT ("Dispatcher: (past time1) checking strobe\n"); + if (debug) + printf("This is a dummy stmt\n"); + if (readylist) /* check_strobe may have indirectly caused new events */ + return readylist; + if (debug) + printf("This is a dummy stmt\n"); + +//DEBUGPRINT ("Dispatcher: (past time1) nothing in readylist\n"); + +/* ------------ added this here mdh */ + while (timelist + && (CMPTIME64(&(timelist->time), &CurrentTime) == 0)) { + scb = timelist; + REMOVE_LIST_SCB(scb); + if (!readylist) { + ADD_LIST_SCB(READY_LIST, &readylist, scb); + } else { + SCB *last = LAST_SCB(READY_LIST); + ADD_LIST_SCB(READY_LIST, &last->next, scb); + } + } + + if (readylist) + return (readylist); + +//DEBUGPRINT ("Dispatcher: (past time2) nothing in readylist\n"); + + if (netlist) { + goto go; + } + + if (IsGateReady()) { + goto go; + } + if (!empty_strobe(&idle_strobe_queue)) { + goto go; + } + + check_strobe(&final_strobe_queue); + ASSERT(readylist == NULL); + + if (GateConditionalAdvanceTime(&(timelist->time))) { + goto go; + } + + ASSIGNTIME64(&new_time, &(timelist->time)); + do { + scb = timelist; + REMOVE_LIST_SCB(scb); + if (!readylist) { + ADD_LIST_SCB(READY_LIST, &readylist, scb); + } else { + SCB *last = LAST_SCB(READY_LIST); + ADD_LIST_SCB(READY_LIST, &last->next, scb); + } + } + while (timelist && (CMPTIME64(&(timelist->time), &new_time) == 0)); + +/* advance time, if necessary */ +// if (time != readylist -> time) { +// time = readylist -> time; +// if (trace_flag || single_trace_flag) +// printf ("SIMULATION TIME IS %lu\n", time); +// } + } +/* Nothing on Ready list or Time list, exit. */ + else { + extern SCB *finish_scb; + check_strobe(&idle_strobe_queue); + /* + * there is a chance that pli code has added some + * events. If so continue on. + */ + if (timelist != NULL || PeekGate() != NULL) { + goto go; + } + if (!empty_strobe(&idle_strobe_queue)) { + goto go; + } + check_strobe(&final_strobe_queue); + return finish_scb; +// return null; +// printf ("All done\n"); /* Later, print useful information */ +// exit(0); + } +//printf ("in dispatch: about to return\n"); + return readylist; +} + +tree dispatch_pc(enum which_list list) +{ + return dispatcher(list)->pc; +} + +/* Note that neither dump_current_process, nor dispatch, must change the + current value of the evaluation stack. */ + +tree dump_current_process(void) +{ + SCB *scb = dispatcher(FREE_LIST); +// *prev_pc = scb->old_pc; + return scb->pc; +} + +tree suspend_current_process(void) +{ + SCB *scb = dispatcher(NOLIST); +// *prev_pc = scb->old_pc; + return scb->pc; +} + +void interject_readylist(SCB * scb, tree pc) +{ + SCB *tmp; /* for ADD_LIST */ + + /* */ + if (readylist) { +// readylist -> old_pc = current_pc; +// readylist -> new_pc = next_pc; + readylist->pc = pc; + } + + REMOVE_LIST_SCB(scb); + ADD_LIST_SCB(READY_LIST, &readylist, scb); +} + +void FreeSCB(SCB * scb) +{ + SCB *tmp; + + REMOVE_LIST_SCB(scb); + ADD_LIST_SCB(READY_LIST, &freelist, scb); + if (scb->context) + unwind_context(scb->context); +} + +#if 0 +void cleanup_SCB(SCB * scb) +{ +/* Clean up scb -- clear out markers and set time back to current time */ + if (scb->list == FREE_LIST) + return; + ASSIGNTIME64(&(scb->time), &CurrentTime); + { + Marker *first_marker; + switch (TREE_CODE(scb->pc)) { + case EVENT_STMT: + first_marker = STMT_EVENT_MARKER(scb->pc); + break; + case WAIT_STMT: + first_marker = STMT_WAIT_MARKER(scb->pc); + break; + case DELAY_STMT: + case DISABLE_STMT: + first_marker = NULL; + break; +// case FORK_STMT: +// case FORK_NAMED_STMT: + case JOIN_STMT: + /* Funny case: DISABLE is last line of a FORK branch; pc + will be pointing to JOIN_STMT. This needs to be differentiated + from the case where the FORK stmt is being cleaned since new_pc + will also be pointing to JOIN */ +// if (scb->fork) +// return; /* inside FORK, let the FORK clean itself */ + first_marker = NULL; +// cleanup_fork (STMT_JOIN_FORK (scb->pc)); + break; + default: + runtime_error(scb->pc); + fatal + ("Attempting to disable stmt that is not WAIT, EVENT, DELAY, or DISABLE"); + } + + event_undo(first_marker); /* disconnect the markers */ + } +} +#endif +#if 0 +check_readylist() +{ + SCB *s; + if (!readylist) + return; + for (s = readylist; s; s = s->next) + if (!s->next) + if (s == readylist_last) + return; + else + fatal("REadylist_last dislodged"); + + fatal("Lost readylist_last!"); +} +#endif + +SCB *last_readylist() +{ + SCB *s; + + for (s = readylist; s; s = s->next) + if (!s->next) + return s; + return NULL; +} + +void ADD_LIST_SCB(enum which_list list, SCB ** POINT, SCB * NEW) +{ + SCB *tmp = *POINT; +#ifdef CHECKSCB + SCB *ptr; + if (timelist) { + for (ptr = timelist; ptr; ptr = ptr->next) { + if (timelist_currentTail == ptr) { + goto OK2; + } + } + ASSERT(FALSE); + } + OK2: +#endif + switch (list) { + case READY_LIST: + if (*POINT == 0) { + readylist_last = NEW; + } + break; + case TIME_LIST: + if (timelist_currentTail == NULL) { + timelist_currentTail = NEW; + } else if (CMPTIME64(&timelist_currentTail->time, &NEW->time) == 0 + && tmp && CMPTIME64(&tmp->time, &NEW->time) != 0) { + timelist_currentTail = NEW; + } else if (CMPTIME64(&timelist_currentTail->time, &NEW->time) >= 0) { + timelist_currentTail = NEW; + } + break; + default:; + } + NEW->list = list; + *POINT = NEW; + (NEW)->prev = POINT; + (NEW)->next = tmp; + if (tmp) + tmp->prev = &(NEW)->next; +#ifdef CHECKSCB + switch (list) { + case READY_LIST: + for (ptr = readylist; ptr; ptr = ptr->next) { + if (NEW == ptr) { + goto OK; + } + } + ASSERT(FALSE); + break; + case TIME_LIST: + for (ptr = timelist; ptr; ptr = ptr->next) { + if (NEW == ptr) { + goto OK; + } + } + ASSERT(FALSE); + break; + default:; + } + OK: + if (timelist) { + for (ptr = timelist; ptr; ptr = ptr->next) { + if (timelist_currentTail == ptr) { + goto OK1; + } + } + ASSERT(FALSE); + } + OK1: +#endif + return; +} + +void REMOVE_LIST_SCB(SCB * PTR) +{ + SCB *ptr; +#ifdef CHECKSCB + switch (PTR->list) { + case READY_LIST: + for (ptr = readylist; ptr; ptr = ptr->next) { + if (PTR == ptr) { + goto OK; + } + } + ASSERT(FALSE); + break; + case TIME_LIST: + for (ptr = timelist; ptr; ptr = ptr->next) { + if (PTR == ptr) { + goto OK; + } + } + ASSERT(FALSE); + break; + default:; + } + OK: +#endif + if ((*((PTR)->prev) = (PTR)->next) != 0) + (PTR)->next->prev = (PTR)->prev; + switch (PTR->list) { + case READY_LIST: + if (readylist_last == PTR) { + readylist_last = last_readylist(); + } + break; + case TIME_LIST: + if (PTR == timelist_currentTail) { + timelist_currentTail = timelist; + for (; timelist_currentTail && timelist_currentTail->next && + (CMPTIME64(&(timelist_currentTail->time), + &(timelist_currentTail->next->time)) == 0); + timelist_currentTail = timelist_currentTail->next); + } + break; + default:; + } +#ifdef CHECKSCB + if (timelist) { + for (ptr = timelist; ptr; ptr = ptr->next) { + if (timelist_currentTail == ptr) { + goto OK1; + } + } + ASSERT(FALSE); + } + OK1: +#endif +} + +SCB *LAST_SCB(enum which_list list) +{ + switch (list) { + case READY_LIST: +// return last_readylist(); + return readylist_last; + default: + ASSERT(FALSE); + return NULL; + } +} + + +/***************************************************************** + * + * init_sched + * - initialize global and static variables for sched.c + * + ***************************************************************** + */ + +void init_sched() +{ + eventlist = NULL; /* List of SCBs waiting for an event */ + timelist = NULL; /* List of SCBs waiting for time to pass */ + timelist_currentTail = NULL; /* points to last entry of current time */ + netlist = NULL; /* List of SCBs containing pending net changes */ + netlist_last = NULL; /* Points to last SCB on net list */ + readylist = NULL; /* List of SCBs previously waiting for an event */ + readylist_last = NULL; /* Points to last SCB on ready list */ + freelist = NULL; /* List of available SCBs (eg. fork/join) */ + deferred_markers = NULL_TREE; + CurrentTime.timeh = 0; + CurrentTime.timel = 0; +} diff --git a/src/schedule.h b/src/schedule.h new file mode 100644 index 0000000..9120030 --- /dev/null +++ b/src/schedule.h @@ -0,0 +1,161 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* SCHED.H - Declarations for scheduler and queues */ + +#ifndef SCHED_H +#define SCHED_H + +// public methods + +struct monitor_info; + +#define ADD_LIST(POINT, NEW) \ + {tmp = POINT; \ + POINT = NEW; \ + (NEW)->prev = &(POINT); \ + (NEW)->next = tmp; \ + if (tmp) tmp->prev = &(NEW)->next;} + +#define REMOVE_LIST(PTR) \ + {if ((*((PTR)->prev) = (PTR)->next) != 0) \ + (PTR)->next->prev = (PTR)->prev;} + +//enum { SmallCharge, MediumCharge, LargeCharge }; +enum which_list { NOLIST = + 1, READY_LIST, EVENT_LIST, TIME_LIST, NET_LIST, FREE_LIST }; +enum marker_flags { + M_PRIM_FAST = 0x800, /* Fast Primitive (no need to re-eval) */ + M_PRIM = 0x400, /* Primitive marker */ + M_IDLE = 0x200, /* Schedule for idle at end of simulation time */ + M_VCL = 0x100, /* VCL (PLI) marker */ + M_VCD = 0x80, /* VCD (dumpvars) marker */ + M_ASYNCH = 0x40, /* PLI asynch marker */ + M_PORT = 0x20, /* if port, evaluate immediately */ + M_STROBE = 0x10, /* Schedule for end of current simulation time */ + M_NET = 0x8, /* Evaluate NETs immediately */ + M_CONT = 0x4, /* Evaluate continuous assignment immediately */ + M_FIXED = 0x2, /* if set, don't unthread markers after event */ + M_TEST = 0x1, /* if set, test event expression at notification */ + M_PLAIN = 0 +}; + +extern time64 CurrentTime; +extern struct SCB *readylist; +extern struct SCB *readylist_last; +extern struct SCB *eventlist; +extern struct SCB *timelist; +extern struct SCB *timelist_currentTail; +extern struct SCB *netlist; +extern struct SCB *freelist; + +enum eMode { RUN, WAIT }; + +typedef struct SCB { + struct SCB *next; /* Next SCB on this linked list */ + struct SCB **prev; /* Previous SCB on linked list */ + time64 time; /* For use in Delayed events */ + union tree_node *pc; /* A pointer to executable code */ + enum eMode mode; /* Used to determine if entering or exiting events */ +// union tree_node *new_pc;/* A pointer to executable code */ +// union tree_node *old_pc;/* Pointer to statement that caused event */ + enum which_list list; + struct context_member *context; +// struct tf_stack *tf_stack; +// union tree_node *current_scope; + struct SCB *fork; /* If inside fork/join, points to "main" SCB */ + unsigned fork_count; /* Count of number of SCBs still in fork/join */ +// struct SCB *thread; /* Currently used to link all SCBs inside a fork */ + int bit_offset; /* used in delayed assignments */ + int group_offset; /* used in delayed assignements */ + union { + struct SCB *scb; /* In case there are many SCBs waiting on the same event */ + struct context_member *fork_list; /* If at fork, point to members */ + union tree_node *decl; /* for nonblock assigns */ + } here; /* This is valid while waiting at a particular place */ +} SCB; + +void ADD_LIST_SCB(enum which_list list, SCB ** POINT, SCB * NEW); +void REMOVE_LIST_SCB(SCB * PTR); +SCB *LAST_SCB(enum which_list); + + +typedef struct Marker { + struct Marker **prev; /* pointer for event chain... */ + struct Marker *next; /* ...(all from the same decl) */ + struct SCB *scb; + struct Marker *link; /* Links markers for an event */ + union tree_node *decl; /* pointer to the associated decl tree entry */ + union { + union tree_node **expr; /* The event expression to evaluate */ + union tree_node *arg; /* For gates, point to the argument */ + struct monitor_info *mon; /* For $monitor and $wwaves, etc. */ + union tree_node *tree; /* Catch-all for typeless usage */ + int vcd_id; /* For VCD output */ + void *vcl; /* For PLI VCL */ + } expr; + enum marker_flags flags; + union tree_node *delay; /* if not null, put scb on timelist */ +} Marker; + +/* global info used during pass3 to build and thread markers as needed */ + +struct Marker_info { + SCB *current_scb; + int in_event; /* If set, references will build markers */ + Marker *first; /* Keep track of links during threading at pass3 */ + Marker *last; + enum marker_flags flags; + union tree_node *delay; +}; + +SCB *BuildSCB(union tree_node *, enum which_list); +tree dispatch_pc(enum which_list); +tree dump_current_process(void); +tree suspend_current_process(void); +void BuildMarker(tree decl, struct Marker_info *marker_info); +tree WaitOnTime(delay_t waittime, tree pc); +tree WaitOnTime64(struct Time64 *waittime, tree pc); +void WaitOnEvent(Marker * marker, SCB * scb); +union tree_node *WaitOnEventAll(Marker *, union tree_node *); +void WaitOnEventOther(SCB *, Marker *, union tree_node *); +void NotifyEvent(Marker *, enum logical_value, int); +void NotifyDeferred(union tree_node *); +void FreeSCB(SCB *); +void event_undo(Marker * first); +void cleanup_SCB(SCB *); +void interject_readylist(SCB *, union tree_node *); +void thread_marker(Marker *); +void thread_all_markers(Marker *); +void Schedule(delay_t waittime, SCB * scb, int prepend); +void ScheduleDelta64(struct Time64 *time, SCB * scb, int prepend); +void Schedule64(struct Time64 *time, SCB * scb, int prepend); +void ScheduleNet(Marker * marker, enum logical_value state); +void PrintSCB(SCB * scb); +tree WaitOnEventAll(Marker * marker, tree pc); +SCB *dispatcher(enum which_list remove_list); +void interject_readylist(SCB * scb, tree pc); +void init_sched(void); + +// private methods + +#ifdef SCHED_C +#endif // SCHED_C + +#endif // SCHED_H diff --git a/src/scope.cc b/src/scope.cc new file mode 100644 index 0000000..0940ef4 --- /dev/null +++ b/src/scope.cc @@ -0,0 +1,382 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* SCOPE.C - Routines for resolving hierarchical names, setting scopes, etc. */ + +#define SCOPE_C + +#include +#include "vtypes.h" +#include "tree.h" +#include "scope.h" + +/* Pointer to the current scope's block */ +tree current_scope; + + +/* This is used at compile time mostly to save outer-level declarations + for vars that are redefined at as inner level but then have to be restored + upon leaving the scope. */ + +struct scoping_level { + struct scoping_level *previous; /* points to outer-level scope */ + tree block; /* points to current block node */ + tree shadow; /* points to tree list of outer-level decls to be */ + /* restored upon exit from this scope */ +}; +/* level0 and scope0 will hold names to top-level modules */ +static struct scoping_level level0; +tree scope0 = NULL; /* Initialized in pass2.s */ + +static struct scoping_level *current_level = &level0; +static struct scoping_level *free_level = (struct scoping_level *) NULL; + +/* Remember the previous declaration of an ident by making a TREE_LIST + with iden as TREE_PURPOSE and its old declaration as TREE_VALUE. */ + +void set_decl(tree ident, tree decl) +{ + current_level->shadow = + link_tree_cons(ident, IDENT_CURRENT_DECL(ident), + current_level->shadow); + IDENT_CURRENT_DECL(ident) = decl; +} + +void push_scope() +{ + struct scoping_level *tmp; + +/* create a new scoping level, or resuse one */ + + if (!free_level) + tmp = + (struct scoping_level *) + linkalloc(sizeof(struct scoping_level)); + else { + tmp = free_level; + free_level = tmp->previous; + } + + tmp->block = current_scope; + tmp->previous = current_level; + tmp->shadow = NULL_TREE; + current_level = tmp; +} + +tree pop_scope() +{ + tree decl_list, next; + struct scoping_level *level; + + /* restore declarations of previous scope (set in set_decl). TREE_PURPOSE + has the IDENTIFIER_NODE; TREE_VALUE has the DECL_NODE. */ + + for (decl_list = current_level->shadow; decl_list; decl_list = next) { + next = TREE_CHAIN(decl_list); + IDENT_CURRENT_DECL(TREE_PURPOSE(decl_list)) = + TREE_VALUE(decl_list); + free_link_list(decl_list); + } + +/* pop the scoping level and save the old frame for later use */ + + level = current_level; + current_level = current_level->previous; + level->previous = free_level; + free_level = level; + if (!current_level) + return NULL_TREE; + return current_level->block; +} + +void set_scope(tree new_scope) +{ + tree t; + + current_scope = new_scope; + push_scope(); + /* first, do ports */ + for (t = BLOCK_PORTS(new_scope); t; t = TREE_CHAIN(t)) + set_decl(DECL_NAME(t), t); + /* then do DECLs */ + for (t = BLOCK_DECL(new_scope); t; t = TREE_CHAIN(t)) { + t = t; + set_decl(DECL_NAME(t), t); + } + /* if scope is a module then do specparams */ + + if (TREE_CODE(new_scope) == MODULE_BLOCK) { + for (t = MODULE_SPECDEFS(new_scope); t; t = TREE_CHAIN(t)) { + if (TREE_CODE(t) == SPECPARAM_DECL) { + set_decl(DECL_NAME(t), t); + } + } + } +// for (t = BLOCK_DOWN (new_scope); t; t = TREE_CHAIN (t)) +// set_decl (BLOCK_NAME (t), t); +} + +void reset_scope() +{ + tree decl_list, next; + + for (decl_list = current_level->shadow; decl_list; decl_list = next) { + next = TREE_CHAIN(decl_list); + IDENT_CURRENT_DECL(TREE_PURPOSE(decl_list)) = + TREE_VALUE(decl_list); + free_link_list(decl_list); + } +} + +/* At runtime, puts the list of top-level modules in the symbol table + and sets the scope to the first listed top-level module. */ + +void initialize_scope(tree top_level) +{ + tree t; + + current_level = &level0; + current_scope = scope0; + +/* Read top-level block names, only if called after pass2 */ + if (top_level) { + for (t = BLOCK_DECL(scope0); t; t = TREE_CHAIN(t)) + set_decl(DECL_NAME(t), t); + set_scope(top_level); + } +} + + +tree search_scope_across(tree starting_scope, char *name, int set) +{ + tree scope; + + for (scope = starting_scope; scope; scope = TREE_CHAIN(scope)) + if (!strcmp(name, IDENT(BLOCK_NAME(scope)))) { + if (set) + set_scope(scope); + return scope; + } + return NULL_TREE; +} + +tree search_scope_up(tree starting_scope, char *name, int set) +{ + tree scope, new_scope; + + for (scope = starting_scope; scope; scope = BLOCK_UP(scope)) { + if (set) + current_scope = pop_scope(); +// if (!strcmp (name, IDENT (BLOCK_NAME (scope)))) + if ((new_scope = + search_scope_across(scope, name, set)) != NULL_TREE) + return new_scope; + } + return search_scope_across(top_level, name, set); +} + +/* +static +void +lookupward_scope (tree scope) +{ + tree t; + int found = 0; + + for (t = current_scope; t; t = BLOCK_UP (t)) + { + current_scope = pop_scope (); + if (scope == t) + { + found = 1; + set_scope (t); + break; + } + } + if (!found) + { + for (t = top_level; t; t = TREE_CHAIN (t)) + if (scope == t) { + set_scope (t); + found = 1; + } + } + if (!found) + error ("Scope not found", NULL_CHAR, NULL_CHAR); +} +*/ +tree resolve_hierarchical_path(char *path) +{ + extern char *token_buffer; /* Will already be as large as needed */ + char *path_name = token_buffer, *decl_name; + + strcpy(path_name, path); + + /* seperate the last component of the path */ + decl_name = strrchr(path_name, '.'); + *decl_name = '\0'; + decl_name++; + + return search_up_decl(decl_name, search_scope(path_name, 0)); +} + +tree resolve_hierarchical_name(tree ident) +{ + return (resolve_hierarchical_path(IDENT(ident))); +} + +/* Traverse the tree following the hierichical name. If "set" is non-zero, + then also set the scope as the tree is traversed. Not that "set" + should be set _only_ if the hierachical name is known to be good, + usually (always?) by first calling this without setting "set". + If "set" is set, but the name is bad, the the scope will be screwed up + with no chance of recovery. */ + +tree search_scope(char *path_name, int set) +{ + extern char *token_buffer; /* Will already be as large as needed */ + tree scope, set_scope; + extern tree scope0; /* defined in decl.c */ + char *p, *path = token_buffer; + + strcpy(path, path_name); + p = strtok(path, "."); + + set_scope = current_scope; + + scope = search_scope_across(BLOCK_DOWN(set_scope), p, set); + if (!scope) { + scope = search_scope_up(set_scope, p, set); + if (!scope) { + if (set) { + for (set_scope = current_scope; set_scope != scope0; + set_scope = BLOCK_UP(set_scope)) + current_scope = pop_scope(); + } + scope = search_scope_across(top_level, p, set); + if (!scope) { + for (set_scope = current_scope; + TREE_CODE(set_scope) != MODULE_BLOCK; + set_scope = BLOCK_UP(set_scope)) + if (set) + current_scope = pop_scope(); + scope = search_scope_across(BLOCK_DOWN(set_scope), p, set); + if (!scope) { + error + ("Component '%s' is not in up, down, or top-level path", + p, NULL_CHAR); + return error_mark_node; + } + } + } + } + + for (p = strtok(NULL, "."); p; p = strtok(NULL, ".")) { + set_scope = scope; + scope = search_scope_across(BLOCK_DOWN(set_scope), p, set); + if (!scope) { + scope = search_scope_up(set_scope, p, set); + if (!scope) { + error + ("Component '%s' is not in up, down, or top-level path", + p, NULL_CHAR); + return error_mark_node; + } else if (!set) + warning("Hierarchical component '%s' found on upward path", + IDENT(BLOCK_NAME(scope)), NULL_CHAR); + } + } + return scope; +} + +/* Look for a decl node with the give name in the current scope. If + not there, search up the hierarchy. If found higher up, give + a warning. If not found, return error_mark_node and print error. + Don't look any higher than the first MODULE_BLOCK. */ + +tree search_up_decl(char *name, tree starting_scope) +{ + tree scope, t, t1; + + if (starting_scope == error_mark_node) + return error_mark_node; + + for (scope = starting_scope; scope; +// scope = (TREE_CODE (scope) == MODULE_BLOCK ? NULL_TREE : BLOCK_UP (scope))) + scope = BLOCK_UP(scope)) { + for (t = BLOCK_DECL(scope); t; t = TREE_CHAIN(t)) { +// if (TREE_CODE (t) == ARRAY_DECL) +// t1 = ARRAY_DECL (t); +// else + t1 = t; + if (!strcmp(name, IDENT(DECL_NAME(t1)))) { + if (scope != starting_scope) + warning("Identifier '%s' found on upward path", name, + NULL_CHAR); + return t; + } + } + for (t = BLOCK_PORTS(scope); t; t = TREE_CHAIN(t)) { + if (TREE_CODE(t) == ARRAY_REF) + t1 = ARRAY_REF_DECL(t); + else + t1 = t; + if (!strcmp(name, IDENT(DECL_NAME(t1)))) { + if (scope != starting_scope) + warning("Identifier '%s' found on upward path", name, + NULL_CHAR); + return t; + } + } + } + error("Identifier '%s' not declared", name, NULL_CHAR); + return error_mark_node; +} + +/* Given the current scope and a new scope, trace the path down or up + to the new scope and then call set_scope() and pop_scope() enough times + to set the new scope. This will be called only when the new scope is + in the symbol table, so it can only be one down, across, or top_level. +*/ + +void look_for_and_set_scope(tree scope) +{ + tree s; + +/* Case 1: top level - pop until top of hierarchy, then set */ + if (!BLOCK_UP(scope)) { + for (s = current_scope; s; s = BLOCK_UP(s)) + current_scope = pop_scope(); + set_scope(scope); + } +/* Case 2: one down - simply set the scope */ + else if (BLOCK_UP(scope) == current_scope) + set_scope(scope); + else + error("Scope case not handled yet", NULL_CHAR, NULL_CHAR); +} + +void init_scope() +{ + scope0 = NULL; + current_level = &level0; + free_level = NULL; + current_scope = NULL_TREE; + memset(&level0, 0, sizeof(level0)); +} diff --git a/src/scope.h b/src/scope.h new file mode 100644 index 0000000..3771456 --- /dev/null +++ b/src/scope.h @@ -0,0 +1,52 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* SCOPE.H - Scope and hierarchical name prototypes and globals */ + +#ifndef SCOPE_H +#define SCOPE_H + +// public methods + +void set_decl(tree, tree); +void push_scope(void); +tree pop_scope(void); +void set_scope(tree); +void reset_scope(void); +void initialize_scope(tree); +tree resolve_hierarchical_path(char *); +tree resolve_hierarchical_name(tree); +tree search_scope(char *, int); +tree search_up_decl(char *, tree); +void look_for_and_set_scope(tree); +void init_scope(void); +tree search_scope_across(tree starting_scope, char *name, int set); +tree search_scope_up(tree starting_scope, char *name, int set); + +extern tree current_scope; + +// private methods + +#ifdef SCOPE_C + +static void lookupward_scope(tree scope); + +#endif // SCOPE_C + +#endif // SCOPE_H diff --git a/src/sdf.cc b/src/sdf.cc new file mode 100644 index 0000000..d4e50ed --- /dev/null +++ b/src/sdf.cc @@ -0,0 +1,1114 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/********************************************************************** + * + * sdf.c + * - main pli entry point for sdf annotator + * + * things not implemented: + * 1) mipds + * 2) conditions + * 3) pulses + * 4) module mapping + * 5) Hierarchy divider + ********************************************************************** + */ + +#define SDF_C + +#include +#include +#include +#include +#include "veriuser.h" +#include "acc_user.h" +#include "sdf.h" +#include "vtypes.h" +#include "tree.h" +#include "glue.h" +#include "sdfclex.h" +#include "sdflex.h" +#include "flags.h" +#include "veriwell.h" + +static char inputFilename[MAX_FILENAME_LENGTH]; +static char configFilename[MAX_FILENAME_LENGTH]; +static char logFilename[MAX_FILENAME_LENGTH]; +static eDelayType_t mtmSpecification; +static double scaleFactor[3]; +static eScaleType_t scaleType; +static eDelayType_t interconnectMipd; +static eDelayType_t turnOffDelay; +static handle rootModule; // current top of hierarchy +static eVerilogConstruct_t map[ePATHPULSE + 1]; +static char cellType[256]; +static int absoluteDelay; +static int timeScale; +static handle currentInstance; +static int allInstances; + + +FILE *sdfLogFile; + + + +/********************************************************************** + + setTimeScale + set time scale + +***********************************************************************/ + +void setTimeScale(int scale) +{ + timeScale = scale; +} + +/********************************************************************** + + setAbsoluteDelay + set delay mode absolute or incremental + +***********************************************************************/ + +void setAbsoluteDelay(int flag) +{ + absoluteDelay = flag; +} + +/********************************************************************** + + resetInstance + + - clear the current instance + + **********************************************************************/ + +void resetInstance() +{ + currentInstance = null; + allInstances = FALSE; +} + + +/********************************************************************** + + findInstance + - find the next level of hierarchy + + **********************************************************************/ + +int findInstance(char *name) +{ + + if (!strcmp(name, "*")) { + allInstances = TRUE; + return (TRUE); + } + + if (currentInstance == null) { + currentInstance = acc_handle_object(name); + } else { + currentInstance = acc_handle_by_name(name, currentInstance); + } + + return (currentInstance != null); + +} + + +/********************************************************************** + + setCellType + - change the current cell type + + **********************************************************************/ + +void setCellType(char *type) +{ + strcpy(cellType, type); +} + +/********************************************************************** + + printPort + - printout an port spec + +***********************************************************************/ + +void printPort(port_t port) +{ + if (port.scalar) { + fprintf(sdfLogFile, port.name); + } else if (port.msb == port.lsb) { + fprintf(sdfLogFile, "%s[%d]", port.name, port.msb); + } else { + fprintf(sdfLogFile, "%s[%d:%d]", port.name, port.msb, port.lsb); + } + + +} + +/********************************************************************** + + printValue + - printout an sdf value + +***********************************************************************/ + +void printValue(elist_t value) +{ + int i; + int j; + + for (i = 0; i < value.argCount; i++) { + fprintf(sdfLogFile, "("); + for (j = 0; j < 3; j++) { + if (value.values[i].triple[j].valid) { + if (j != 0) { + fprintf(sdfLogFile, ","); + } + fprintf(sdfLogFile, "%g", value.values[i].triple[j].value); + } + } + fprintf(sdfLogFile, ")"); + } +} + +/********************************************************************** + + scaleDelay + - converts a delay triple into a value + returns TRUE if delay is valid + +***********************************************************************/ + +int scaleDelay(handle object, triple_t * value, double *d) +{ + triple_t newValue; + int result; + int scale; + + // pick basis for delays + switch (scaleType) { + case eFROM_MINIMUM: + newValue.triple[0] = value->triple[0]; + newValue.triple[1] = value->triple[0]; + newValue.triple[2] = value->triple[0]; + break; + case eFROM_MAXIMUM: + newValue.triple[0] = value->triple[2]; + newValue.triple[1] = value->triple[2]; + newValue.triple[2] = value->triple[2]; + break; + case eFROM_TYPICAL: + newValue.triple[0] = value->triple[1]; + newValue.triple[1] = value->triple[1]; + newValue.triple[2] = value->triple[1]; + break; + case eFROM_MTM: + newValue = *value; + break; + default: + ASSERT(FALSE); + } + + // apply scaleFactors + newValue.triple[0].value *= scaleFactor[0]; + newValue.triple[1].value *= scaleFactor[1]; + newValue.triple[2].value *= scaleFactor[2]; + + // pick min:typ:max + switch (mtmSpecification) { + case eMINIMUM: + *d = newValue.triple[0].value; + result = newValue.triple[0].valid; + break; + case eTYPICAL: + *d = newValue.triple[1].value; + result = newValue.triple[1].valid; + break; + case eMAXIMUM: + *d = newValue.triple[2].value; + result = newValue.triple[2].valid; + break; + case eTOOL_CONTROL: + // here is currently the only place I don't use pli to access info + switch (delay_type) { + case MIN_DELAY: + *d = newValue.triple[0].value; + result = newValue.triple[0].valid; + break; + case TYP_DELAY: + *d = newValue.triple[1].value; + result = newValue.triple[1].valid; + break; + case MAX_DELAY: + *d = newValue.triple[2].value; + result = newValue.triple[2].valid; + break; + default: + ASSERT(FALSE); + } + break; + default: + ASSERT(FALSE); + } + + scale = + timeScale - tf_igettimeunit((char *) acc_handle_parent(object)); + *d *= pow(10.0, (double) scale); + + return (result); +} + +/********************************************************************** + + setNewDelays + - set new delay values + +***********************************************************************/ + +void setNewDelays(handle object, double *d, elist_t * value) +{ + int i; + double delay; + + for (i = 0; i < value->argCount; i++) { + + // scale delay + if (scaleDelay(object, &value->values[i], &delay)) { + // if absolute replace delay + // otherwise increment delay + if (absoluteDelay) { + d[i] = delay; + } else { + d[i] += delay; + } + } + } + +} + +/********************************************************************** + + getPathHandle + - returns handle for path matching the given ports + +***********************************************************************/ + +handle getPathHandle(handle instance, port_t * outPort, port_t * inPort) +{ + handle object; + char outPortName[256]; + char inPortName[256]; + char *fmt; + + object = NULL; + + + if (!outPort->scalar) { + if (outPort->msb == outPort->lsb) { + fmt = "%s[%d]"; + } else { + fmt = "%s[%d:%d]"; + } + } else { + fmt = "%s"; + } + sprintf(outPortName, fmt, outPort->name, outPort->msb, outPort->lsb); + + if (!inPort->scalar) { + if (inPort->msb == inPort->lsb) { + fmt = "%s[%d]"; + } else { + fmt = "%s[%d:%d]"; + } + } else { + fmt = "%s"; + } + sprintf(inPortName, fmt, inPort->name, inPort->msb, inPort->lsb); + + + object = acc_handle_modpath(instance, inPortName, outPortName); + + return (object); +} + + + +/********************************************************************** + + setConstraint + - set new sdf constraint + +***********************************************************************/ + +void +setConstraint(eSDFConstruct_t type, port_t * p1, port_t * p2, + elist_t value) +{ + handle top; + + if (currentInstance != null) { + setInstanceConstraint(currentInstance, allInstances, type, + p1, p2, value); + } else { + top = null; + while (TRUE) { + top = acc_next_topmod(top); + if (top == null) { + break; + } + setInstanceConstraint(top, allInstances, type, p1, p2, value); + } + } +} + +/********************************************************************** + + setInstanceConstraint + - set new sdf constraint and walk instances + +***********************************************************************/ + +void +setInstanceConstraint(handle instance, int matchAll, + eSDFConstruct_t type, port_t * p1, port_t * p2, + elist_t value) +{ + int match; + handle child; + + + match = !strcmp(cellType, acc_fetch_defname(instance)); + if (matchAll && !match) { + child = null; + while (TRUE) { + child = acc_next_child(instance, child); + if (child == null) { + break; + } + setInstanceConstraint(child, matchAll, type, p1, p2, value); + } + } else if (match) { + + switch (map[type]) { + case eVCELL: + setCellConstraint(instance, p1, p2, value); + break; + case eVSETUP: + case eVHOLD: + case eVSKEW: + case eVRECOVERY: + case eVPERIOD: + case eVWIDTH: + case eVSETUPHOLD: + setTimingConstraint(instance, map[type], p1, p2, value); + break; + case eVIGNORE: + break; + default: + + { + char buffer[255]; + + sprintf(buffer, "%s contraints are not supported", + sVerilogConstruct[map[type]]); + sdf_error(buffer); + } + break; + + } + + } +} + + +/********************************************************************** + + printDelayGroup + - print delay group values to logfile + +***********************************************************************/ +void +printDelayGroup(char *title, int delayCount, double d1, + double d2, double d3, double d4, double d5, double d6) +{ + int count = delayCount; + + fprintf(sdfLogFile, "\t%s\n", title); + fprintf(sdfLogFile, "\t\t01\t%g\n", d1); + count--; + if (count > 0) { + fprintf(sdfLogFile, "\t\t10\t%g\n", d2); + count--; + } + if (count > 0) { + fprintf(sdfLogFile, "\t\t0z\t%g\n", d3); + count--; + } + if (count > 0) { + fprintf(sdfLogFile, "\t\tz1\t%g\n", d4); + count--; + } + if (count > 0) { + fprintf(sdfLogFile, "\t\t1z\t%g\n", d5); + count--; + } + if (count > 0) { + fprintf(sdfLogFile, "\t\tz0\t%g\n", d6); + count--; + } +} + +/********************************************************************** + + setPathDelays + - set delays for path instance + +***********************************************************************/ + +void setPathDelays(handle instance, handle object, elist_t value) +{ + double d[6]; + + fprintf(sdfLogFile, "modifying path %s => ", + acc_fetch_fullname(object)); + printValue(value); + fprintf(sdfLogFile, "\n"); + + acc_fetch_delays(object, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5]); + printDelayGroup("Current delays", 6, d[0], d[1], d[2], d[3], d[4], + d[5]); + setNewDelays(instance, d, &value); + acc_replace_delays(object, d[0], d[1], d[2], d[3], d[4], d[5]); + + acc_fetch_delays(object, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5]); + printDelayGroup("New delays", 6, d[0], d[1], d[2], d[3], d[4], d[5]); +} + +/********************************************************************** + + setPrimitiveDelays + - set delays for primitive instance + +***********************************************************************/ + +void setPrimitiveDelays(handle instance, handle driver, elist_t value) +{ + double d[6]; + + fprintf(sdfLogFile, "modifying primitive %s => ", + acc_fetch_fullname(driver)); + printValue(value); + fprintf(sdfLogFile, "\n"); + + acc_fetch_delays(driver, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5]); + printDelayGroup("Current delays", 3, d[0], d[1], d[2], d[3], d[4], + d[5]); + setNewDelays(instance, d, &value); + acc_replace_delays(driver, d[0], d[1], d[2], d[3], d[4], d[5]); + + acc_fetch_delays(driver, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5]); + printDelayGroup("New delays", 3, d[0], d[1], d[2], d[3], d[4], d[5]); +} + +/********************************************************************** + + setTimingConstraint + - set timing constraint on given instance + + **********************************************************************/ +void +setTimingConstraint(handle instance, eVerilogConstruct_t type, + port_t * p1, port_t * p2, elist_t value) +{ + int timingCheckType; + int edge2; + handle check; + double d[6]; + char name1[256]; + char name2[256]; + + // map to pli timing check type + switch (type) { + case eVSETUP: + timingCheckType = accSetup; + break; + case eVHOLD: + timingCheckType = accHold; + break; + case eVSKEW: + timingCheckType = accSkew; + break; + case eVRECOVERY: + timingCheckType = accRecovery; + break; + case eVPERIOD: + timingCheckType = accPeriod; + break; + case eVWIDTH: + timingCheckType = accWidth; + break; + case eVSETUPHOLD: + timingCheckType = accSetuphold; + break; + default: + ASSERT(FALSE); + } + + // find timing check + + if (p1->scalar) { + sprintf(name1, "%s", p1->name); + } else if (p1->lsb == p1->msb) { + sprintf(name1, "%s[%d]", p1->name, p1->msb); + } else { + sprintf(name1, "%s[%d:%d]", p1->name, p1->msb, p1->lsb); + } + + if (p2 == NULL) { + name2[0] = 0; + } else if (p2->scalar) { + sprintf(name2, "%s", p2->name); + } else if (p2->lsb == p2->msb) { + sprintf(name2, "%s[%d]", p2->name, p2->msb); + } else { + sprintf(name2, "%s[%d:%d]", p2->name, p2->msb, p2->lsb); + } + + if (p2 == NULL) { + edge2 = 0; + } else { + edge2 = p2->edge; + } + + check = acc_handle_tchk(instance, timingCheckType, name1, p1->edge, + name2, edge2); + + if (check == null) { + return; + } + // update delays + + fprintf(sdfLogFile, "modifying %s check %s => ", + acc_fetch_type_str(acc_fetch_fulltype(check)), + acc_fetch_fullname(check)); + printValue(value); + fprintf(sdfLogFile, "\n"); + + acc_fetch_delays(check, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5]); + printDelayGroup("Current delays", 1, d[0], d[1], d[2], d[3], d[4], + d[5]); + setNewDelays(instance, d, &value); + acc_replace_delays(check, d[0], d[1], d[2], d[3], d[4], d[5]); + + acc_fetch_delays(check, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5]); + printDelayGroup("New delays", 1, d[0], d[1], d[2], d[3], d[4], d[5]); +} + +/********************************************************************** + + setCellConstraint + - set cell constraint on given instance + + **********************************************************************/ +void +setCellConstraint(handle instance, port_t * p1, port_t * p2, elist_t value) +{ + handle object; + handle port; + handle net; + handle driver; + handle primitive; + char *ptr; + int position; + + + // if p1 and p2 is specified locate path + + ASSERT(p1 != NULL || p2 == NULL); + object = null; + if (p2 != NULL) { // this is a path specification + object = getPathHandle(instance, p1, p2); + + // if path is found set delays and return + if (object != null) { + setPathDelays(instance, object, value); + return; + } + } + + // if p1 is specified locate port + // apply delay to each driving primitive with same parent + + // if p1 is unspecified iterate through each output port + // apply delay to each driving primitive with same parent + + port = null; + while (TRUE) { + port = acc_next_port(instance, port); + if (port == null) { + break; + } + if (acc_fetch_direction(port) == accInput) { + continue; + } + if (p1 != NULL && strcmp(acc_fetch_name(port), p1->name) != 0) { + break; + } + net = acc_handle_loconn(port); + if (net == NULL) { + continue; + } + driver = null; + while (TRUE) { + driver = acc_next_driver(net, driver); +// if( driver == null || +// acc_fetch_type( driver ) != accPrimitive || +// acc_handle_parent( driver ) != instance ) { +// break; +// } +// terminal = acc_next_terminal( driver, null ); + if (driver == null || acc_fetch_type(driver) != accTerminal) { + break; + } + primitive = acc_handle_parent(driver); + if (acc_handle_parent(primitive) != instance) { + break; + } + ptr = strchr(acc_fetch_name(acc_handle_conn(driver)), '['); + if (ptr != null) { + position = atoi(ptr + 1); + } + + if (p1 != NULL && + !p1->scalar && + ptr != NULL && + !(p1->lsb <= position && position <= p1->msb || + p1->msb <= position && position <= p1->lsb)) { + continue; + } + + setPrimitiveDelays(instance, primitive, value); + + } + } + +} + +/********************************************************************** + + setMap + - set construct mapping, return TRUE if mapping is valid + + **********************************************************************/ + +int setMap(eSDFConstruct_t sdfConstruct, eVerilogConstruct_t vConstruct) +{ + switch (vConstruct) { + case eVINTERMODPATH: + if (sdfConstruct != eINTERCONNECT && sdfConstruct != eNETDELAY) { + return (FALSE); + } + break; + case eVMIPD: + if (sdfConstruct != eINTERCONNECT && + sdfConstruct != ePORT && sdfConstruct != eNETDELAY) { + return (FALSE); + } + break; + case eVCELL: + if (sdfConstruct != eDEVICE && sdfConstruct != eIOPATH) { + return (FALSE); + } + break; + case eVUSE: + return (TRUE); // use defaults + case eVIGNORE: + break; + default: + ASSERT(FALSE); + } + map[sdfConstruct] = vConstruct; + return (TRUE); +} + +/********************************************************************** + + setInterconnectMipd + - set global interconnectMipd spec + +***********************************************************************/ +void setInterconnectMipd(eDelayType_t aSpec) +{ + interconnectMipd = aSpec; +} + +/********************************************************************** + + setTurnOffDelay + - set global turn off delay specification + +***********************************************************************/ +void setTurnOffDelay(eDelayType_t aSpec) +{ + char *ptr; + + turnOffDelay = aSpec; + switch (aSpec) { + case eMINIMUM: + ptr = "min"; + break; + case eMAXIMUM: + ptr = "max"; + break; + case eAVERAGE: + ptr = "average"; + break; + case eFROM_FILE: + ptr = "from_user"; + break; + default: + ASSERT(FALSE); + return; + } + acc_configure(accToHiZDelay, ptr); +} + +/********************************************************************** + + setMTMSpec + - set global mtm specification + +***********************************************************************/ +void setMTMSpec(eDelayType_t aSpec) +{ + mtmSpecification = aSpec; +} + +/********************************************************************** + + setScaleFactors + - set global scale factors + +***********************************************************************/ +void setScaleFactors(double sf1, double sf2, double sf3) +{ + scaleFactor[0] = sf1; + scaleFactor[1] = sf2; + scaleFactor[2] = sf3; +} + +/********************************************************************** + + setScaleType + - set global mtm specification + +***********************************************************************/ +void setScaleType(eScaleType_t aSpec) +{ + scaleType = aSpec; +} + +/********************************************************************** + + sdf_check + - validate arguments for $sdf_annotate call + +***********************************************************************/ + +int sdf_check(int data, int reason) +{ + int numberOfArgs; + int argNumber; + char *stringPtr; + + + acc_initialize(); + + // validate arguments + + numberOfArgs = tf_nump(); + if (numberOfArgs < 1) { + tf_error("Not enough arguments"); + goto fail; + } + if (numberOfArgs > 7) { + tf_error("Too many arguments"); + goto fail; + } + // argument 1 - sdf filename + + stringPtr = tf_getcstringp(1); + if (stringPtr == NULL) { + tf_error("argument 1 must be a string"); + goto fail; + } + strcpy(inputFilename, stringPtr); + + // argument 2 - module instance + // validate later + + // arguments 3-7 + + for (argNumber = 3; argNumber <= numberOfArgs; argNumber++) { + if (tf_typep(argNumber) != tf_string) { + tf_error("argument %d must be a string", argNumber); + goto fail; + } + } + + + + fail: + acc_close(); + return (0); +} + +/********************************************************************** + + sdf_call + - execute $sdf_annotate call + +***********************************************************************/ + +int sdf_call(int data, int reason) +{ + int numberOfArgs; + int argNumber; + char *stringPtr; + char *ptr; + int i; + + acc_initialize(); + + + + // parse arguments + + numberOfArgs = tf_nump(); + + // argument 1 - sdf filename + + strcpy(inputFilename, tf_getcstringp(1)); + + // argument 2 - module instance + + if (numberOfArgs > 1) { + rootModule = acc_handle_tfarg(2); + } else { + rootModule = NULL; + } + + if (rootModule == NULL) { + rootModule = acc_handle_object(tf_mipname()); + } +// setup defaults + + strcpy(logFilename, "sdf.log"); + scaleFactor[0] = 1; + scaleFactor[1] = 1; + scaleFactor[2] = 1; + scaleType = eFROM_MTM; + timeScale = -9; // default is one ns + mtmSpecification = eTOOL_CONTROL; + configFilename[0] = 0; + turnOffDelay = eFROM_FILE; + interconnectMipd = eMAXIMUM; + + // setup default mappings + + map[eIOPATH] = eVCELL; + map[ePORT] = eVMIPD; + map[eINTERCONNECT] = eVMIPD; + map[eNETDELAY] = eVMIPD; + map[eDEVICE] = eVCELL; + map[eSETUP] = eVSETUP; + map[eHOLD] = eVHOLD; + map[eSETUPHOLD] = eVSETUPHOLD; + map[eRECOVERY] = eVRECOVERY; + map[eSKEW] = eVSKEW; + map[eWIDTH] = eVWIDTH; + map[ePERIOD] = eVPERIOD; + map[eNOCHANGE] = eVNOCHANGE; + map[ePATHPULSE] = eVPATHPULSE; + + + // argument 3 + + if (numberOfArgs > 2 && tf_typep(3) == tf_string) { + strcpy(configFilename, tf_getcstringp(3)); + initSDFCParse(); + if (sdfclexOpenFile(configFilename) != NULL) { + sdfconfig_parse(); + } + } + + // arguments 4-7 + + for (argNumber = 4; argNumber <= numberOfArgs; argNumber++) { + if (tf_typep(argNumber) == tf_nullparam) { + continue; + } + + stringPtr = tf_getcstringp(argNumber); + + switch (argNumber) { + case 4: // log file + strcpy(logFilename, stringPtr); + break; + case 5: // mtm specification + if (!strcmp(stringPtr, "MINIMUM")) { + mtmSpecification = eMINIMUM; + } else if (!strcmp(stringPtr, "TYPICAL")) { + mtmSpecification = eTYPICAL; + } else if (!strcmp(stringPtr, "MAXIMUM")) { + mtmSpecification = eMAXIMUM; + } else if (!strcmp(stringPtr, "TOOL_CONTROL")) { + mtmSpecification = eTOOL_CONTROL; + } else { + tf_error("argument %d is not recognized", argNumber); + goto fail; + } + break; + case 6: // scale factor + + // parse first value + + ptr = strchr(stringPtr, ':'); + if (ptr == NULL) { + tf_error("argument %d is an illegal scale factor", + argNumber); + goto fail; + } + + if (ptr == stringPtr) { + scaleFactor[0] = 1; + } else { + scaleFactor[0] = atof(stringPtr); + } + stringPtr = ptr + 1; + + // parse second value + + ptr = strchr(stringPtr, ':'); + if (ptr == NULL) { + tf_error("argument %d is an illegal scale factor", + argNumber); + goto fail; + } + + if (ptr == stringPtr) { + scaleFactor[1] = 1; + } else { + scaleFactor[1] = atof(stringPtr); + } + stringPtr = ptr + 1; + + // parse third value + + + if (*stringPtr == 0) { + scaleFactor[2] = 1; + } else { + scaleFactor[2] = atof(stringPtr); + } + + break; + case 7: // scale type + if (!strcmp(stringPtr, "FROM_MINIMUM")) { + scaleType = eFROM_MINIMUM; + } else if (!strcmp(stringPtr, "FROM_TYPICAL")) { + scaleType = eFROM_TYPICAL; + } else if (!strcmp(stringPtr, "FROM_MAXIMUM")) { + scaleType = eFROM_MAXIMUM; + } else if (!strcmp(stringPtr, "FROM_MTM")) { + scaleType = eFROM_MTM; + } else { + tf_error("argument %d is not recognized", argNumber); + goto fail; + } + break; + default: + ASSERT(FALSE); + } + } + + +// open logfile + + sdfLogFile = shell_fopen(logFilename, "w"); + if (sdfLogFile == NULL) { + tf_error("Could not open logfile '%s'\n", logFilename); + goto fail; + } + + +#ifdef SDF_DEBUG + fprintf(sdfLogFile, "input file = %s\n", inputFilename); + fprintf(sdfLogFile, "root module = %s\n", + acc_fetch_fullname(rootModule)); + fprintf(sdfLogFile, "config file = %s\n", configFilename); + fprintf(sdfLogFile, "log file = %s\n", logFilename); + fprintf(sdfLogFile, "mtm spec = %s\n", sDelayType[mtmSpecification]); + fprintf(sdfLogFile, "scale factor = %g:%g:%g\n", scaleFactor[0], + scaleFactor[1], scaleFactor[2]); + fprintf(sdfLogFile, "scale type = %s\n", sScaleType[scaleType]); + fprintf(sdfLogFile, "interconnect midp = %s\n", + sScaleType[interconnectMipd]); + fprintf(sdfLogFile, "turn off delay = %s\n", sDelayType[turnOffDelay]); + for (i = 0; i < sizeof(map) / sizeof(eVerilogConstruct_t); i++) { + fprintf(sdfLogFile, "mapping %s => %s\n", sSDFConstruct[i], + sVerilogConstruct[map[i]]); + } +#endif // SDF_DEBUG + + + + // parse input file + + initSDFParse(); + if (sdflexOpenFile(inputFilename) != NULL) { + sdf_parse(); + } + + + fail: + shell_fclose(sdfLogFile); + acc_close(); + return (0); +} + +/********************************************************************** + + sdf_misc + - misc pli maintanance calls + +***********************************************************************/ + +int sdf_misc(int data, int reason) +{ + acc_initialize(); + + acc_close(); + return (0); +} diff --git a/src/sdf.h b/src/sdf.h new file mode 100644 index 0000000..33a9873 --- /dev/null +++ b/src/sdf.h @@ -0,0 +1,205 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + + +/********************************************************************** + * + * sdf.h + * - definitions for sdf.c module + * + ********************************************************************** + */ + +#ifndef SDF_H +#define SDF_H + +// public section + +#define SDF_DEBUG +#define MAX_FILENAME_LENGTH 1024 + +typedef enum { + eMINIMUM = 0, + eTYPICAL, + eMAXIMUM, + eTOOL_CONTROL, + eAVERAGE, + eFROM_FILE +} eDelayType_t; + +typedef enum { + eFROM_MINIMUM = 0, + eFROM_TYPICAL, + eFROM_MAXIMUM, + eFROM_MTM +} eScaleType_t; + +typedef enum { + eIOPATH = 0, + ePORT, + eINTERCONNECT, + eNETDELAY, + eDEVICE, + eSETUP, + eHOLD, + eSETUPHOLD, + eRECOVERY, + eSKEW, + eWIDTH, + ePERIOD, + eNOCHANGE, + ePATHPULSE +} eSDFConstruct_t; + +typedef enum { + eVIGNORE = 0, + eVINTERMODPATH, + eVMIPD, + eVCELL, + eVSETUP, + eVHOLD, + eVSETUPHOLD, + eVRECOVERY, + eVSKEW, + eVWIDTH, + eVPERIOD, + eVNOCHANGE, + eVPATHPULSE, + eVUSE +} eVerilogConstruct_t; + +typedef struct { + double value; + int valid; +} creal_t; + +typedef struct { + creal_t triple[3]; +} triple_t; + +typedef struct { + triple_t values[6]; + int argCount; +} elist_t; + +typedef struct { + char *path; + char *name; + int scalar; + int msb; + int lsb; + int edge; +} port_t; + +int sdf_check(int data, int reason); +int sdf_call(int data, int reason); +int sdf_misc(int data, int reason); +void setScaleFactors(double s1, double s2, double s3); +void setScaleType(eScaleType_t aType); +void setDelayType(eDelayType_t aDelay); +void setInterconnectMipd(eDelayType_t aDelay); +void setTurnOffDelay(eDelayType_t aDelay); +int setMap(eSDFConstruct_t from, eVerilogConstruct_t to); +void setConstraint(eSDFConstruct_t type, port_t * p1, port_t * p2, + elist_t value); +void setCellConstraint(handle object, port_t * p1, port_t * p2, + elist_t value); +void setInstanceConstraint(handle object, int matchAll, + eSDFConstruct_t type, port_t * p1, port_t * p2, + elist_t value); +void setCellType(char *type); +void setTimeScale(int scale); +void resetInstance(void); +int findInstance(char *name); +void setPathDelays(handle instance, handle object, elist_t value); +void setTimingConstraint(handle instance, eVerilogConstruct_t type, + port_t * p1, port_t * p2, elist_t value); +void initSDFCParse(void); +void initSDFParse(void); +int sdfconfig_parse(void); +int sdf_parse(void); +void setMTMSpec(eDelayType_t); +void setAbsoluteDelay(int); +void printPort(port_t port); +void printValue(elist_t value); +int scaleDelay(handle object, triple_t * value, double *d); +void setNewDelays(handle object, double *d, elist_t * value); +handle getPathHandle(handle instance, port_t * outPort, port_t * inPort); +void setPrimitiveDelays(handle instance, handle driver, elist_t value); + +// private section + +#ifdef SDF_C + +char *sDelayType[] = { + "MINIMUM", + "TYPICAL", + "MAXIMUM", + "TOOL_CONTROL", + "AVERAGE", + "FROM_FILE" +}; + +char *sScaleType[] = { + "FROM_MINIMUM", + "FROM_TYPICAL", + "FROM_MAXIMUM", + "FROM_MTM" +}; + +char *sSDFConstruct[] = { + "IOPATH", + "PORT", + "INTERCONNECT", + "NETDELAY", + "DEVICE", + "SETUP", + "HOLD", + "SETUPHOLD", + "RECOVERY", + "SKEW", + "WIDTH", + "PERIOD", + "NOCHANGE", + "PATHPULSE" +}; + +char *sVerilogConstruct[] = { + "IGNORE", + "INTERMODPATH", + "MIPD", + "CELL", + "SETUP", + "HOLD", + "SETUPHOLD", + "RECOVERY", + "SKEW", + "WIDTH", + "PERIOD", + "NOCHANGE", + "PATHPULSE", + "USE" +}; + +void printDelayGroup(char *title, int delayCount, double d1, double d2, + double d3, double d4, double d5, double d6); + +#endif // SDF_C + +#endif // SDF_H diff --git a/src/sdfclex.cc b/src/sdfclex.cc new file mode 100644 index 0000000..5a4bc48 --- /dev/null +++ b/src/sdfclex.cc @@ -0,0 +1,519 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* sdflex.c - lexer for sdf's */ + +#define SDFCLEX_C + +#include +#include +#include +#include +#include +#include "vtypes.h" +#include "glue.h" +#include "tree.h" +#include "veriwell.h" +#include "acc_user.h" +#include "sdf.h" +#include "sdfcpars.h" +#include "sdfclex.h" +#include "veriuser.h" + +typedef struct { + char *string; + int token; +} table_t; + +static table_t keywordTable[] = { + "iopath", IOPATH, + "port", PORT, + "interconnect", INTERCONNECT, + "netdelay", NETDELAY, + "device", DEVICE, + "setup", SETUP, + "hold", HOLD, + "setuphold", SETUPHOLD, + "recovery", RECOVERY, + "skew", SKEW, + "width", WIDTH, + "period", PERIOD, + "nochange", NOCHANGE, + "pathpulse", PATHPULSE, + "ignore", IGNORE, + "intermod_path", INTERMOD_PATH, + "mipd", MIPD, + "cell", CELL, + "use", USE, + "interconnect_mipd", INTERCONNECT_MIPD, + "minimum", MINIMUM, + "maximum", MAXIMUM, + "average", AVERAGE, + "mtm", MTM, + "tool_control", TOOL_CONTROL, + "typical", TYPICAL, + "scale_factors", SCALE_FACTORS, + "from_minimum", FROM_MINIMUM, + "from_typical", FROM_TYPICAL, + "from_maximum", FROM_MAXIMUM, + "from_mtm", FROM_MTM, + "turnoff_delay", TURNOFF_DELAY, + "turnon_delay", TURNON_DELAY, + "module", MODULE, + "map_inner", MAP_INNER, + "add", ADD, + "override", OVERRIDE, + "ignore", IGNORE, + "from_file", FROM_FILE, + "scale_type", SCALE_TYPE, + NULL, 0 +}; + +static int lineNumber; +static FILE *fin; +static char filename[MAX_FILENAME_LENGTH]; + +static char *tokenBuffer; +static int bufferLength; +static char *bufferPtr; + +static int hierarchyChar; + +int sdfconfig_lex(YYSTYPE * val); + +/******************************************************************* + + appendTokenBuffer + - add character to token buffer + +*******************************************************************/ + +static void appendTokenBuffer(int c) +{ + ASSERT(tokenBuffer != NULL); + if (bufferPtr >= tokenBuffer + bufferLength) { + bufferLength += 40; + tokenBuffer = (char *) xrealloc(tokenBuffer, bufferLength); + } + *bufferPtr = (char) c; + bufferPtr += 1; +} + +/******************************************************************* + + scanInteger + - append characters to token buffer if they are part of + an integer + + *******************************************************************/ + +static void scanInteger(void) +{ + int c; + + while (TRUE) { + c = getc(fin); + if (c < '0' || c > '9') { + break; + } + appendTokenBuffer(c); + }; + ungetc(c, fin); +} + +/******************************************************************* + + isStringEqual + - returns TRUE if strings are equal( case insensitive ) + + ******************************************************************/ + +static int isStringEqual(char *s1, char *s2) +{ + while (*s1 != 0 && *s2 != 0) { + if (toupper(*s1) != toupper(*s2)) { + return (FALSE); + } + s1++; + s2++; + } + if (*s1 != 0 || *s2 != 0) { + return (FALSE); + } + return (TRUE); +} + +/******************************************************************* + + resetTokenBuffer + - flush token buffer + +*******************************************************************/ + +static void resetTokenBuffer() +{ + bufferPtr = tokenBuffer; +} + +/******************************************************************* + + sdflexPushFile + - push current file descriptor and position + + *******************************************************************/ + +static void sdflexPushFile() +{ + if (fin != NULL) { + ASSERT(FALSE); + } +} + +/******************************************************************* + + sdflexPopFile + - pop current file descriptor and position + + *******************************************************************/ + +static void sdflexPopFile(void) +{ + if (fin != NULL) { + shell_fclose(fin); + fin = NULL; + } +} + +/******************************************************************* + + sdflexOpenFile + - open an input file + *******************************************************************/ + +FILE *sdfclexOpenFile(char *aFilename) +{ + FILE *newFile; + + sdflexPushFile(); + strncpy(filename, aFilename, sizeof(filename)); + newFile = shell_fopen(filename, "r"); + if (newFile == NULL) { + tf_error("could not open file '%s'", filename); + sdflexPopFile(); + return (NULL); + } + fin = newFile; + lineNumber = 1; + return (fin); +} + +/******************************************************************* + + sdfconfig_error + - print error messages for sdf config parser + + *******************************************************************/ + +void sdfconfig_error(char *message) +{ + io_printf("SDF ERROR: %s L%ld, %s\n", filename, lineNumber, message); +} + + +/******************************************************************* + match + - check for 2 character sequences + +********************************************************************/ + +static int match(int c, int noToken, char *matchString, int yesToken) +{ + char c1; + + + c1 = getc(fin); + if (c1 == matchString[1]) { + appendTokenBuffer(c); + appendTokenBuffer(c1); + appendTokenBuffer(0); + return (yesToken); + } else { + ungetc(c1, fin); + if (c == matchString[0]) { + appendTokenBuffer(c); + appendTokenBuffer(0); + } + return (noToken); + } +} + +/******************************************************************* + + parseNumber + - parse all forms of numbers + + *******************************************************************/ + +static int parseNumber(int c, YYSTYPE * val) +{ + int type; + + if (c != '.') { + appendTokenBuffer(c); + if (c == '1') { + c = getc(fin); + if (c == '\'') { + c = getc(fin); + if (c == '0' || c == '1') { + appendTokenBuffer(c); + appendTokenBuffer(0); + val->integer = atoi(tokenBuffer); + return (SCALAR_CONSTANT); + } else { + ungetc(c, fin); + sdfconfig_error("Illegal scalar constant"); + val->integer = 0; + return (INTEGER); + } + } else { + ungetc(c, fin); + } + } + + scanInteger(); + type = INTEGER; + c = getc(fin); + } + + if (c == '.') { + appendTokenBuffer(c); + scanInteger(); + type = FLOATING; + c = getc(fin); + } + if (c == 'e' || c == 'E') { + appendTokenBuffer(c); + c = getc(fin); + if (c == '-' || c == '+') { + appendTokenBuffer(c); + } else { + ungetc(c, fin); + } + scanInteger(); + type = FLOATING; + } else { + ungetc(c, fin); + } + + appendTokenBuffer(0); + + if (type == FLOATING) { + val->floating = atof(tokenBuffer); + } else { + val->integer = atoi(tokenBuffer); + } + + return (type); +} + +/******************************************************************* + + parseIdentifier + - parse identifers and keywords + + *******************************************************************/ + +static int parseIdentifier(int firstChar) +{ + int c; + int escape; + int i; + + + c = firstChar; + escape = FALSE; + do { + if (c != '\\') { + if (!escape && c == hierarchyChar) { + appendTokenBuffer('.'); + } else { + appendTokenBuffer(c); + } + escape = FALSE; + } else { + escape = TRUE; + } + c = getc(fin); + } + while (c == '_' || + c == '\\' || + (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || c == hierarchyChar || escape); + + ungetc(c, fin); + + appendTokenBuffer(0); + ASSERT(tokenBuffer != NULL); + for (i = 0; keywordTable[i].string != NULL; i++) { + if (isStringEqual(keywordTable[i].string, tokenBuffer)) { + return (keywordTable[i].token); + } + } + return (IDENTIFIER); +} + + +/******************************************************************* + + sdfconfig_lex + - lexer for config parser + + *******************************************************************/ + +int sdfconfig_lex(YYSTYPE * val) +{ + int c; + + ASSERT(tokenBuffer != NULL); + + resetTokenBuffer(); + + if (fin == NULL) { + free(tokenBuffer); + tokenBuffer = NULL; + return (0); + } + + while (TRUE) { + c = getc(fin); + switch (c) { + case EOF: + sdflexPopFile(); + if (fin == NULL) { + return (EOF_); + } + break; + case ' ': + case '\r': + case '\t': + case '\b': + case '\f': + break; + case '\n': + lineNumber++; + break; + case ')': + case '(': + case '+': + case '-': + case '|': + case '*': + case '/': + case '%': + case '[': + case ']': + case ':': + case ';': + case '{': + case '}': + case '\'': + appendTokenBuffer(c); + appendTokenBuffer(0); + return (c); + case '"': + do { + c = getc(fin); + appendTokenBuffer(c); + } + while (c != '"' && c != '\n' && c != EOF); + + if (c != '"') { + sdfconfig_error("unterminated string constant"); + resetTokenBuffer(); + break; + } + return (QSTRING); + + case '&': + return match(c, c, "&&", ANDAND); + case '<': + return match(c, match(0, LT, "<=", LE), "<<", LEFT_SHIFT); + case '>': + return match(c, match(0, GT, ">=", GE), ">>", RIGHT_SHIFT); + case '~': + return match(c, match(0, match(0, c, + "~&", REDUCTION_NAND), + "~|", REDUCTION_NOR), "~^", XNOR); + case '^': + return match(c, c, "^~", XNOR); + case '=': + c = getc(fin); + if (c != '=') { + ungetc(c, fin); + appendTokenBuffer('='); + appendTokenBuffer(0); + return ('='); + } else { + return match(c, LOGICAL_EQUALITY, "==", CASE_EQUALITY); + } + case '!': + c = getc(fin); + if (c != '=') { + ungetc(c, fin); + appendTokenBuffer('!'); + appendTokenBuffer(0); + return ('!'); + } else { + return match(c, LOGICAL_INEQUALITY, "==", CASE_INEQUALITY); + } + default: + if ((c >= '0' && c <= '9') || c == '.') { + return (parseNumber(c, val)); + } else if (c == '_' || + c == '\\' || + (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) { + return (parseIdentifier(c)); + } + sdfconfig_error("illegal character"); + resetTokenBuffer(); + break; + + + } + } +} + + + +/******************************************************************* + + sdfclexInit + - initialize lexer + + *******************************************************************/ + +void sdfclexInit() +{ + fin = NULL; + bufferLength = 40; + tokenBuffer = (char *) xmalloc(bufferLength); + bufferPtr = tokenBuffer; + hierarchyChar = (int) '.'; +} diff --git a/src/sdfclex.h b/src/sdfclex.h new file mode 100644 index 0000000..0967d49 --- /dev/null +++ b/src/sdfclex.h @@ -0,0 +1,48 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/********************************************************************* + * + * sdfclex.h + * definitions for sdfclex.c + * + ********************************************************************* + */ + + +#ifndef SDFCLEX_H +#define SDFCLEX_H + +// public definitions + +void sdfconfig_error(char *message); +FILE *sdfclexOpenFile(char *filename); +void sdfclexInit(void); + + + +// private definitions + +#ifdef SDFCLEX_C +static void sdflexPushFile(void); +static void sdflexPopFile(void); +#endif // SDFLEX_C + + +#endif // SDFCLEX_H diff --git a/src/sdfcpars.cc b/src/sdfcpars.cc new file mode 100644 index 0000000..675e0cf --- /dev/null +++ b/src/sdfcpars.cc @@ -0,0 +1,1737 @@ +/* A Bison parser, made by GNU Bison 2.0. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 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., 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. */ + +/* 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 + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + IF = 258, + ELSE = 259, + OROR = 260, + ANDAND = 261, + ANDANDAND = 262, + XNOR = 263, + CASE_INEQUALITY = 264, + CASE_EQUALITY = 265, + LOGICAL_INEQUALITY = 266, + LOGICAL_EQUALITY = 267, + GE = 268, + GT = 269, + LE = 270, + LT = 271, + RIGHT_SHIFT = 272, + LEFT_SHIFT = 273, + REDUCTION_NOR = 274, + REDUCTION_NAND = 275, + UNARY = 276, + INTEGER = 277, + SCALAR_CONSTANT = 278, + FLOATING = 279, + QSTRING = 280, + IDENTIFIER = 281, + IOPATH = 282, + PORT = 283, + INTERCONNECT = 284, + NETDELAY = 285, + DEVICE = 286, + SETUP = 287, + HOLD = 288, + SETUPHOLD = 289, + RECOVERY = 290, + SKEW = 291, + WIDTH = 292, + PERIOD = 293, + NOCHANGE = 294, + PATHPULSE = 295, + IGNORE = 296, + INTERMOD_PATH = 297, + MIPD = 298, + CELL = 299, + USE = 300, + INTERCONNECT_MIPD = 301, + MINIMUM = 302, + MAXIMUM = 303, + AVERAGE = 304, + MTM = 305, + TOOL_CONTROL = 306, + TYPICAL = 307, + SCALE_FACTORS = 308, + SCALE_TYPE = 309, + FROM_MINIMUM = 310, + FROM_TYPICAL = 311, + FROM_MAXIMUM = 312, + FROM_MTM = 313, + FROM_FILE = 314, + TURNOFF_DELAY = 315, + TURNON_DELAY = 316, + MODULE = 317, + MAP_INNER = 318, + ADD = 319, + OVERRIDE = 320, + EOF_ = 321 + }; +#endif +#define IF 258 +#define ELSE 259 +#define OROR 260 +#define ANDAND 261 +#define ANDANDAND 262 +#define XNOR 263 +#define CASE_INEQUALITY 264 +#define CASE_EQUALITY 265 +#define LOGICAL_INEQUALITY 266 +#define LOGICAL_EQUALITY 267 +#define GE 268 +#define GT 269 +#define LE 270 +#define LT 271 +#define RIGHT_SHIFT 272 +#define LEFT_SHIFT 273 +#define REDUCTION_NOR 274 +#define REDUCTION_NAND 275 +#define UNARY 276 +#define INTEGER 277 +#define SCALAR_CONSTANT 278 +#define FLOATING 279 +#define QSTRING 280 +#define IDENTIFIER 281 +#define IOPATH 282 +#define PORT 283 +#define INTERCONNECT 284 +#define NETDELAY 285 +#define DEVICE 286 +#define SETUP 287 +#define HOLD 288 +#define SETUPHOLD 289 +#define RECOVERY 290 +#define SKEW 291 +#define WIDTH 292 +#define PERIOD 293 +#define NOCHANGE 294 +#define PATHPULSE 295 +#define IGNORE 296 +#define INTERMOD_PATH 297 +#define MIPD 298 +#define CELL 299 +#define USE 300 +#define INTERCONNECT_MIPD 301 +#define MINIMUM 302 +#define MAXIMUM 303 +#define AVERAGE 304 +#define MTM 305 +#define TOOL_CONTROL 306 +#define TYPICAL 307 +#define SCALE_FACTORS 308 +#define SCALE_TYPE 309 +#define FROM_MINIMUM 310 +#define FROM_TYPICAL 311 +#define FROM_MAXIMUM 312 +#define FROM_MTM 313 +#define FROM_FILE 314 +#define TURNOFF_DELAY 315 +#define TURNON_DELAY 316 +#define MODULE 317 +#define MAP_INNER 318 +#define ADD 319 +#define OVERRIDE 320 +#define EOF_ 321 + + + + +/* Copy the first part of user declarations. */ +#line 22 "sdfcpars.yy" + +#define YYERROR_VERBOSE + +#include +#include +#include +#include +#include "glue.h" +#include "acc_user.h" +#include "sdflex.h" +#include "sdf.h" +#include "sdfclex.h" + +#ifdef __cplusplus + union YYSTYPE; + int sdfconfig_lex( YYSTYPE* ); +#endif // __cplusplus + +/* Used in BISON.SIM */ +extern char *token_buffer; + + +#define yymaxdepth sdfconfig_maxdepth +#define yyparse sdfconfig_parse +#define yylex sdfconfig_lex +#define yyerror sdfconfig_error +#define yylval sdfconfig_lval +#define yychar sdfconfig_char +#define yydebug sdfconfig_debug +#define yypact sdfconfig_pact +#define yyr1 sdfconfig_r1 +#define yyr2 sdfconfig_r2 +#define yydef sdfconfig_def +#define yychk sdfconfig_chk +#define yypgo sdfconfig_pgo +#define yyact sdfconfig_act +#define yyexca sdfconfig_exca +#define yyerrflag sdfconfig_errflag +#define yynerrs sdfconfig_nerrs +#define yyps sdfconfig_ps +#define yypv sdfconfig_pv +#define yys sdfconfig_s +#define yy_yys sdfconfig_yys +#define yystate sdfconfig_state +#define yytmp sdfconfig_tmp +#define yyv sdfconfig_v +#define yy_yyv sdfconfig_yyv +#define yyval sdfconfig_val +#define yylloc sdfconfig_lloc +#define yyreds sdfconfig_reds +#define yytoks sdfconfig_toks +#define yylhs sdfconfig_yylhs +#define yylen sdfconfig_yylen +#define yydefred sdfconfig_yydefred +#define yydgoto sdfconfig_yydgoto +#define yysindex sdfconfig_yysindex +#define yyrindex sdfconfig_yyrindex +#define yygindex sdfconfig_yygindex +#define yytable sdfconfig_yytable +#define yycheck sdfconfig_yycheck +#define yyname sdfconfig_yyname +#define yyrule sdfconfig_yyrule + + + +void initSDFCParse() +{ + sdfclexInit(); +} + + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 96 "sdfcpars.yy" +typedef union YYSTYPE { + int integer; + double floating; + char *ptr; + eScaleType_t etype; + eDelayType_t dtype; + eSDFConstruct_t stype; + eVerilogConstruct_t vtype; +} YYSTYPE; +/* Line 190 of yacc.c. */ +#line 290 "sdfcpars.cc" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +/* Line 213 of yacc.c. */ +#line 302 "sdfcpars.cc" + +#if ! defined (yyoverflow) || YYERROR_VERBOSE + +# ifndef YYFREE +# define YYFREE free +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# endif + +/* 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 +# else +# define YYSTACK_ALLOC alloca +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# endif +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short int yyss; + YYSTYPE yyvs; + }; + +/* 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 (short int) + 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 \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (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 (0) + +#endif + +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short int yysigned_char; +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 31 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 88 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 83 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 12 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 46 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 73 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 321 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char 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, 31, 2, 2, 2, 28, 13, 2, + 29, 2, 26, 24, 2, 25, 2, 27, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 6, 82, + 2, 81, 2, 5, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 30, 2, 2, 11, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 10, 2, 32, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 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, + 7, 8, 9, 12, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned char yyprhs[] = +{ + 0, 0, 3, 6, 8, 10, 13, 15, 20, 25, + 30, 35, 44, 49, 54, 59, 61, 63, 65, 67, + 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, + 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, + 109, 111, 113, 115, 117, 119, 121 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yysigned_char yyrhs[] = +{ + 84, 0, -1, 85, 80, -1, 80, -1, 86, -1, + 86, 85, -1, 87, -1, 90, 81, 91, 94, -1, + 60, 81, 92, 94, -1, 64, 81, 93, 94, -1, + 64, 81, 65, 94, -1, 67, 81, 89, 6, 89, + 6, 89, 94, -1, 68, 81, 88, 94, -1, 74, + 81, 92, 94, -1, 74, 81, 73, 94, -1, 69, + -1, 70, -1, 71, -1, 72, -1, 38, -1, 36, + -1, 41, -1, 42, -1, 43, -1, 44, -1, 45, + -1, 46, -1, 47, -1, 48, -1, 49, -1, 50, + -1, 51, -1, 52, -1, 53, -1, 54, -1, 55, + -1, 56, -1, 57, -1, 58, -1, 59, -1, 61, + -1, 62, -1, 63, -1, 61, -1, 66, -1, 62, + -1, 82, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short int yyrline[] = +{ + 0, 188, 188, 189, 193, 194, 198, 202, 208, 212, + 216, 220, 224, 228, 232, 239, 241, 243, 245, 250, + 251, 258, 260, 262, 264, 266, 268, 270, 272, 274, + 276, 278, 280, 282, 284, 289, 291, 293, 295, 297, + 302, 304, 306, 311, 313, 315, 325 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE +/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "IF", "ELSE", "'?'", "':'", "OROR", + "ANDAND", "ANDANDAND", "'|'", "'^'", "XNOR", "'&'", "CASE_INEQUALITY", + "CASE_EQUALITY", "LOGICAL_INEQUALITY", "LOGICAL_EQUALITY", "GE", "GT", + "LE", "LT", "RIGHT_SHIFT", "LEFT_SHIFT", "'+'", "'-'", "'*'", "'/'", + "'%'", "'('", "'['", "'!'", "'~'", "REDUCTION_NOR", "REDUCTION_NAND", + "UNARY", "INTEGER", "SCALAR_CONSTANT", "FLOATING", "QSTRING", + "IDENTIFIER", "IOPATH", "PORT", "INTERCONNECT", "NETDELAY", "DEVICE", + "SETUP", "HOLD", "SETUPHOLD", "RECOVERY", "SKEW", "WIDTH", "PERIOD", + "NOCHANGE", "PATHPULSE", "IGNORE", "INTERMOD_PATH", "MIPD", "CELL", + "USE", "INTERCONNECT_MIPD", "MINIMUM", "MAXIMUM", "AVERAGE", "MTM", + "TOOL_CONTROL", "TYPICAL", "SCALE_FACTORS", "SCALE_TYPE", "FROM_MINIMUM", + "FROM_TYPICAL", "FROM_MAXIMUM", "FROM_MTM", "FROM_FILE", "TURNOFF_DELAY", + "TURNON_DELAY", "MODULE", "MAP_INNER", "ADD", "OVERRIDE", "EOF_", "'='", + "';'", "$accept", "config", "statements", "statement", "map", "stype", + "real", "sdf_construct", "veritool_map", "min_max_avg", "min_typ_max", + "sc", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short int yytoknum[] = +{ + 0, 256, 257, 258, 259, 63, 58, 260, 261, 262, + 124, 94, 263, 38, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 43, 45, 42, 47, 37, 40, + 91, 33, 126, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 61, 59 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = +{ + 0, 83, 84, 84, 85, 85, 86, 87, 87, 87, + 87, 87, 87, 87, 87, 88, 88, 88, 88, 89, + 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, + 92, 92, 92, 93, 93, 93, 94 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const unsigned char yyr2[] = +{ + 0, 2, 2, 1, 1, 2, 1, 4, 4, 4, + 4, 8, 4, 4, 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, 1, 1 +}; + +/* 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 unsigned char yydefact[] = +{ + 0, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 0, 0, 0, 0, 0, + 3, 0, 0, 4, 6, 0, 0, 0, 0, 0, + 0, 1, 2, 5, 0, 40, 41, 42, 0, 43, + 45, 0, 44, 0, 20, 19, 0, 15, 16, 17, + 18, 0, 0, 0, 35, 36, 37, 38, 39, 0, + 46, 8, 10, 9, 0, 12, 14, 13, 7, 0, + 0, 0, 11 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yysigned_char yydefgoto[] = +{ + -1, 21, 22, 23, 24, 51, 46, 25, 59, 38, + 43, 61 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -67 +static const yysigned_char yypact[] = +{ + -41, -67, -67, -67, -67, -67, -67, -67, -67, -67, + -67, -67, -67, -67, -67, -66, -60, -56, -52, -49, + -67, 61, -18, -1, -67, -17, -25, -31, -14, -15, + -45, -67, -67, -67, 22, -67, -67, -67, -11, -67, + -67, -11, -67, -11, -67, -67, 59, -67, -67, -67, + -67, -11, -11, -11, -67, -67, -67, -67, -67, -11, + -67, -67, -67, -67, -14, -67, -67, -67, -67, 66, + -14, -11, -67 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yysigned_char yypgoto[] = +{ + -67, -67, 51, -67, -67, -67, -50, -67, -67, 45, + -67, 17 +}; + +/* 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 -1 +static const unsigned char yytable[] = +{ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 69, 26, 35, 36, 37, 15, + 71, 27, 44, 16, 45, 28, 17, 18, 52, 29, + 39, 40, 30, 19, 41, 42, 35, 36, 37, 20, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 47, 48, 49, 50, 62, 15, + 63, 31, 32, 16, 34, 64, 17, 18, 65, 66, + 67, 60, 70, 19, 33, 53, 68, 54, 55, 56, + 57, 58, 0, 0, 0, 0, 0, 0, 72 +}; + +static const yysigned_char yycheck[] = +{ + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 64, 81, 61, 62, 63, 60, + 70, 81, 36, 64, 38, 81, 67, 68, 73, 81, + 61, 62, 81, 74, 65, 66, 61, 62, 63, 80, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 69, 70, 71, 72, 41, 60, + 43, 0, 80, 64, 81, 6, 67, 68, 51, 52, + 53, 82, 6, 74, 23, 30, 59, 55, 56, 57, + 58, 59, -1, -1, -1, -1, -1, -1, 71 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 60, 64, 67, 68, 74, + 80, 84, 85, 86, 87, 90, 81, 81, 81, 81, + 81, 0, 80, 85, 81, 61, 62, 63, 92, 61, + 62, 65, 66, 93, 36, 38, 89, 69, 70, 71, + 72, 88, 73, 92, 55, 56, 57, 58, 59, 91, + 82, 94, 94, 94, 6, 94, 94, 94, 94, 89, + 6, 89, 94 +}; + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + +#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; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror ("syntax error: cannot back up");\ + YYERROR; \ + } \ +while (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 (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) +#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, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval) +#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 (0) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_stack_print (short int *bottom, short int *top) +#else +static void +yy_stack_print (bottom, top) + short int *bottom; + short int *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; 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 (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; +#endif +{ + int yyi; + unsigned int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + yyrule - 1, yylno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ +} while (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 + SIZE_MAX < 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. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif +{ + register const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; +} +# 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. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif +{ + register char *yyd = yydest; + register const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +#endif /* !YYERROR_VERBOSE */ + + + +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) +#else +static void +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); +} + +#endif /* ! YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + 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 (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +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; + + register int yystate; + register 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; + + /* 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. */ + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + register short int *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; + + + +#define YYPOPSTACK (yyvsp--, yyssp--) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; + + 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; + + + yyvsp[0] = yylval; + + 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; + short int *yyss1 = yyss; + + + /* 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 ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyoverflowlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + short int *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + 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. */ +/* yyresume: */ + + /* 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; + + /* 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; + + *++yyvsp = yylval; + + + /* 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: + /* 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]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 7: +#line 203 "sdfcpars.yy" + { + if( ! setMap( (yyvsp[-3].stype), (yyvsp[-1].vtype) ) ) { + sdfconfig_error( "illegal construct mapping" ); + } + } + break; + + case 8: +#line 209 "sdfcpars.yy" + { + setInterconnectMipd( (yyvsp[-1].dtype) ); + } + break; + + case 9: +#line 213 "sdfcpars.yy" + { + setMTMSpec( (yyvsp[-1].dtype) ); + } + break; + + case 10: +#line 217 "sdfcpars.yy" + { + setMTMSpec( eTOOL_CONTROL ); + } + break; + + case 11: +#line 221 "sdfcpars.yy" + { + setScaleFactors( (yyvsp[-5].floating), (yyvsp[-3].floating), (yyvsp[-1].floating) ); + } + break; + + case 12: +#line 225 "sdfcpars.yy" + { + setScaleType( (yyvsp[-1].etype) ); + } + break; + + case 13: +#line 229 "sdfcpars.yy" + { + setTurnOffDelay( (yyvsp[-1].dtype) ); + } + break; + + case 14: +#line 233 "sdfcpars.yy" + { + setTurnOffDelay( eFROM_FILE ); + } + break; + + case 15: +#line 240 "sdfcpars.yy" + { (yyval.etype) = eFROM_MINIMUM; } + break; + + case 16: +#line 242 "sdfcpars.yy" + { (yyval.etype) = eFROM_TYPICAL; } + break; + + case 17: +#line 244 "sdfcpars.yy" + { (yyval.etype) = eFROM_MAXIMUM; } + break; + + case 18: +#line 246 "sdfcpars.yy" + { (yyval.etype) = eFROM_MTM; } + break; + + case 20: +#line 252 "sdfcpars.yy" + { + (yyval.floating) = (double) (yyvsp[0].integer); + } + break; + + case 21: +#line 259 "sdfcpars.yy" + { (yyval.stype) = eIOPATH; } + break; + + case 22: +#line 261 "sdfcpars.yy" + { (yyval.stype) = ePORT; } + break; + + case 23: +#line 263 "sdfcpars.yy" + { (yyval.stype) = eINTERCONNECT; } + break; + + case 24: +#line 265 "sdfcpars.yy" + { (yyval.stype) = eNETDELAY; } + break; + + case 25: +#line 267 "sdfcpars.yy" + { (yyval.stype) = eDEVICE; } + break; + + case 26: +#line 269 "sdfcpars.yy" + { (yyval.stype) = eSETUP; } + break; + + case 27: +#line 271 "sdfcpars.yy" + { (yyval.stype) = eHOLD; } + break; + + case 28: +#line 273 "sdfcpars.yy" + { (yyval.stype) = eSETUPHOLD; } + break; + + case 29: +#line 275 "sdfcpars.yy" + { (yyval.stype) = eRECOVERY; } + break; + + case 30: +#line 277 "sdfcpars.yy" + { (yyval.stype) = eSKEW; } + break; + + case 31: +#line 279 "sdfcpars.yy" + { (yyval.stype) = eWIDTH; } + break; + + case 32: +#line 281 "sdfcpars.yy" + { (yyval.stype) = ePERIOD; } + break; + + case 33: +#line 283 "sdfcpars.yy" + { (yyval.stype) = eNOCHANGE; } + break; + + case 34: +#line 285 "sdfcpars.yy" + { (yyval.stype) = ePATHPULSE; } + break; + + case 35: +#line 290 "sdfcpars.yy" + { (yyval.vtype) = eVIGNORE; } + break; + + case 36: +#line 292 "sdfcpars.yy" + { (yyval.vtype) = eVINTERMODPATH; } + break; + + case 37: +#line 294 "sdfcpars.yy" + { (yyval.vtype) = eVMIPD; } + break; + + case 38: +#line 296 "sdfcpars.yy" + { (yyval.vtype) = eVCELL; } + break; + + case 39: +#line 298 "sdfcpars.yy" + { (yyval.vtype) = eVUSE; } + break; + + case 40: +#line 303 "sdfcpars.yy" + { (yyval.dtype) = eMINIMUM; } + break; + + case 41: +#line 305 "sdfcpars.yy" + { (yyval.dtype) = eMAXIMUM; } + break; + + case 42: +#line 307 "sdfcpars.yy" + { (yyval.dtype) = eAVERAGE; } + break; + + case 43: +#line 312 "sdfcpars.yy" + { (yyval.dtype) = eMINIMUM; } + break; + + case 44: +#line 314 "sdfcpars.yy" + { (yyval.dtype) = eTYPICAL; } + break; + + case 45: +#line 316 "sdfcpars.yy" + { (yyval.dtype) = eMAXIMUM; } + break; + + case 46: +#line 326 "sdfcpars.yy" + { yyerrok; } + break; + + + } + +/* Line 1037 of yacc.c. */ +#line 1507 "sdfcpars.cc" + + yyvsp -= yylen; + yyssp -= yylen; + + + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + + /* 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 + yyn = yypact[yystate]; + + if (YYPACT_NINF < yyn && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + int yytype = YYTRANSLATE (yychar); + const char* yyprefix; + char *yymsg; + int yyx; + + /* 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; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 0; + + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); + yycount += 1; + if (yycount == 5) + { + yysize = 0; + break; + } + } + yysize += (sizeof ("syntax error, unexpected ") + + yystrlen (yytname[yytype])); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + yyp = yystpcpy (yyp, yytname[yytype]); + + if (yycount < 5) + { + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + yyp = yystpcpy (yyp, yyprefix); + yyp = yystpcpy (yyp, yytname[yyx]); + yyprefix = " or "; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("syntax error; also virtual memory exhausted"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror ("syntax error"); + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* If at end of input, pop the error token, + then the rest of the stack, then return failure. */ + if (yychar == YYEOF) + for (;;) + { + + YYPOPSTACK; + if (yyssp == yyss) + YYABORT; + yydestruct ("Error: popping", + yystos[*yyssp], yyvsp); + } + } + else + { + yydestruct ("Error: discarding", yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + +#ifdef __GNUC__ + /* Pacify GCC when the user code never invokes YYERROR and the label + yyerrorlab therefore never appears in user code. */ + if (0) + goto yyerrorlab; +#endif + +yyvsp -= yylen; + yyssp -= yylen; + 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; + + + yydestruct ("Error: popping", yystos[yystate], yyvsp); + YYPOPSTACK; + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + if (yyn == YYFINAL) + YYACCEPT; + + *++yyvsp = yylval; + + + /* 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: + yydestruct ("Error: discarding lookahead", + yytoken, &yylval); + yychar = YYEMPTY; + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*----------------------------------------------. +| yyoverflowlab -- parser overflow comes here. | +`----------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; +} + + +#line 329 "sdfcpars.yy" + + + diff --git a/src/sdfcpars.h b/src/sdfcpars.h new file mode 100644 index 0000000..37f9e23 --- /dev/null +++ b/src/sdfcpars.h @@ -0,0 +1,187 @@ +/* A Bison parser, made by GNU Bison 2.0. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 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., 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. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + IF = 258, + ELSE = 259, + OROR = 260, + ANDAND = 261, + ANDANDAND = 262, + XNOR = 263, + CASE_INEQUALITY = 264, + CASE_EQUALITY = 265, + LOGICAL_INEQUALITY = 266, + LOGICAL_EQUALITY = 267, + GE = 268, + GT = 269, + LE = 270, + LT = 271, + RIGHT_SHIFT = 272, + LEFT_SHIFT = 273, + REDUCTION_NOR = 274, + REDUCTION_NAND = 275, + UNARY = 276, + INTEGER = 277, + SCALAR_CONSTANT = 278, + FLOATING = 279, + QSTRING = 280, + IDENTIFIER = 281, + IOPATH = 282, + PORT = 283, + INTERCONNECT = 284, + NETDELAY = 285, + DEVICE = 286, + SETUP = 287, + HOLD = 288, + SETUPHOLD = 289, + RECOVERY = 290, + SKEW = 291, + WIDTH = 292, + PERIOD = 293, + NOCHANGE = 294, + PATHPULSE = 295, + IGNORE = 296, + INTERMOD_PATH = 297, + MIPD = 298, + CELL = 299, + USE = 300, + INTERCONNECT_MIPD = 301, + MINIMUM = 302, + MAXIMUM = 303, + AVERAGE = 304, + MTM = 305, + TOOL_CONTROL = 306, + TYPICAL = 307, + SCALE_FACTORS = 308, + SCALE_TYPE = 309, + FROM_MINIMUM = 310, + FROM_TYPICAL = 311, + FROM_MAXIMUM = 312, + FROM_MTM = 313, + FROM_FILE = 314, + TURNOFF_DELAY = 315, + TURNON_DELAY = 316, + MODULE = 317, + MAP_INNER = 318, + ADD = 319, + OVERRIDE = 320, + EOF_ = 321 + }; +#endif +#define IF 258 +#define ELSE 259 +#define OROR 260 +#define ANDAND 261 +#define ANDANDAND 262 +#define XNOR 263 +#define CASE_INEQUALITY 264 +#define CASE_EQUALITY 265 +#define LOGICAL_INEQUALITY 266 +#define LOGICAL_EQUALITY 267 +#define GE 268 +#define GT 269 +#define LE 270 +#define LT 271 +#define RIGHT_SHIFT 272 +#define LEFT_SHIFT 273 +#define REDUCTION_NOR 274 +#define REDUCTION_NAND 275 +#define UNARY 276 +#define INTEGER 277 +#define SCALAR_CONSTANT 278 +#define FLOATING 279 +#define QSTRING 280 +#define IDENTIFIER 281 +#define IOPATH 282 +#define PORT 283 +#define INTERCONNECT 284 +#define NETDELAY 285 +#define DEVICE 286 +#define SETUP 287 +#define HOLD 288 +#define SETUPHOLD 289 +#define RECOVERY 290 +#define SKEW 291 +#define WIDTH 292 +#define PERIOD 293 +#define NOCHANGE 294 +#define PATHPULSE 295 +#define IGNORE 296 +#define INTERMOD_PATH 297 +#define MIPD 298 +#define CELL 299 +#define USE 300 +#define INTERCONNECT_MIPD 301 +#define MINIMUM 302 +#define MAXIMUM 303 +#define AVERAGE 304 +#define MTM 305 +#define TOOL_CONTROL 306 +#define TYPICAL 307 +#define SCALE_FACTORS 308 +#define SCALE_TYPE 309 +#define FROM_MINIMUM 310 +#define FROM_TYPICAL 311 +#define FROM_MAXIMUM 312 +#define FROM_MTM 313 +#define FROM_FILE 314 +#define TURNOFF_DELAY 315 +#define TURNON_DELAY 316 +#define MODULE 317 +#define MAP_INNER 318 +#define ADD 319 +#define OVERRIDE 320 +#define EOF_ 321 + + + + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 96 "sdfcpars.yy" +typedef union YYSTYPE { + int integer; + double floating; + char *ptr; + eScaleType_t etype; + eDelayType_t dtype; + eSDFConstruct_t stype; + eVerilogConstruct_t vtype; +} YYSTYPE; +/* Line 1318 of yacc.c. */ +#line 179 "sdfcpars.h" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + + + diff --git a/src/sdfcpars.yy b/src/sdfcpars.yy new file mode 100644 index 0000000..0583870 --- /dev/null +++ b/src/sdfcpars.yy @@ -0,0 +1,330 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* sdfcpars.y - BISON/YACC parser for sdf configuration info */ + +%{ +#define YYERROR_VERBOSE + +#include +#include +#include +#include +#include "glue.h" +#include "acc_user.h" +#include "sdflex.h" +#include "sdf.h" +#include "sdfclex.h" + +#ifdef __cplusplus + union YYSTYPE; + int sdfconfig_lex( YYSTYPE* ); +#endif // __cplusplus + +/* Used in BISON.SIM */ +extern char *token_buffer; + + +#define yymaxdepth sdfconfig_maxdepth +#define yyparse sdfconfig_parse +#define yylex sdfconfig_lex +#define yyerror sdfconfig_error +#define yylval sdfconfig_lval +#define yychar sdfconfig_char +#define yydebug sdfconfig_debug +#define yypact sdfconfig_pact +#define yyr1 sdfconfig_r1 +#define yyr2 sdfconfig_r2 +#define yydef sdfconfig_def +#define yychk sdfconfig_chk +#define yypgo sdfconfig_pgo +#define yyact sdfconfig_act +#define yyexca sdfconfig_exca +#define yyerrflag sdfconfig_errflag +#define yynerrs sdfconfig_nerrs +#define yyps sdfconfig_ps +#define yypv sdfconfig_pv +#define yys sdfconfig_s +#define yy_yys sdfconfig_yys +#define yystate sdfconfig_state +#define yytmp sdfconfig_tmp +#define yyv sdfconfig_v +#define yy_yyv sdfconfig_yyv +#define yyval sdfconfig_val +#define yylloc sdfconfig_lloc +#define yyreds sdfconfig_reds +#define yytoks sdfconfig_toks +#define yylhs sdfconfig_yylhs +#define yylen sdfconfig_yylen +#define yydefred sdfconfig_yydefred +#define yydgoto sdfconfig_yydgoto +#define yysindex sdfconfig_yysindex +#define yyrindex sdfconfig_yyrindex +#define yygindex sdfconfig_yygindex +#define yytable sdfconfig_yytable +#define yycheck sdfconfig_yycheck +#define yyname sdfconfig_yyname +#define yyrule sdfconfig_yyrule + + + +void initSDFCParse() +{ + sdfclexInit(); +} + +%} +%expect 0 +%pure_parser + +%union { + int integer; + double floating; + char *ptr; + eScaleType_t etype; + eDelayType_t dtype; + eSDFConstruct_t stype; + eVerilogConstruct_t vtype; +}; + +%nonassoc IF +%nonassoc ELSE + +%right '?' ':' +%left OROR +%left ANDAND +%left ANDANDAND +%left '|' +%left '^' XNOR +%left '&' +%left LOGICAL_EQUALITY LOGICAL_INEQUALITY CASE_EQUALITY CASE_INEQUALITY +%left LT LE GT GE +%left LEFT_SHIFT RIGHT_SHIFT +%left '+' '-' +%left '*' '/' '%' +%left '(' '[' +%right '!' '~' +%right REDUCTION_NOR +%right REDUCTION_NAND +%right UNARY + + +%token INTEGER +%token SCALAR_CONSTANT +%token FLOATING +%token QSTRING +%token IDENTIFIER +%token IOPATH +%token PORT +%token INTERCONNECT +%token NETDELAY +%token DEVICE +%token SETUP +%token HOLD +%token SETUPHOLD +%token RECOVERY +%token SKEW +%token WIDTH +%token PERIOD +%token NOCHANGE +%token PATHPULSE +%token IGNORE +%token INTERMOD_PATH +%token MIPD +%token CELL +%token USE +%token INTERCONNECT_MIPD +%token MINIMUM +%token MAXIMUM +%token AVERAGE +%token MTM +%token TOOL_CONTROL +%token TYPICAL +%token SCALE_FACTORS +%token SCALE_TYPE +%token FROM_MINIMUM +%token FROM_TYPICAL +%token FROM_MAXIMUM +%token FROM_MTM +%token FROM_FILE +%token TURNOFF_DELAY +%token TURNON_DELAY +%token MODULE +%token MAP_INNER +%token ADD +%token OVERRIDE +%token IGNORE + + +%token EOF_ + +%type real +%type min_typ_max +%type min_max_avg +%type stype +%type sdf_construct +%type veritool_map + + +%% + +config + : statements EOF_ + | EOF_ + ; + +statements + : statement + | statement statements + ; + +statement + : map + ; + +map + : sdf_construct '=' veritool_map sc + { + if( ! setMap( $1, $3 ) ) { + sdfconfig_error( "illegal construct mapping" ); + } + } + | INTERCONNECT_MIPD '=' min_max_avg sc + { + setInterconnectMipd( $3 ); + } + | MTM '=' min_typ_max sc + { + setMTMSpec( $3 ); + } + | MTM '=' TOOL_CONTROL sc + { + setMTMSpec( eTOOL_CONTROL ); + } + | SCALE_FACTORS '=' real ':' real ':' real sc + { + setScaleFactors( $3, $5, $7 ); + } + | SCALE_TYPE '=' stype sc + { + setScaleType( $3 ); + } + | TURNOFF_DELAY '=' min_max_avg sc + { + setTurnOffDelay( $3 ); + } + | TURNOFF_DELAY '=' FROM_FILE sc + { + setTurnOffDelay( eFROM_FILE ); + } + ; + +stype + : FROM_MINIMUM + { $$ = eFROM_MINIMUM; } + | FROM_TYPICAL + { $$ = eFROM_TYPICAL; } + | FROM_MAXIMUM + { $$ = eFROM_MAXIMUM; } + | FROM_MTM + { $$ = eFROM_MTM; } + ; + +real + : FLOATING + | INTEGER + { + $$ = (double) $1; + } + ; + +sdf_construct + : IOPATH + { $$ = eIOPATH; } + | PORT + { $$ = ePORT; } + | INTERCONNECT + { $$ = eINTERCONNECT; } + | NETDELAY + { $$ = eNETDELAY; } + | DEVICE + { $$ = eDEVICE; } + | SETUP + { $$ = eSETUP; } + | HOLD + { $$ = eHOLD; } + | SETUPHOLD + { $$ = eSETUPHOLD; } + | RECOVERY + { $$ = eRECOVERY; } + | SKEW + { $$ = eSKEW; } + | WIDTH + { $$ = eWIDTH; } + | PERIOD + { $$ = ePERIOD; } + | NOCHANGE + { $$ = eNOCHANGE; } + | PATHPULSE + { $$ = ePATHPULSE; } + ; + +veritool_map + : IGNORE + { $$ = eVIGNORE; } + | INTERMOD_PATH + { $$ = eVINTERMODPATH; } + | MIPD + { $$ = eVMIPD; } + | CELL + { $$ = eVCELL; } + | USE + { $$ = eVUSE; } + ; + +min_max_avg + : MINIMUM + { $$ = eMINIMUM; } + | MAXIMUM + { $$ = eMAXIMUM; } + | AVERAGE + { $$ = eAVERAGE; } + ; + +min_typ_max + : MINIMUM + { $$ = eMINIMUM; } + | TYPICAL + { $$ = eTYPICAL; } + | MAXIMUM + { $$ = eMAXIMUM; } + ; + +/* +"Important" terminals +*/ + + +sc + : ';' + { yyerrok; } + ; + +%% + diff --git a/src/sdflex.cc b/src/sdflex.cc new file mode 100644 index 0000000..94785c4 --- /dev/null +++ b/src/sdflex.cc @@ -0,0 +1,654 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* sdflex.c - lexer for sdf's */ + +#define SDFLEX_C + +#include +#include +#include +#include +#include +#include "vtypes.h" +#include "glue.h" +#include "tree.h" +#include "veriwell.h" +#include "acc_user.h" +#include "sdf.h" +#include "sdfparse.h" +#include "sdflex.h" +#include "veriuser.h" + +typedef struct { + char *string; + int token; +} table_t; + +static table_t keywordTable[] = { + "delayfile", DELAYFILE, + "sdfversion", SDFVERSION, + "design", DESIGN, + "date", DATE, + "vendor", VENDOR, + "program", PROGRAM, + "version", VERSION_, + "program", PROGRAM, + "divider", DIVIDER, + "voltage", VOLTAGE, + "process", PROCESS, + "temperature", TEMPERATURE, + "timescale", TIMESCALE, + "cell", CELL, + "celltype", CELLTYPE, + "instance", INSTANCE, + "delay", DELAY, + "timingcheck", TIMINGCHECK, + "include", INCLUDE, + "absolute", ABSOLUTE, + "increment", INCREMENT, + "userdef", USERDEF, + "pathpulse", PATHPULSE, + "globalpathpulse", GLOBALPATHPULSE, + "iopath", IOPATH, + "cond", COND, + "port", PORT, + "interconnect", INTERCONNECT, + "netdelay", NETDELAY, + "device", DEVICE, + "setup", SETUP, + "hold", HOLD, + "setuphold", SETUPHOLD, + "recovery", RECOVERY, + "skew", SKEW, + "width", WIDTH, + "period", PERIOD, + "nochange", NOCHANGE, + "pathconstraint", PATHCONSTRAINT, + "sum", SUM, + "diff", DIFF, + "skewconstraint", SKEWCONSTRAINT, + "posedge", POSEDGE, + "negedge", NEGEDGE, + "ns", NANOSECOND, + "us", MICROSECOND, + "ps", PICOSECOND, + "01", EDGE_01, + "10", EDGE_10, + "0z", EDGE_0z, + "1z", EDGE_1z, + "z0", EDGE_z0, + "z1", EDGE_z1, + NULL, 0 +}; + +static int lineNumber; +static FILE *fin; +static char filename[MAX_FILENAME_LENGTH]; +static char *stringList; + +static char *tokenBuffer; +static int bufferLength; +static char *bufferPtr; + +static int hierarchyChar; +static int parseBlob; +static int enableEdges; + +static FileList_t *fileList; +extern FILE *sdfLogFile; + +int sdf_lex(YYSTYPE * val); + + +/******************************************************************* + + sdfEnableEdges + - enable lexer to indentifier edges + +********************************************************************/ + +int sdfEnableEdges(int enable) +{ + int result; + + ASSERT(enable == TRUE || enable == FALSE); + result = enableEdges; + enableEdges = enable; + return (result); +} + +/******************************************************************* + + purgeStrings + - frees all allocated strings + +********************************************************************/ + +void purgeStrings() +{ + char *ptr; + + while (stringList) { + ptr = stringList; + stringList = *(char **) stringList; + free(ptr); + } +} + + +/******************************************************************* + + saveString + - allocates storage and copies the given string + +********************************************************************/ + +char *saveString(char *src) +{ + char *dst; + + /* keep track of all allocated string so they can be purged */ + + dst = (char *) xmalloc(strlen(src) + 1 + sizeof(char *)); + *(char **) dst = stringList; + stringList = dst; + dst += sizeof(char *); + strcpy(dst, src); + return (dst); +} + +/******************************************************************* + + setParseBlob + +*******************************************************************/ + +void setParseBlob() +{ + parseBlob = TRUE; +} + +/******************************************************************* + + appendTokenBuffer + - add character to token buffer + +*******************************************************************/ + +static void appendTokenBuffer(int c) +{ + ASSERT(tokenBuffer != NULL); + if (bufferPtr >= tokenBuffer + bufferLength) { + bufferLength += 40; + tokenBuffer = (char *) xrealloc(tokenBuffer, bufferLength); + } + *bufferPtr = (char) c; + bufferPtr += 1; +} + +/******************************************************************* + + scanInteger + - append characters to token buffer if they are part of + an integer + + *******************************************************************/ + +static void scanInteger(void) +{ + int c; + + while (TRUE) { + c = getc(fin); + if (c < '0' || c > '9') { + break; + } + appendTokenBuffer(c); + }; + ungetc(c, fin); +} + +/******************************************************************* + + isStringEqual + - returns TRUE if strings are equal( case insensitive ) + + ******************************************************************/ + +static int isStringEqual(char *s1, char *s2) +{ + while (*s1 != 0 && *s2 != 0) { + if (toupper(*s1) != toupper(*s2)) { + return (FALSE); + } + s1++; + s2++; + } + if (*s1 != 0 || *s2 != 0) { + return (FALSE); + } + return (TRUE); +} + +/******************************************************************* + + resetTokenBuffer + - flush token buffer + +*******************************************************************/ + +static void resetTokenBuffer() +{ + bufferPtr = tokenBuffer; +} + +/******************************************************************* + + sdflexPushFile + - push current file descriptor and position + + *******************************************************************/ + +static void sdflexPushFile() +{ + FileList_t *entry; + + if (fin != NULL) { + entry = (FileList_t *) xmalloc(sizeof(FileList_t)); + strcpy(entry->filename, filename); + entry->lineNumber = lineNumber; + entry->file = fin; + entry->next = fileList; + fileList = entry; + } +} + +/******************************************************************* + + sdflexPopFile + - pop current file descriptor and position + + *******************************************************************/ + +static void sdflexPopFile(void) +{ + FileList_t *entry; + + + if (fin != NULL) { + shell_fclose(fin); + fin = NULL; + } + + + entry = fileList; + if (entry != NULL) { + fin = entry->file; + strcpy(filename, entry->filename); + lineNumber = entry->lineNumber; + fileList = entry->next; + free(entry); + } + +} + +/******************************************************************* + + sdflexOpenFile + - open an input file + *******************************************************************/ + +FILE *sdflexOpenFile(char *aFilename) +{ + FILE *newFile; + + sdflexPushFile(); + strncpy(filename, aFilename, sizeof(filename)); + newFile = shell_fopen(filename, "r"); + if (newFile == NULL) { + tf_error("could not open file '%s'", filename); + sdflexPopFile(); + return (NULL); + } + fin = newFile; + lineNumber = 1; + return (fin); +} + +/******************************************************************* + + sdf_error + - print error messages for sdf parser + + *******************************************************************/ + +void sdf_error(char *message) +{ + io_printf("SDF ERROR: %s L%ld, %s\n", filename, lineNumber, message); + fprintf(sdfLogFile, "SDF ERROR: %s L%ld, %s\n", filename, lineNumber, + message); +} + + +/******************************************************************* + match + - check for 2 character sequences + +********************************************************************/ + +static int match(int c, int noToken, char *matchString, int yesToken) +{ + char c1; + + + c1 = getc(fin); + if (c1 == matchString[1]) { + appendTokenBuffer(c); + appendTokenBuffer(c1); + appendTokenBuffer(0); + return (yesToken); + } else { + ungetc(c1, fin); + if (c == matchString[0]) { + appendTokenBuffer(c); + appendTokenBuffer(0); + } + return (noToken); + } +} + +/******************************************************************* + + parseNumber + - parse all forms of numbers + + *******************************************************************/ + +static int parseNumber(int c, YYSTYPE * val) +{ + int type; + + if (c != '.') { + appendTokenBuffer(c); + if (c == '1') { + c = getc(fin); + if (c == '\'') { + c = getc(fin); + if (c == '0' || c == '1') { + appendTokenBuffer(c); + appendTokenBuffer(0); + val->integer = atoi(tokenBuffer); + return (SCALAR_CONSTANT); + } else { + ungetc(c, fin); + sdf_error("Illegal scalar constant"); + val->integer = 0; + return (INTEGER); + } + } else { + ungetc(c, fin); + } + } + + scanInteger(); + type = INTEGER; + c = getc(fin); + } + + if (c == '.') { + appendTokenBuffer(c); + scanInteger(); + type = FLOATING; + c = getc(fin); + } + if (c == 'e' || c == 'E') { + appendTokenBuffer(c); + c = getc(fin); + if (c == '-' || c == '+') { + appendTokenBuffer(c); + } else { + ungetc(c, fin); + } + scanInteger(); + type = FLOATING; + } else { + ungetc(c, fin); + } + + appendTokenBuffer(0); + + if (type == FLOATING) { + val->floating = atof(tokenBuffer); + } else { + val->integer = atoi(tokenBuffer); + } + + return (type); +} + +/******************************************************************* + + parseIdentifier + - parse identifers and keywords + + *******************************************************************/ + +static int parseIdentifier(int firstChar, YYSTYPE * val) +{ + int c; + int escape; + int i; + + + c = firstChar; + escape = FALSE; + do { + if (c != '\\') { + if (!escape && c == hierarchyChar) { + appendTokenBuffer('.'); + } else { + appendTokenBuffer(c); + } + escape = FALSE; + } else { + escape = TRUE; + } + c = getc(fin); + } + while (c == '_' || + c == '\\' || + (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || c == hierarchyChar || escape); + + ungetc(c, fin); + + appendTokenBuffer(0); + ASSERT(tokenBuffer != NULL); + for (i = 0; keywordTable[i].string != NULL; i++) { + if (isStringEqual(keywordTable[i].string, tokenBuffer)) { + return (keywordTable[i].token); + } + } + + val->ptr = saveString(tokenBuffer); + strcpy(val->ptr, tokenBuffer); + return (IDENTIFIER); +} + + +/******************************************************************* + + sdf_lex + - lexer for sdf parser + + *******************************************************************/ + +int sdf_lex(YYSTYPE * val) +{ + int c; + + ASSERT(tokenBuffer != NULL); + + resetTokenBuffer(); + + if (fin == NULL) { + free(tokenBuffer); + tokenBuffer = NULL; + return (0); + } + + while (TRUE) { + c = getc(fin); + while (strchr("\r\t\b\f\n ", c) != NULL) { + if (c == '\n') { + lineNumber++; + } + c = getc(fin); + } + + if (parseBlob) { + while (strchr("\377 )\r\t\b\f\n", c) == NULL) { + appendTokenBuffer(c); + c = getc(fin); + } + appendTokenBuffer(0); + ungetc(c, fin); + parseBlob = FALSE; + val->ptr = saveString(tokenBuffer); + return (BLOB); + } + + switch (c) { + case EOF: + sdflexPopFile(); + if (fin == NULL) { + return (EOF_); + } + break; + case ')': + case '(': + case '+': + case '-': + case '|': + case '*': + case '/': + case '%': + case '[': + case ']': + case ':': + case ';': + case '{': + case '}': + case '\'': + appendTokenBuffer(c); + appendTokenBuffer(0); + return (c); + case '"': + do { + c = getc(fin); + appendTokenBuffer(c); + } + while (c != '"' && c != '\n' && c != EOF); + + if (c != '"') { + sdf_error("unterminated string constant"); + resetTokenBuffer(); + break; + } + appendTokenBuffer(0); + val->ptr = saveString(tokenBuffer); + val->ptr[strlen(val->ptr) - 1] = 0; + return (QSTRING); + + case '&': + return match(c, c, "&&", ANDAND); + case '<': + return match(c, match(0, LT, "<=", LE), "<<", LEFT_SHIFT); + case '>': + return match(c, match(0, GT, ">=", GE), ">>", RIGHT_SHIFT); + case '~': + return match(c, match(0, match(0, c, + "~&", REDUCTION_NAND), + "~|", REDUCTION_NOR), "~^", XNOR); + case '^': + return match(c, c, "^~", XNOR); + case '=': + c = getc(fin); + if (c != '=') { + ungetc(c, fin); + appendTokenBuffer('='); + appendTokenBuffer(0); + return ('='); + } else { + return match(c, LOGICAL_EQUALITY, "==", CASE_EQUALITY); + } + case '!': + c = getc(fin); + if (c != '=') { + ungetc(c, fin); + appendTokenBuffer('!'); + appendTokenBuffer(0); + return ('!'); + } else { + return match(c, LOGICAL_INEQUALITY, "==", CASE_INEQUALITY); + } + default: + + if ((!enableEdges && (c == '0' || c == '1')) || + (c >= '2' && c <= '9') || c == '.') { + return (parseNumber(c, val)); + } else if ((enableEdges && (c == '0' || c == '1')) || + c == '_' || + c == '\\' || + (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) { + return (parseIdentifier(c, val)); + } + sdf_error("illegal character"); + resetTokenBuffer(); + break; + + + } + } +} + + + +/******************************************************************* + + sdflexInit + - initialize lexer + + *******************************************************************/ + +void sdflexInit() +{ + fileList = NULL; + fin = NULL; + stringList = NULL; + enableEdges = FALSE; + bufferLength = 40; + tokenBuffer = (char *) xmalloc(bufferLength); + bufferPtr = tokenBuffer; + hierarchyChar = (int) '.'; + parseBlob = FALSE; + filename[0] = 0; +} diff --git a/src/sdflex.h b/src/sdflex.h new file mode 100644 index 0000000..a4d16fc --- /dev/null +++ b/src/sdflex.h @@ -0,0 +1,58 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + + +/********************************************************************* + * + * sdflex.h + * definitions for sdflex.c + * + ********************************************************************* + */ + + +#ifndef SDFLEX_H +#define SDFLEX_H + +// public definitions + +void sdf_error(char *message); +FILE *sdflexOpenFile(char *filename); +void sdflexInit(void); +int sdfEnableEdges(int enable); +void purgeStrings(void); +void setParseBlob(void); +char *saveString(char *src); + +// private definitions + +#ifdef SDFLEX_C +typedef struct fileList_tag { + struct fileList_tag *next; + char filename[MAX_FILENAME_LENGTH]; + int lineNumber; + FILE *file; +} FileList_t; + +static void sdflexPushFile(void); +static void sdflexPopFile(void); +#endif // SDFLEX_C + + +#endif // SDFLEX_H diff --git a/src/sdfparse.cc b/src/sdfparse.cc new file mode 100644 index 0000000..85a8ae9 --- /dev/null +++ b/src/sdfparse.cc @@ -0,0 +1,2641 @@ +/* A Bison parser, made by GNU Bison 2.0. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 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., 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. */ + +/* 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 + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + IF = 258, + ELSE = 259, + OROR = 260, + ANDAND = 261, + ANDANDAND = 262, + XNOR = 263, + CASE_INEQUALITY = 264, + CASE_EQUALITY = 265, + LOGICAL_INEQUALITY = 266, + LOGICAL_EQUALITY = 267, + GE = 268, + GT = 269, + LE = 270, + LT = 271, + RIGHT_SHIFT = 272, + LEFT_SHIFT = 273, + REDUCTION_NOR = 274, + REDUCTION_NAND = 275, + UNARY = 276, + INTEGER = 277, + SCALAR_CONSTANT = 278, + FLOATING = 279, + QSTRING = 280, + IDENTIFIER = 281, + BLOB = 282, + POSEDGE = 283, + NEGEDGE = 284, + DELAYFILE = 285, + SDFVERSION = 286, + DESIGN = 287, + DATE = 288, + VENDOR = 289, + PROGRAM = 290, + VERSION_ = 291, + DIVIDER = 292, + VOLTAGE = 293, + PROCESS = 294, + TEMPERATURE = 295, + TIMESCALE = 296, + CELL = 297, + CELLTYPE = 298, + INSTANCE = 299, + DELAY = 300, + TIMINGCHECK = 301, + INCLUDE = 302, + ABSOLUTE = 303, + INCREMENT = 304, + USERDEF = 305, + PATHPULSE = 306, + GLOBALPATHPULSE = 307, + IOPATH = 308, + COND = 309, + PORT = 310, + INTERCONNECT = 311, + NETDELAY = 312, + DEVICE = 313, + SETUP = 314, + HOLD = 315, + SETUPHOLD = 316, + RECOVERY = 317, + SKEW = 318, + WIDTH = 319, + PERIOD = 320, + NOCHANGE = 321, + PATHCONSTRAINT = 322, + SUM = 323, + DIFF = 324, + SKEWCONSTRAINT = 325, + MICROSECOND = 326, + NANOSECOND = 327, + PICOSECOND = 328, + EDGE_01 = 329, + EDGE_10 = 330, + EDGE_0z = 331, + EDGE_1z = 332, + EDGE_z0 = 333, + EDGE_z1 = 334, + EOF_ = 335 + }; +#endif +#define IF 258 +#define ELSE 259 +#define OROR 260 +#define ANDAND 261 +#define ANDANDAND 262 +#define XNOR 263 +#define CASE_INEQUALITY 264 +#define CASE_EQUALITY 265 +#define LOGICAL_INEQUALITY 266 +#define LOGICAL_EQUALITY 267 +#define GE 268 +#define GT 269 +#define LE 270 +#define LT 271 +#define RIGHT_SHIFT 272 +#define LEFT_SHIFT 273 +#define REDUCTION_NOR 274 +#define REDUCTION_NAND 275 +#define UNARY 276 +#define INTEGER 277 +#define SCALAR_CONSTANT 278 +#define FLOATING 279 +#define QSTRING 280 +#define IDENTIFIER 281 +#define BLOB 282 +#define POSEDGE 283 +#define NEGEDGE 284 +#define DELAYFILE 285 +#define SDFVERSION 286 +#define DESIGN 287 +#define DATE 288 +#define VENDOR 289 +#define PROGRAM 290 +#define VERSION_ 291 +#define DIVIDER 292 +#define VOLTAGE 293 +#define PROCESS 294 +#define TEMPERATURE 295 +#define TIMESCALE 296 +#define CELL 297 +#define CELLTYPE 298 +#define INSTANCE 299 +#define DELAY 300 +#define TIMINGCHECK 301 +#define INCLUDE 302 +#define ABSOLUTE 303 +#define INCREMENT 304 +#define USERDEF 305 +#define PATHPULSE 306 +#define GLOBALPATHPULSE 307 +#define IOPATH 308 +#define COND 309 +#define PORT 310 +#define INTERCONNECT 311 +#define NETDELAY 312 +#define DEVICE 313 +#define SETUP 314 +#define HOLD 315 +#define SETUPHOLD 316 +#define RECOVERY 317 +#define SKEW 318 +#define WIDTH 319 +#define PERIOD 320 +#define NOCHANGE 321 +#define PATHCONSTRAINT 322 +#define SUM 323 +#define DIFF 324 +#define SKEWCONSTRAINT 325 +#define MICROSECOND 326 +#define NANOSECOND 327 +#define PICOSECOND 328 +#define EDGE_01 329 +#define EDGE_10 330 +#define EDGE_0z 331 +#define EDGE_1z 332 +#define EDGE_z0 333 +#define EDGE_z1 334 +#define EOF_ 335 + + + + +/* Copy the first part of user declarations. */ +#line 22 "sdfparse.yy" + +#define YYERROR_VERBOSE + +#include +#include +#include +#include +#include "glue.h" +#include "sdflex.h" +#include "acc_user.h" +#include "veriuser.h" +#include "sdf.h" + +#ifdef __cplusplus + union YYSTYPE; + int sdf_lex (YYSTYPE *); +#endif // __cplusplus + +#define yymaxdepth sdf_maxdepth +#define yyparse sdf_parse +#define yylex sdf_lex +#define yyerror sdf_error +#define yylval sdf_lval +#define yychar sdf_char +#define yydebug sdf_debug +#define yypact sdf_pact +#define yyr1 sdf_r1 +#define yyr2 sdf_r2 +#define yydef sdf_def +#define yychk sdf_chk +#define yypgo sdf_pgo +#define yyact sdf_act +#define yyexca sdf_exca +#define yyerrflag sdf_errflag +#define yynerrs sdf_nerrs +#define yyps sdf_ps +#define yypv sdf_pv +#define yys sdf_s +#define yy_yys sdf_yys +#define yystate sdf_state +#define yytmp sdf_tmp +#define yyv sdf_v +#define yy_yyv sdf_yyv +#define yyval sdf_val +#define yylloc sdf_lloc +#define yyreds sdf_reds +#define yytoks sdf_toks +#define yylhs sdf_yylhs +#define yylen sdf_yylen +#define yydefred sdf_yydefred +#define yydgoto sdf_yydgoto +#define yysindex sdf_yysindex +#define yyrindex sdf_yyrindex +#define yygindex sdf_yygindex +#define yytable sdf_yytable +#define yycheck sdf_yycheck +#define yyname sdf_yyname +#define yyrule sdf_yyrule + +/* Used in BISON.SIM */ +extern char *token_buffer; + + +void initSDFParse() +{ + sdflexInit(); +} + + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 93 "sdfparse.yy" +typedef union YYSTYPE { + int integer; + double floating; + char *ptr; + eScaleType_t etype; + eDelayType_t dtype; + eSDFConstruct_t stype; + eVerilogConstruct_t vtype; + char character; + creal_t creal; + triple_t triple; + elist_t elist; + port_t port; +} YYSTYPE; +/* Line 190 of yacc.c. */ +#line 321 "sdfparse.cc" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +/* Line 213 of yacc.c. */ +#line 333 "sdfparse.cc" + +#if ! defined (yyoverflow) || YYERROR_VERBOSE + +# ifndef YYFREE +# define YYFREE free +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# endif + +/* 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 +# else +# define YYSTACK_ALLOC alloca +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# endif +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short int yyss; + YYSTYPE yyvs; + }; + +/* 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 (short int) + 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 \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (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 (0) + +#endif + +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short int yysigned_char; +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 5 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 383 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 97 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 64 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 141 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 376 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 335 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char 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, 31, 2, 2, 2, 28, 13, 2, + 29, 95, 26, 24, 2, 25, 2, 27, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 6, 2, + 2, 2, 2, 5, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 30, 2, 96, 11, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 10, 2, 32, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 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, + 7, 8, 9, 12, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned short int yyprhs[] = +{ + 0, 0, 3, 6, 22, 27, 32, 37, 42, 47, + 52, 53, 59, 64, 68, 73, 78, 82, 88, 94, + 100, 104, 106, 109, 111, 112, 113, 122, 127, 131, + 134, 138, 142, 146, 148, 152, 153, 157, 158, 163, + 164, 169, 172, 174, 180, 182, 183, 190, 197, 204, + 211, 218, 224, 230, 237, 240, 242, 243, 249, 250, + 256, 259, 261, 264, 266, 268, 270, 272, 275, 277, + 279, 282, 289, 300, 306, 313, 319, 324, 330, 331, + 338, 349, 355, 362, 368, 373, 379, 381, 382, 386, + 388, 390, 395, 402, 406, 410, 414, 418, 422, 426, + 430, 434, 438, 440, 443, 447, 451, 455, 457, 461, + 468, 478, 491, 507, 526, 530, 537, 547, 560, 576, + 595, 601, 607, 613, 614, 620, 626, 632, 633, 635, + 638, 641, 643, 645, 647, 648, 650, 651, 653, 654, + 656, 658 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const short int yyrhs[] = +{ + 98, 0, -1, 99, 94, -1, 29, 44, 100, 101, + 102, 103, 104, 105, 106, 108, 109, 110, 111, 113, + 159, -1, 29, 45, 158, 159, -1, 29, 46, 158, + 159, -1, 29, 47, 158, 159, -1, 29, 48, 158, + 159, -1, 29, 49, 158, 159, -1, 29, 50, 158, + 159, -1, -1, 29, 51, 107, 41, 159, -1, 29, + 52, 152, 159, -1, 29, 52, 159, -1, 29, 53, + 158, 159, -1, 29, 54, 152, 159, -1, 29, 54, + 159, -1, 29, 55, 112, 86, 159, -1, 29, 55, + 112, 85, 159, -1, 29, 55, 112, 87, 159, -1, + 29, 55, 159, -1, 36, -1, 114, 113, -1, 114, + -1, -1, -1, 29, 56, 115, 116, 29, 117, 120, + 159, -1, 29, 57, 39, 159, -1, 118, 29, 117, + -1, 118, 29, -1, 58, 40, 159, -1, 58, 26, + 159, -1, 58, 40, 159, -1, 121, -1, 121, 29, + 120, -1, -1, 59, 128, 159, -1, -1, 60, 122, + 124, 159, -1, -1, 61, 123, 41, 159, -1, 125, + 124, -1, 125, -1, 29, 68, 126, 127, 159, -1, + 127, -1, -1, 29, 73, 143, 141, 148, 159, -1, + 29, 74, 143, 141, 148, 159, -1, 29, 75, 143, + 141, 147, 159, -1, 29, 76, 141, 141, 148, 159, + -1, 29, 77, 141, 141, 148, 159, -1, 29, 78, + 141, 148, 159, -1, 29, 79, 141, 148, 159, -1, + 29, 80, 141, 143, 147, 159, -1, 129, 128, -1, + 129, -1, -1, 29, 62, 130, 132, 159, -1, -1, + 29, 63, 131, 133, 159, -1, 138, 132, -1, 138, + -1, 140, 140, -1, 140, -1, 137, -1, 135, -1, + 136, -1, 119, 136, -1, 40, -1, 143, -1, 119, + 143, -1, 29, 67, 141, 143, 146, 159, -1, 29, + 68, 139, 29, 67, 141, 143, 146, 159, 159, -1, + 29, 69, 143, 146, 159, -1, 29, 70, 137, 137, + 146, 159, -1, 29, 71, 134, 146, 159, -1, 29, + 72, 146, 159, -1, 29, 72, 137, 146, 159, -1, + -1, 29, 67, 141, 143, 149, 159, -1, 29, 68, + 139, 29, 67, 141, 143, 149, 159, 159, -1, 29, + 69, 143, 149, 159, -1, 29, 70, 137, 137, 149, + 159, -1, 29, 71, 134, 149, 159, -1, 29, 72, + 146, 159, -1, 29, 72, 137, 149, 159, -1, 143, + -1, -1, 29, 142, 145, -1, 144, -1, 40, -1, + 40, 30, 36, 160, -1, 40, 30, 36, 6, 36, + 160, -1, 42, 143, 159, -1, 43, 143, 159, -1, + 88, 143, 159, -1, 89, 143, 159, -1, 93, 143, + 159, -1, 92, 143, 159, -1, 91, 143, 159, -1, + 90, 143, 159, -1, 29, 155, 159, -1, 150, -1, + 148, 148, -1, 29, 154, 159, -1, 29, 152, 159, + -1, 29, 154, 159, -1, 151, -1, 29, 153, 159, + -1, 29, 153, 159, 29, 153, 159, -1, 29, 153, + 159, 29, 153, 159, 29, 153, 159, -1, 29, 153, + 159, 29, 153, 159, 29, 153, 159, 29, 153, 159, + -1, 29, 153, 159, 29, 153, 159, 29, 153, 159, + 29, 153, 159, 29, 153, 159, -1, 29, 153, 159, + 29, 153, 159, 29, 153, 159, 29, 153, 159, 29, + 153, 159, 29, 153, 159, -1, 29, 152, 159, -1, + 29, 152, 159, 29, 152, 159, -1, 29, 152, 159, + 29, 152, 159, 29, 152, 159, -1, 29, 152, 159, + 29, 152, 159, 29, 152, 159, 29, 152, 159, -1, + 29, 152, 159, 29, 152, 159, 29, 152, 159, 29, + 152, 159, 29, 152, 159, -1, 29, 152, 159, 29, + 152, 159, 29, 152, 159, 29, 152, 159, 29, 152, + 159, 29, 152, 159, -1, 154, 6, 156, 6, 156, + -1, 156, 6, 154, 6, 156, -1, 156, 6, 156, + 6, 154, -1, -1, 155, 6, 157, 6, 157, -1, + 157, 6, 155, 6, 157, -1, 157, 6, 157, 6, + 155, -1, -1, 155, -1, 24, 155, -1, 25, 155, + -1, 38, -1, 36, -1, 154, -1, -1, 155, -1, + -1, 39, -1, -1, 95, -1, 96, -1, 1, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short int yyrline[] = +{ + 0, 222, 222, 226, 233, 238, 243, 248, 253, 258, + 263, 263, 268, 270, 275, 280, 282, 287, 292, 297, + 302, 310, 329, 330, 331, 335, 334, 345, 353, 354, + 358, 363, 371, 378, 379, 381, 383, 384, 384, 385, + 385, 392, 393, 398, 400, 404, 409, 413, 417, 421, + 425, 429, 433, 437, 444, 445, 450, 449, 456, 455, + 464, 465, 469, 470, 474, 475, 479, 480, 488, 498, + 499, 508, 512, 517, 521, 525, 529, 533, 539, 544, + 548, 553, 557, 561, 565, 569, 575, 576, 576, 583, + 587, 594, 603, 615, 620, 625, 630, 635, 640, 645, + 650, 659, 670, 674, 683, 694, 702, 713, 717, 722, + 728, 735, 744, 754, 769, 774, 780, 787, 796, 806, + 820, 827, 834, 842, 850, 857, 864, 872, 880, 881, + 883, 887, 888, 893, 899, 903, 909, 913, 915, 923, + 928, 930 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE +/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "IF", "ELSE", "'?'", "':'", "OROR", + "ANDAND", "ANDANDAND", "'|'", "'^'", "XNOR", "'&'", "CASE_INEQUALITY", + "CASE_EQUALITY", "LOGICAL_INEQUALITY", "LOGICAL_EQUALITY", "GE", "GT", + "LE", "LT", "RIGHT_SHIFT", "LEFT_SHIFT", "'+'", "'-'", "'*'", "'/'", + "'%'", "'('", "'['", "'!'", "'~'", "REDUCTION_NOR", "REDUCTION_NAND", + "UNARY", "INTEGER", "SCALAR_CONSTANT", "FLOATING", "QSTRING", + "IDENTIFIER", "BLOB", "POSEDGE", "NEGEDGE", "DELAYFILE", "SDFVERSION", + "DESIGN", "DATE", "VENDOR", "PROGRAM", "VERSION_", "DIVIDER", "VOLTAGE", + "PROCESS", "TEMPERATURE", "TIMESCALE", "CELL", "CELLTYPE", "INSTANCE", + "DELAY", "TIMINGCHECK", "INCLUDE", "ABSOLUTE", "INCREMENT", "USERDEF", + "PATHPULSE", "GLOBALPATHPULSE", "IOPATH", "COND", "PORT", "INTERCONNECT", + "NETDELAY", "DEVICE", "SETUP", "HOLD", "SETUPHOLD", "RECOVERY", "SKEW", + "WIDTH", "PERIOD", "NOCHANGE", "PATHCONSTRAINT", "SUM", "DIFF", + "SKEWCONSTRAINT", "MICROSECOND", "NANOSECOND", "PICOSECOND", "EDGE_01", + "EDGE_10", "EDGE_0z", "EDGE_1z", "EDGE_z0", "EDGE_z1", "EOF_", "')'", + "']'", "$accept", "sdf", "delay_file", "sdf_version", "design_name", + "date", "vendor", "program_name", "program_version", "hierarchy_divider", + "@1", "voltage", "process", "temperature", "time_scale", "ts", "cells", + "cell", "@2", "celltype", "instances", "instance", "string_instance", + "timing_specs", "timing_spec", "@3", "@4", "tcdefs", "tcdef", + "timing_check_condition", "tcheck", "deltypes", "deltype", "@5", "@6", + "absvals", "incvals", "name", "net_instance", "net", "port_instance", + "absval", "conditional_port_expr", "incval", "port_spec", "@7", + "port_path", "port", "port_edge", "value", "double_tc_rvalue", + "tc_rvalue", "rvalue", "exp_list", "rexp_list", "rexpression", + "expression", "real", "preal", "creal", "cpreal", "nstring", "rp", "rb", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short int yytoknum[] = +{ + 0, 256, 257, 258, 259, 63, 58, 260, 261, 262, + 124, 94, 263, 38, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 43, 45, 42, 47, 37, 40, + 91, 33, 126, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, 335, 41, 93 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = +{ + 0, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 107, 106, 108, 108, 109, 110, 110, 111, 111, 111, + 111, 112, 113, 113, 113, 115, 114, 116, 117, 117, + 118, 118, 119, 120, 120, 121, 121, 122, 121, 123, + 121, 124, 124, 125, 125, 126, 127, 127, 127, 127, + 127, 127, 127, 127, 128, 128, 130, 129, 131, 129, + 132, 132, 133, 133, 134, 134, 135, 135, 136, 137, + 137, 138, 138, 138, 138, 138, 138, 138, 139, 140, + 140, 140, 140, 140, 140, 140, 141, 142, 141, 143, + 144, 144, 144, 145, 145, 145, 145, 145, 145, 145, + 145, 146, 146, 147, 148, 148, 149, 149, 150, 150, + 150, 150, 150, 150, 151, 151, 151, 151, 151, 151, + 152, 152, 152, 152, 153, 153, 153, 153, 154, 154, + 154, 155, 155, 156, 156, 157, 157, 158, 158, 159, + 160, 160 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const unsigned char yyr2[] = +{ + 0, 2, 2, 15, 4, 4, 4, 4, 4, 4, + 0, 5, 4, 3, 4, 4, 3, 5, 5, 5, + 3, 1, 2, 1, 0, 0, 8, 4, 3, 2, + 3, 3, 3, 1, 3, 0, 3, 0, 4, 0, + 4, 2, 1, 5, 1, 0, 6, 6, 6, 6, + 6, 5, 5, 6, 2, 1, 0, 5, 0, 5, + 2, 1, 2, 1, 1, 1, 1, 2, 1, 1, + 2, 6, 10, 5, 6, 5, 4, 5, 0, 6, + 10, 5, 6, 5, 4, 5, 1, 0, 3, 1, + 1, 4, 6, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 1, 2, 3, 3, 3, 1, 3, 6, + 9, 12, 15, 18, 3, 6, 9, 12, 15, 18, + 5, 5, 5, 0, 5, 5, 5, 0, 1, 2, + 2, 1, 1, 1, 0, 1, 0, 1, 0, 1, + 1, 1 +}; + +/* 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 unsigned char yydefact[] = +{ + 0, 0, 0, 0, 0, 1, 2, 0, 0, 138, + 0, 0, 137, 0, 138, 0, 0, 139, 4, 0, + 138, 0, 0, 5, 0, 138, 0, 0, 6, 0, + 138, 0, 0, 7, 0, 138, 0, 0, 8, 0, + 10, 0, 0, 9, 0, 134, 0, 0, 0, 0, + 0, 132, 131, 0, 0, 128, 0, 13, 138, 0, + 0, 11, 129, 130, 12, 134, 134, 0, 134, 0, + 24, 133, 0, 0, 0, 14, 0, 16, 0, 0, + 0, 23, 134, 134, 0, 15, 21, 0, 20, 25, + 3, 22, 120, 121, 122, 0, 0, 0, 0, 18, + 17, 19, 0, 0, 0, 0, 0, 0, 35, 0, + 27, 0, 0, 0, 37, 39, 0, 33, 29, 31, + 30, 0, 0, 55, 0, 0, 26, 35, 28, 56, + 58, 36, 54, 0, 0, 42, 44, 0, 34, 0, + 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, + 38, 41, 40, 0, 0, 61, 0, 0, 63, 0, + 90, 0, 89, 0, 0, 87, 0, 86, 0, 0, + 0, 0, 0, 78, 0, 0, 0, 0, 57, 60, + 0, 78, 0, 0, 0, 0, 59, 62, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 123, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 69, 68, 0, + 0, 65, 66, 64, 127, 0, 0, 102, 0, 0, + 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, + 0, 0, 0, 0, 51, 52, 0, 0, 0, 0, + 0, 70, 0, 67, 0, 0, 0, 0, 0, 76, + 0, 0, 123, 0, 107, 0, 0, 0, 84, 141, + 0, 140, 91, 46, 47, 48, 103, 0, 0, 0, + 0, 0, 0, 0, 0, 49, 50, 105, 104, 53, + 0, 0, 73, 32, 0, 75, 108, 136, 101, 136, + 77, 0, 0, 0, 0, 81, 0, 83, 85, 0, + 93, 94, 95, 96, 100, 99, 98, 97, 71, 0, + 74, 127, 135, 0, 0, 0, 79, 0, 114, 106, + 82, 92, 0, 0, 0, 136, 136, 0, 0, 123, + 0, 109, 124, 125, 126, 0, 0, 0, 127, 0, + 115, 72, 0, 80, 123, 110, 0, 127, 116, 0, + 123, 111, 0, 127, 117, 0, 123, 112, 0, 127, + 118, 0, 123, 113, 0, 119 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const short int yydefgoto[] = +{ + -1, 2, 3, 8, 11, 16, 22, 27, 32, 37, + 44, 42, 47, 60, 70, 87, 80, 81, 98, 103, + 108, 109, 205, 116, 117, 124, 125, 134, 135, 159, + 136, 122, 123, 139, 140, 154, 157, 210, 211, 212, + 213, 155, 202, 158, 166, 194, 167, 162, 239, 216, + 229, 230, 263, 217, 264, 53, 255, 54, 55, 56, + 257, 13, 18, 272 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -308 +static const short int yypact[] = +{ + -2, -13, 36, -42, 24, -308, -308, 40, 35, 30, + 45, 81, -308, 21, 30, 67, 88, -308, -308, 21, + 30, 71, 91, -308, 21, 30, 74, 97, -308, 21, + 30, 82, 102, -308, 21, 30, 83, 108, -308, 21, + -308, 94, 111, -308, 113, -6, 99, 134, 21, 52, + 52, -308, -308, 21, 159, -308, 160, -308, 30, 115, + 142, -308, -308, -308, -308, 103, 103, 21, -6, 117, + 148, -308, 172, 175, 183, -308, 21, -308, -32, 136, + 21, 148, 103, 103, 103, -308, -308, 64, -308, -308, + -308, -308, -308, -308, -308, 21, 21, 21, 174, -308, + -308, -308, 149, 184, 176, 156, 21, 54, 124, 187, + -308, 21, 21, 188, -308, -308, 21, 190, 156, -308, + -308, -51, 21, 188, 191, 185, -308, 124, -308, -308, + -308, -308, -308, 283, 21, 191, -308, 21, -308, 203, + 204, -308, 194, 194, 194, 4, 4, 4, 4, 4, + -308, -308, -308, 305, 21, 203, 311, 21, 204, 209, + 211, 4, -308, 4, 4, -308, 4, -308, 4, 213, + 213, 194, 4, -308, 194, -3, 46, 25, -308, -308, + 4, -308, 194, -3, 46, 25, -308, -308, 291, 21, + 210, 213, 213, 213, -18, 213, 213, 162, 21, 21, + 213, 194, 216, 220, 214, 194, -3, -308, 211, 215, + 220, -308, -308, -308, 22, 220, 21, -308, 194, 224, + 227, -3, 227, 227, 21, -308, 0, 21, 21, 21, + 213, 194, 194, 194, 194, 194, 194, 194, 194, -308, + 21, 21, 21, 7, -308, -308, 21, 220, 199, 21, + 21, -308, 220, -308, 21, 21, 17, 251, 21, -308, + 227, 200, 162, 21, -308, 227, 21, 21, -308, -308, + 232, -308, -308, -308, -308, -308, -308, 21, 21, 21, + 21, 21, 21, 21, 21, -308, -308, -308, -308, -308, + 21, 4, -308, -308, 21, -308, 240, 52, -308, 52, + -308, 21, 4, 21, 7, -308, 21, -308, -308, 15, + -308, -308, -308, -308, -308, -308, -308, -308, -308, 194, + -308, 22, -308, 264, 266, 267, -308, 194, 247, -308, + -308, -308, 220, 21, 271, 52, 52, 52, 227, 162, + 21, 250, -308, -308, -308, 21, 21, 21, 22, 21, + 252, -308, 21, -308, 162, 254, 21, 22, 257, 21, + 162, 263, 21, 22, 265, 21, 162, 269, 21, 22, + 274, 21, 162, -308, 21, -308 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const short int yypgoto[] = +{ + -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, + -308, -308, -308, -308, -308, -308, 219, -308, -308, -308, + 177, -308, -71, 153, -308, -308, -308, 161, -308, -308, + 145, 186, -308, -308, -308, 151, -308, 129, -308, 106, + 19, -308, 127, 165, 27, -308, -76, -308, -308, -168, + 119, -48, -214, -308, -308, -61, -307, -44, -47, 146, + -254, 277, -19, 8 +}; + +/* 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 -137 +static const short int yytable[] = +{ + 23, 269, 62, 63, 86, 28, 270, 76, 266, 267, + 33, 129, 130, 65, 333, 38, 269, 224, 49, 50, + 43, 71, 73, 297, 231, 232, 57, 1, -136, 61, + 51, 4, 52, 165, 64, 249, 5, 160, 71, 71, + 94, 352, 254, 323, 160, 325, 301, 258, 75, 77, + 359, 306, 6, 7, 214, 204, 365, 85, 51, 88, + 52, 90, 371, 17, 10, 160, 161, 163, 164, 12, + 233, 234, 235, 236, 237, 238, 99, 100, 101, 290, + 111, 342, 343, 204, 294, 9, 208, 110, 51, 17, + 52, 14, 119, 120, 112, 200, 271, 126, 203, 207, + 207, 207, 17, 131, 204, 209, 220, 207, 207, 207, + 15, 271, 17, 209, 20, 150, 17, 21, 152, 25, + 26, 198, 199, 30, 345, 247, 31, 49, 50, 251, + 207, 36, 35, 251, 40, 178, 242, 41, 186, 51, + 46, 52, 260, 227, 228, 207, 45, 240, 241, 95, + 96, 97, 58, 243, 48, 277, 278, 279, 280, 281, + 282, 283, 284, 59, 340, 65, 66, 256, -134, 68, + 225, 69, 78, 168, 169, 170, 171, 79, 82, 244, + 245, 83, 276, 113, 114, 115, 49, 50, 191, 84, + 192, 193, 89, 195, 206, 196, 215, 259, 51, 201, + 52, 303, 221, 102, 223, 268, 104, 218, 273, 274, + 275, 72, 74, 105, 107, 106, 118, 121, 304, 127, + 133, 285, 286, 287, 288, 252, 137, 289, 92, 93, + 292, 293, 153, 156, 160, 295, 296, 298, 188, 300, + 265, 190, 197, 332, 305, 248, 226, 307, 308, 214, + 322, 338, 324, 261, 250, 208, 262, 299, 310, 311, + 312, 313, 314, 315, 316, 317, 291, 302, 309, 321, + 335, 318, 336, 337, 334, 320, 339, 297, 346, 348, + 138, 354, 326, 357, 328, 329, 360, 330, 322, 322, + 344, 19, 363, 356, 366, 128, 151, 24, 369, 362, + 91, 334, 29, 372, 189, 368, 179, 34, 219, 132, + 334, 374, 39, 222, 341, 253, 334, 331, 319, 246, + 0, 347, 334, 187, 0, 0, 349, 350, 351, 327, + 353, 0, 0, 355, 0, 67, 0, 358, 0, 0, + 361, 0, 0, 364, 0, 0, 367, 0, 0, 370, + 0, 141, 373, 0, 0, 375, 142, 143, 144, 145, + 146, 147, 148, 149, 142, 143, 144, 145, 146, 147, + 148, 149, 172, 173, 174, 175, 176, 177, 180, 181, + 182, 183, 184, 185 +}; + +static const short int yycheck[] = +{ + 19, 1, 49, 50, 36, 24, 6, 68, 222, 223, + 29, 62, 63, 6, 321, 34, 1, 185, 24, 25, + 39, 65, 66, 6, 42, 43, 45, 29, 6, 48, + 36, 44, 38, 29, 53, 203, 0, 40, 82, 83, + 84, 348, 210, 297, 40, 299, 260, 215, 67, 68, + 357, 265, 94, 29, 29, 58, 363, 76, 36, 78, + 38, 80, 369, 95, 29, 40, 142, 143, 144, 39, + 88, 89, 90, 91, 92, 93, 95, 96, 97, 247, + 26, 335, 336, 58, 252, 45, 40, 106, 36, 95, + 38, 46, 111, 112, 40, 171, 96, 116, 174, 175, + 176, 177, 95, 122, 58, 176, 182, 183, 184, 185, + 29, 96, 95, 184, 47, 134, 95, 29, 137, 48, + 29, 169, 170, 49, 338, 201, 29, 24, 25, 205, + 206, 29, 50, 209, 51, 154, 197, 29, 157, 36, + 29, 38, 218, 191, 192, 221, 52, 195, 196, 85, + 86, 87, 53, 197, 41, 231, 232, 233, 234, 235, + 236, 237, 238, 29, 332, 6, 6, 214, 6, 54, + 189, 29, 55, 146, 147, 148, 149, 29, 6, 198, + 199, 6, 230, 59, 60, 61, 24, 25, 161, 6, + 163, 164, 56, 166, 175, 168, 177, 216, 36, 172, + 38, 262, 183, 29, 185, 224, 57, 180, 227, 228, + 229, 65, 66, 29, 58, 39, 29, 29, 262, 29, + 29, 240, 241, 242, 243, 206, 41, 246, 82, 83, + 249, 250, 29, 29, 40, 254, 255, 256, 29, 258, + 221, 30, 29, 319, 263, 29, 36, 266, 267, 29, + 297, 327, 299, 29, 40, 40, 29, 6, 277, 278, + 279, 280, 281, 282, 283, 284, 67, 67, 36, 29, + 6, 290, 6, 6, 321, 294, 29, 6, 339, 29, + 127, 29, 301, 29, 303, 304, 29, 306, 335, 336, + 337, 14, 29, 354, 29, 118, 135, 20, 29, 360, + 81, 348, 25, 29, 159, 366, 155, 30, 181, 123, + 357, 372, 35, 184, 333, 209, 363, 309, 291, 200, + -1, 340, 369, 158, -1, -1, 345, 346, 347, 302, + 349, -1, -1, 352, -1, 58, -1, 356, -1, -1, + 359, -1, -1, 362, -1, -1, 365, -1, -1, 368, + -1, 68, 371, -1, -1, 374, 73, 74, 75, 76, + 77, 78, 79, 80, 73, 74, 75, 76, 77, 78, + 79, 80, 67, 68, 69, 70, 71, 72, 67, 68, + 69, 70, 71, 72 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 29, 98, 99, 44, 0, 94, 29, 100, 45, + 29, 101, 39, 158, 46, 29, 102, 95, 159, 158, + 47, 29, 103, 159, 158, 48, 29, 104, 159, 158, + 49, 29, 105, 159, 158, 50, 29, 106, 159, 158, + 51, 29, 108, 159, 107, 52, 29, 109, 41, 24, + 25, 36, 38, 152, 154, 155, 156, 159, 53, 29, + 110, 159, 155, 155, 159, 6, 6, 158, 54, 29, + 111, 154, 156, 154, 156, 159, 152, 159, 55, 29, + 113, 114, 6, 6, 6, 159, 36, 112, 159, 56, + 159, 113, 156, 156, 154, 85, 86, 87, 115, 159, + 159, 159, 29, 116, 57, 29, 39, 58, 117, 118, + 159, 26, 40, 59, 60, 61, 120, 121, 29, 159, + 159, 29, 128, 129, 122, 123, 159, 29, 117, 62, + 63, 159, 128, 29, 124, 125, 127, 41, 120, 130, + 131, 68, 73, 74, 75, 76, 77, 78, 79, 80, + 159, 124, 159, 29, 132, 138, 29, 133, 140, 126, + 40, 143, 144, 143, 143, 29, 141, 143, 141, 141, + 141, 141, 67, 68, 69, 70, 71, 72, 159, 132, + 67, 68, 69, 70, 71, 72, 159, 140, 29, 127, + 30, 141, 141, 141, 142, 141, 141, 29, 148, 148, + 143, 141, 139, 143, 58, 119, 137, 143, 40, 119, + 134, 135, 136, 137, 29, 137, 146, 150, 141, 139, + 143, 137, 134, 137, 146, 159, 36, 148, 148, 147, + 148, 42, 43, 88, 89, 90, 91, 92, 93, 145, + 148, 148, 152, 154, 159, 159, 147, 143, 29, 146, + 40, 143, 137, 136, 146, 153, 155, 157, 146, 159, + 143, 29, 29, 149, 151, 137, 149, 149, 159, 1, + 6, 96, 160, 159, 159, 159, 148, 143, 143, 143, + 143, 143, 143, 143, 143, 159, 159, 159, 159, 159, + 146, 67, 159, 159, 146, 159, 159, 6, 159, 6, + 159, 149, 67, 152, 154, 159, 149, 159, 159, 36, + 159, 159, 159, 159, 159, 159, 159, 159, 159, 141, + 159, 29, 155, 157, 155, 157, 159, 141, 159, 159, + 159, 160, 143, 153, 155, 6, 6, 6, 143, 29, + 146, 159, 157, 157, 155, 149, 152, 159, 29, 159, + 159, 159, 153, 159, 29, 159, 152, 29, 159, 153, + 29, 159, 152, 29, 159, 153, 29, 159, 152, 29, + 159, 153, 29, 159, 152, 159 +}; + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + +#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; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror ("syntax error: cannot back up");\ + YYERROR; \ + } \ +while (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 (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) +#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, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval) +#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 (0) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_stack_print (short int *bottom, short int *top) +#else +static void +yy_stack_print (bottom, top) + short int *bottom; + short int *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; 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 (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; +#endif +{ + int yyi; + unsigned int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + yyrule - 1, yylno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ +} while (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 + SIZE_MAX < 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. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif +{ + register const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; +} +# 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. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif +{ + register char *yyd = yydest; + register const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +#endif /* !YYERROR_VERBOSE */ + + + +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) +#else +static void +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); +} + +#endif /* ! YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + 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 (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +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; + + register int yystate; + register 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; + + /* 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. */ + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + register short int *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; + + + +#define YYPOPSTACK (yyvsp--, yyssp--) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; + + 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; + + + yyvsp[0] = yylval; + + 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; + short int *yyss1 = yyss; + + + /* 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 ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyoverflowlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + short int *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + 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. */ +/* yyresume: */ + + /* 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; + + /* 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; + + *++yyvsp = yylval; + + + /* 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: + /* 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]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 3: +#line 229 "sdfparse.yy" + {} + break; + + case 4: +#line 234 "sdfparse.yy" + {} + break; + + case 5: +#line 239 "sdfparse.yy" + {} + break; + + case 6: +#line 244 "sdfparse.yy" + {} + break; + + case 7: +#line 249 "sdfparse.yy" + {} + break; + + case 8: +#line 254 "sdfparse.yy" + {} + break; + + case 9: +#line 259 "sdfparse.yy" + {} + break; + + case 10: +#line 263 "sdfparse.yy" + { setParseBlob(); } + break; + + case 11: +#line 264 "sdfparse.yy" + {} + break; + + case 12: +#line 269 "sdfparse.yy" + {} + break; + + case 13: +#line 271 "sdfparse.yy" + {} + break; + + case 14: +#line 276 "sdfparse.yy" + {} + break; + + case 15: +#line 281 "sdfparse.yy" + {} + break; + + case 16: +#line 283 "sdfparse.yy" + {} + break; + + case 17: +#line 288 "sdfparse.yy" + { + /* set time scale for back annotation */ + setTimeScale( (yyvsp[-2].integer) - 9 ); + } + break; + + case 18: +#line 293 "sdfparse.yy" + { + /* set time scale for back annotation */ + setTimeScale( (yyvsp[-2].integer) - 6 ); + } + break; + + case 19: +#line 298 "sdfparse.yy" + { + /* set time scale for back annotation */ + setTimeScale( (yyvsp[-2].integer) - 12 ); + } + break; + + case 20: +#line 303 "sdfparse.yy" + { + /* set default (1ns) time scale for back annotation */ + setTimeScale( -9 ); + } + break; + + case 21: +#line 311 "sdfparse.yy" + { + switch( (yyvsp[0].integer) ) { + case 1: + (yyval.integer) = 0; + break; + case 10: + (yyval.integer) = 1; + break; + case 100: + (yyval.integer) = 2; + break; + default: + sdf_error( "Timescale multiplier must be either 1,10, or 100" ); + (yyval.integer) = 0; + } + } + break; + + case 25: +#line 335 "sdfparse.yy" + { + /* reset current instance */ + resetInstance(); + /* free all allocated strings */ + purgeStrings(); + } + break; + + case 27: +#line 346 "sdfparse.yy" + { + /* set current cell type */ + setCellType( (yyvsp[-1].ptr) ); + } + break; + + case 30: +#line 359 "sdfparse.yy" + { + /* set down thru the hierarchy */ + findInstance( (yyvsp[-1].ptr) ); + } + break; + + case 31: +#line 364 "sdfparse.yy" + { + /* this is a wild card */ + findInstance( "*" ); + } + break; + + case 32: +#line 372 "sdfparse.yy" + { + (yyval.ptr) = (yyvsp[-1].ptr); + } + break; + + case 37: +#line 384 "sdfparse.yy" + {setAbsoluteDelay(TRUE);} + break; + + case 39: +#line 385 "sdfparse.yy" + { setParseBlob(); } + break; + + case 40: +#line 386 "sdfparse.yy" + { + sdflexOpenFile( (yyvsp[-1].ptr) ); + } + break; + + case 43: +#line 399 "sdfparse.yy" + {} + break; + + case 44: +#line 401 "sdfparse.yy" + {} + break; + + case 46: +#line 410 "sdfparse.yy" + { + setConstraint( eSETUP, &(yyvsp[-3].port), &(yyvsp[-2].port), (yyvsp[-1].elist) ); + } + break; + + case 47: +#line 414 "sdfparse.yy" + { + setConstraint( eHOLD, &(yyvsp[-2].port), &(yyvsp[-3].port), (yyvsp[-1].elist) ); + } + break; + + case 48: +#line 418 "sdfparse.yy" + { + setConstraint( eSETUPHOLD, &(yyvsp[-2].port), &(yyvsp[-3].port), (yyvsp[-1].elist) ); + } + break; + + case 49: +#line 422 "sdfparse.yy" + { + setConstraint( eRECOVERY, &(yyvsp[-2].port), &(yyvsp[-3].port), (yyvsp[-1].elist) ); + } + break; + + case 50: +#line 426 "sdfparse.yy" + { + setConstraint( eSKEW, &(yyvsp[-3].port), &(yyvsp[-2].port), (yyvsp[-1].elist) ); + } + break; + + case 51: +#line 430 "sdfparse.yy" + { + setConstraint( eWIDTH, &(yyvsp[-2].port), NULL, (yyvsp[-1].elist) ); + } + break; + + case 52: +#line 434 "sdfparse.yy" + { + setConstraint( ePERIOD, &(yyvsp[-2].port), NULL, (yyvsp[-1].elist) ); + } + break; + + case 53: +#line 438 "sdfparse.yy" + { + setConstraint( eNOCHANGE, &(yyvsp[-3].port), &(yyvsp[-2].port), (yyvsp[-1].elist) ); + } + break; + + case 56: +#line 450 "sdfparse.yy" + { + /* mark delay type as absolute */ + setAbsoluteDelay( TRUE ); + } + break; + + case 58: +#line 456 "sdfparse.yy" + { + /* mark delay type as incremental */ + setAbsoluteDelay( FALSE ); + } + break; + + case 67: +#line 481 "sdfparse.yy" + { + (yyval.port) = (yyvsp[0].port); + (yyval.port).path = (yyvsp[-1].ptr); + } + break; + + case 68: +#line 489 "sdfparse.yy" + { + (yyval.port).path = NULL; + (yyval.port).name = (yyvsp[0].ptr); + (yyval.port).scalar = TRUE; + (yyval.port).edge = accNoEdge; + } + break; + + case 70: +#line 500 "sdfparse.yy" + { + (yyval.port) = (yyvsp[0].port); + (yyval.port).path = (yyvsp[-1].ptr); + } + break; + + case 71: +#line 509 "sdfparse.yy" + { + setConstraint( eIOPATH, &(yyvsp[-3].port), &(yyvsp[-2].port), (yyvsp[-1].elist) ); + } + break; + + case 72: +#line 513 "sdfparse.yy" + { + /* -------- support for COND needs to be added ----------- */ + setConstraint( eIOPATH, &(yyvsp[-4].port), &(yyvsp[-3].port), (yyvsp[-2].elist) ); + } + break; + + case 73: +#line 518 "sdfparse.yy" + { + setConstraint( ePORT, &(yyvsp[-2].port), (port_t*)NULL, (yyvsp[-1].elist) ); + } + break; + + case 74: +#line 522 "sdfparse.yy" + { + setConstraint( eINTERCONNECT, &(yyvsp[-3].port), &(yyvsp[-2].port), (yyvsp[-1].elist) ); + } + break; + + case 75: +#line 526 "sdfparse.yy" + { + setConstraint( eNETDELAY, &(yyvsp[-2].port), (port_t*)NULL, (yyvsp[-1].elist) ); + } + break; + + case 76: +#line 530 "sdfparse.yy" + { + setConstraint( eDEVICE, (port_t*)NULL, (port_t*)NULL, (yyvsp[-1].elist) ); + } + break; + + case 77: +#line 534 "sdfparse.yy" + { + setConstraint( eDEVICE, &(yyvsp[-2].port), (port_t*)NULL, (yyvsp[-1].elist) ); + } + break; + + case 79: +#line 545 "sdfparse.yy" + { + setConstraint( eIOPATH, &(yyvsp[-3].port), &(yyvsp[-2].port), (yyvsp[-1].elist) ); + } + break; + + case 80: +#line 549 "sdfparse.yy" + { + /* -------- support for COND needs to be added ----------- */ + setConstraint( eIOPATH, &(yyvsp[-4].port), &(yyvsp[-3].port), (yyvsp[-2].elist) ); + } + break; + + case 81: +#line 554 "sdfparse.yy" + { + setConstraint( ePORT, &(yyvsp[-2].port), (port_t*)NULL, (yyvsp[-1].elist) ); + } + break; + + case 82: +#line 558 "sdfparse.yy" + { + setConstraint( eINTERCONNECT, &(yyvsp[-3].port), &(yyvsp[-2].port), (yyvsp[-1].elist) ); + } + break; + + case 83: +#line 562 "sdfparse.yy" + { + setConstraint( eNETDELAY, &(yyvsp[-2].port), (port_t*)NULL, (yyvsp[-1].elist) ); + } + break; + + case 84: +#line 566 "sdfparse.yy" + { + setConstraint( eDEVICE, (port_t*)NULL, (port_t*)NULL, (yyvsp[-1].elist) ); + } + break; + + case 85: +#line 570 "sdfparse.yy" + { + setConstraint( eDEVICE, &(yyvsp[-2].port), (port_t*)NULL, (yyvsp[-1].elist) ); + } + break; + + case 87: +#line 576 "sdfparse.yy" + {sdfEnableEdges( TRUE ); } + break; + + case 88: +#line 577 "sdfparse.yy" + { + sdfEnableEdges( FALSE ); + (yyval.port) = (yyvsp[0].port); + } + break; + + case 90: +#line 588 "sdfparse.yy" + { + (yyval.port).path = NULL; + (yyval.port).name = (yyvsp[0].ptr); + (yyval.port).scalar = TRUE; + (yyval.port).edge = accNoEdge; + } + break; + + case 91: +#line 595 "sdfparse.yy" + { + (yyval.port).path = NULL; + (yyval.port).name = (yyvsp[-3].ptr); + (yyval.port).scalar = FALSE; + (yyval.port).msb = (yyvsp[-1].integer); + (yyval.port).lsb = (yyvsp[-1].integer); + (yyval.port).edge = accNoEdge; + } + break; + + case 92: +#line 604 "sdfparse.yy" + { + (yyval.port).path = NULL; + (yyval.port).name = (yyvsp[-5].ptr); + (yyval.port).scalar = FALSE; + (yyval.port).msb = (yyvsp[-3].integer); + (yyval.port).lsb = (yyvsp[-1].integer); + (yyval.port).edge = accNoedge; + } + break; + + case 93: +#line 616 "sdfparse.yy" + { + (yyval.port) = (yyvsp[-1].port); + (yyval.port).edge = accPosedge; + } + break; + + case 94: +#line 621 "sdfparse.yy" + { + (yyval.port) = (yyvsp[-1].port); + (yyval.port).edge = accNegedge; + } + break; + + case 95: +#line 626 "sdfparse.yy" + { + (yyval.port) = (yyvsp[-1].port); + (yyval.port).edge = accEdge01; + } + break; + + case 96: +#line 631 "sdfparse.yy" + { + (yyval.port) = (yyvsp[-1].port); + (yyval.port).edge = accEdge10; + } + break; + + case 97: +#line 636 "sdfparse.yy" + { + (yyval.port) = (yyvsp[-1].port); + (yyval.port).edge = accEdgex1; + } + break; + + case 98: +#line 641 "sdfparse.yy" + { + (yyval.port) = (yyvsp[-1].port); + (yyval.port).edge = accEdgex0; + } + break; + + case 99: +#line 646 "sdfparse.yy" + { + (yyval.port) = (yyvsp[-1].port); + (yyval.port).edge = accEdge1x; + } + break; + + case 100: +#line 651 "sdfparse.yy" + { + (yyval.port) = (yyvsp[-1].port); + (yyval.port).edge = accEdge0x; + } + break; + + case 101: +#line 660 "sdfparse.yy" + { + memset( &(yyval.elist), 0, sizeof((yyval.elist)) ); + (yyval.elist).values[0].triple[0].value = (yyvsp[-1].floating); + (yyval.elist).values[0].triple[0].valid = TRUE; + (yyval.elist).values[0].triple[1].value = (yyvsp[-1].floating); + (yyval.elist).values[0].triple[1].valid = TRUE; + (yyval.elist).values[0].triple[2].value = (yyvsp[-1].floating); + (yyval.elist).values[0].triple[2].valid = TRUE; + (yyval.elist).argCount = 1; + } + break; + + case 103: +#line 675 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-1].elist).values[0]; + (yyval.elist).values[1] = (yyvsp[0].elist).values[0]; + (yyval.elist).argCount = 2; + } + break; + + case 104: +#line 684 "sdfparse.yy" + { + memset( &(yyval.elist), 0, sizeof((yyval.elist)) ); + (yyval.elist).values[0].triple[0].value = (yyvsp[-1].floating); + (yyval.elist).values[0].triple[0].valid = TRUE; + (yyval.elist).values[0].triple[1].value = (yyvsp[-1].floating); + (yyval.elist).values[0].triple[1].valid = TRUE; + (yyval.elist).values[0].triple[2].value = (yyvsp[-1].floating); + (yyval.elist).values[0].triple[2].valid = TRUE; + (yyval.elist).argCount = 1; + } + break; + + case 105: +#line 695 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-1].triple); + (yyval.elist).argCount = 1; + } + break; + + case 106: +#line 703 "sdfparse.yy" + { + memset( &(yyval.elist), 0, sizeof((yyval.elist)) ); + (yyval.elist).values[0].triple[0].value = (yyvsp[-1].floating); + (yyval.elist).values[0].triple[0].valid = TRUE; + (yyval.elist).values[0].triple[1].value = (yyvsp[-1].floating); + (yyval.elist).values[0].triple[1].valid = TRUE; + (yyval.elist).values[0].triple[2].value = (yyvsp[-1].floating); + (yyval.elist).values[0].triple[2].valid = TRUE; + (yyval.elist).argCount = 1; + } + break; + + case 108: +#line 718 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-1].triple); + (yyval.elist).argCount = 1; + } + break; + + case 109: +#line 723 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-4].triple); + (yyval.elist).values[1] = (yyvsp[-1].triple); + (yyval.elist).argCount = 2; + } + break; + + case 110: +#line 729 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-7].triple); + (yyval.elist).values[1] = (yyvsp[-4].triple); + (yyval.elist).values[2] = (yyvsp[-1].triple); + (yyval.elist).argCount = 3; + } + break; + + case 111: +#line 737 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-10].triple); + (yyval.elist).values[1] = (yyvsp[-7].triple); + (yyval.elist).values[2] = (yyvsp[-4].triple); + (yyval.elist).values[3] = (yyvsp[-1].triple); + (yyval.elist).argCount = 4; + } + break; + + case 112: +#line 746 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-13].triple); + (yyval.elist).values[1] = (yyvsp[-10].triple); + (yyval.elist).values[2] = (yyvsp[-7].triple); + (yyval.elist).values[3] = (yyvsp[-4].triple); + (yyval.elist).values[4] = (yyvsp[-1].triple); + (yyval.elist).argCount = 5; + } + break; + + case 113: +#line 756 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-16].triple); + (yyval.elist).values[1] = (yyvsp[-13].triple); + (yyval.elist).values[2] = (yyvsp[-10].triple); + (yyval.elist).values[3] = (yyvsp[-7].triple); + (yyval.elist).values[4] = (yyvsp[-4].triple); + (yyval.elist).values[5] = (yyvsp[-1].triple); + (yyval.elist).argCount = 6; + } + break; + + case 114: +#line 770 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-1].triple); + (yyval.elist).argCount = 1; + } + break; + + case 115: +#line 775 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-4].triple); + (yyval.elist).values[1] = (yyvsp[-1].triple); + (yyval.elist).argCount = 2; + } + break; + + case 116: +#line 781 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-7].triple); + (yyval.elist).values[1] = (yyvsp[-4].triple); + (yyval.elist).values[2] = (yyvsp[-1].triple); + (yyval.elist).argCount = 3; + } + break; + + case 117: +#line 789 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-10].triple); + (yyval.elist).values[1] = (yyvsp[-7].triple); + (yyval.elist).values[2] = (yyvsp[-4].triple); + (yyval.elist).values[3] = (yyvsp[-1].triple); + (yyval.elist).argCount = 4; + } + break; + + case 118: +#line 798 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-13].triple); + (yyval.elist).values[1] = (yyvsp[-10].triple); + (yyval.elist).values[2] = (yyvsp[-7].triple); + (yyval.elist).values[3] = (yyvsp[-4].triple); + (yyval.elist).values[4] = (yyvsp[-1].triple); + (yyval.elist).argCount = 5; + } + break; + + case 119: +#line 808 "sdfparse.yy" + { + (yyval.elist).values[0] = (yyvsp[-16].triple); + (yyval.elist).values[1] = (yyvsp[-13].triple); + (yyval.elist).values[2] = (yyvsp[-10].triple); + (yyval.elist).values[3] = (yyvsp[-7].triple); + (yyval.elist).values[4] = (yyvsp[-4].triple); + (yyval.elist).values[5] = (yyvsp[-1].triple); + (yyval.elist).argCount = 6; + } + break; + + case 120: +#line 821 "sdfparse.yy" + { + (yyval.triple).triple[0].value = (yyvsp[-4].floating); + (yyval.triple).triple[0].valid = TRUE; + (yyval.triple).triple[1] = (yyvsp[-2].creal); + (yyval.triple).triple[2] = (yyvsp[0].creal); + } + break; + + case 121: +#line 828 "sdfparse.yy" + { + (yyval.triple).triple[0] = (yyvsp[-4].creal); + (yyval.triple).triple[1].value = (yyvsp[-2].floating); + (yyval.triple).triple[1].valid = TRUE; + (yyval.triple).triple[2] = (yyvsp[0].creal); + } + break; + + case 122: +#line 835 "sdfparse.yy" + { + (yyval.triple).triple[0] = (yyvsp[-4].creal); + (yyval.triple).triple[1] = (yyvsp[-2].creal); + (yyval.triple).triple[2].value = (yyvsp[0].floating); + (yyval.triple).triple[2].valid = TRUE; + } + break; + + case 123: +#line 842 "sdfparse.yy" + { + (yyval.triple).triple[0].valid = FALSE; + (yyval.triple).triple[1].valid = FALSE; + (yyval.triple).triple[2].valid = FALSE; + } + break; + + case 124: +#line 851 "sdfparse.yy" + { + (yyval.triple).triple[0].value = (yyvsp[-4].floating); + (yyval.triple).triple[0].valid = TRUE; + (yyval.triple).triple[1] = (yyvsp[-2].creal); + (yyval.triple).triple[2] = (yyvsp[0].creal); + } + break; + + case 125: +#line 858 "sdfparse.yy" + { + (yyval.triple).triple[0] = (yyvsp[-4].creal); + (yyval.triple).triple[1].value = (yyvsp[-2].floating); + (yyval.triple).triple[1].valid = TRUE; + (yyval.triple).triple[2] = (yyvsp[0].creal); + } + break; + + case 126: +#line 865 "sdfparse.yy" + { + (yyval.triple).triple[0] = (yyvsp[-4].creal); + (yyval.triple).triple[1] = (yyvsp[-2].creal); + (yyval.triple).triple[2].value = (yyvsp[0].floating); + (yyval.triple).triple[2].valid = TRUE; + } + break; + + case 127: +#line 872 "sdfparse.yy" + { + (yyval.triple).triple[0].valid = FALSE; + (yyval.triple).triple[1].valid = FALSE; + (yyval.triple).triple[2].valid = FALSE; + } + break; + + case 129: +#line 882 "sdfparse.yy" + { (yyval.floating) = (yyvsp[0].floating); } + break; + + case 130: +#line 884 "sdfparse.yy" + { (yyval.floating) = -(yyvsp[0].floating); } + break; + + case 132: +#line 889 "sdfparse.yy" + { (yyval.floating) = (double) (yyvsp[0].integer); } + break; + + case 133: +#line 894 "sdfparse.yy" + { + (yyval.creal).value = (yyvsp[0].floating); + (yyval.creal).valid = TRUE; + } + break; + + case 134: +#line 899 "sdfparse.yy" + { (yyval.creal).valid = FALSE; } + break; + + case 135: +#line 904 "sdfparse.yy" + { + (yyval.creal).value = (yyvsp[0].floating); + (yyval.creal).valid = TRUE; + } + break; + + case 136: +#line 909 "sdfparse.yy" + { (yyval.creal).valid = FALSE; } + break; + + case 138: +#line 915 "sdfparse.yy" + { (yyval.ptr) = ""; } + break; + + case 139: +#line 924 "sdfparse.yy" + { yyerrok; } + break; + + case 140: +#line 929 "sdfparse.yy" + { yyerrok; } + break; + + case 141: +#line 931 "sdfparse.yy" + { yyerrok; } + break; + + + } + +/* Line 1037 of yacc.c. */ +#line 2411 "sdfparse.cc" + + yyvsp -= yylen; + yyssp -= yylen; + + + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + + /* 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 + yyn = yypact[yystate]; + + if (YYPACT_NINF < yyn && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + int yytype = YYTRANSLATE (yychar); + const char* yyprefix; + char *yymsg; + int yyx; + + /* 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; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 0; + + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); + yycount += 1; + if (yycount == 5) + { + yysize = 0; + break; + } + } + yysize += (sizeof ("syntax error, unexpected ") + + yystrlen (yytname[yytype])); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + yyp = yystpcpy (yyp, yytname[yytype]); + + if (yycount < 5) + { + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + yyp = yystpcpy (yyp, yyprefix); + yyp = yystpcpy (yyp, yytname[yyx]); + yyprefix = " or "; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("syntax error; also virtual memory exhausted"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror ("syntax error"); + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* If at end of input, pop the error token, + then the rest of the stack, then return failure. */ + if (yychar == YYEOF) + for (;;) + { + + YYPOPSTACK; + if (yyssp == yyss) + YYABORT; + yydestruct ("Error: popping", + yystos[*yyssp], yyvsp); + } + } + else + { + yydestruct ("Error: discarding", yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + +#ifdef __GNUC__ + /* Pacify GCC when the user code never invokes YYERROR and the label + yyerrorlab therefore never appears in user code. */ + if (0) + goto yyerrorlab; +#endif + +yyvsp -= yylen; + yyssp -= yylen; + 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; + + + yydestruct ("Error: popping", yystos[yystate], yyvsp); + YYPOPSTACK; + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + if (yyn == YYFINAL) + YYACCEPT; + + *++yyvsp = yylval; + + + /* 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: + yydestruct ("Error: discarding lookahead", + yytoken, &yylval); + yychar = YYEMPTY; + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*----------------------------------------------. +| yyoverflowlab -- parser overflow comes here. | +`----------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; +} + + +#line 934 "sdfparse.yy" + + + diff --git a/src/sdfparse.h b/src/sdfparse.h new file mode 100644 index 0000000..78016c4 --- /dev/null +++ b/src/sdfparse.h @@ -0,0 +1,220 @@ +/* A Bison parser, made by GNU Bison 2.0. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 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., 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. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + IF = 258, + ELSE = 259, + OROR = 260, + ANDAND = 261, + ANDANDAND = 262, + XNOR = 263, + CASE_INEQUALITY = 264, + CASE_EQUALITY = 265, + LOGICAL_INEQUALITY = 266, + LOGICAL_EQUALITY = 267, + GE = 268, + GT = 269, + LE = 270, + LT = 271, + RIGHT_SHIFT = 272, + LEFT_SHIFT = 273, + REDUCTION_NOR = 274, + REDUCTION_NAND = 275, + UNARY = 276, + INTEGER = 277, + SCALAR_CONSTANT = 278, + FLOATING = 279, + QSTRING = 280, + IDENTIFIER = 281, + BLOB = 282, + POSEDGE = 283, + NEGEDGE = 284, + DELAYFILE = 285, + SDFVERSION = 286, + DESIGN = 287, + DATE = 288, + VENDOR = 289, + PROGRAM = 290, + VERSION_ = 291, + DIVIDER = 292, + VOLTAGE = 293, + PROCESS = 294, + TEMPERATURE = 295, + TIMESCALE = 296, + CELL = 297, + CELLTYPE = 298, + INSTANCE = 299, + DELAY = 300, + TIMINGCHECK = 301, + INCLUDE = 302, + ABSOLUTE = 303, + INCREMENT = 304, + USERDEF = 305, + PATHPULSE = 306, + GLOBALPATHPULSE = 307, + IOPATH = 308, + COND = 309, + PORT = 310, + INTERCONNECT = 311, + NETDELAY = 312, + DEVICE = 313, + SETUP = 314, + HOLD = 315, + SETUPHOLD = 316, + RECOVERY = 317, + SKEW = 318, + WIDTH = 319, + PERIOD = 320, + NOCHANGE = 321, + PATHCONSTRAINT = 322, + SUM = 323, + DIFF = 324, + SKEWCONSTRAINT = 325, + MICROSECOND = 326, + NANOSECOND = 327, + PICOSECOND = 328, + EDGE_01 = 329, + EDGE_10 = 330, + EDGE_0z = 331, + EDGE_1z = 332, + EDGE_z0 = 333, + EDGE_z1 = 334, + EOF_ = 335 + }; +#endif +#define IF 258 +#define ELSE 259 +#define OROR 260 +#define ANDAND 261 +#define ANDANDAND 262 +#define XNOR 263 +#define CASE_INEQUALITY 264 +#define CASE_EQUALITY 265 +#define LOGICAL_INEQUALITY 266 +#define LOGICAL_EQUALITY 267 +#define GE 268 +#define GT 269 +#define LE 270 +#define LT 271 +#define RIGHT_SHIFT 272 +#define LEFT_SHIFT 273 +#define REDUCTION_NOR 274 +#define REDUCTION_NAND 275 +#define UNARY 276 +#define INTEGER 277 +#define SCALAR_CONSTANT 278 +#define FLOATING 279 +#define QSTRING 280 +#define IDENTIFIER 281 +#define BLOB 282 +#define POSEDGE 283 +#define NEGEDGE 284 +#define DELAYFILE 285 +#define SDFVERSION 286 +#define DESIGN 287 +#define DATE 288 +#define VENDOR 289 +#define PROGRAM 290 +#define VERSION_ 291 +#define DIVIDER 292 +#define VOLTAGE 293 +#define PROCESS 294 +#define TEMPERATURE 295 +#define TIMESCALE 296 +#define CELL 297 +#define CELLTYPE 298 +#define INSTANCE 299 +#define DELAY 300 +#define TIMINGCHECK 301 +#define INCLUDE 302 +#define ABSOLUTE 303 +#define INCREMENT 304 +#define USERDEF 305 +#define PATHPULSE 306 +#define GLOBALPATHPULSE 307 +#define IOPATH 308 +#define COND 309 +#define PORT 310 +#define INTERCONNECT 311 +#define NETDELAY 312 +#define DEVICE 313 +#define SETUP 314 +#define HOLD 315 +#define SETUPHOLD 316 +#define RECOVERY 317 +#define SKEW 318 +#define WIDTH 319 +#define PERIOD 320 +#define NOCHANGE 321 +#define PATHCONSTRAINT 322 +#define SUM 323 +#define DIFF 324 +#define SKEWCONSTRAINT 325 +#define MICROSECOND 326 +#define NANOSECOND 327 +#define PICOSECOND 328 +#define EDGE_01 329 +#define EDGE_10 330 +#define EDGE_0z 331 +#define EDGE_1z 332 +#define EDGE_z0 333 +#define EDGE_z1 334 +#define EOF_ 335 + + + + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 93 "sdfparse.yy" +typedef union YYSTYPE { + int integer; + double floating; + char *ptr; + eScaleType_t etype; + eDelayType_t dtype; + eSDFConstruct_t stype; + eVerilogConstruct_t vtype; + char character; + creal_t creal; + triple_t triple; + elist_t elist; + port_t port; +} YYSTYPE; +/* Line 1318 of yacc.c. */ +#line 212 "sdfparse.h" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + + + diff --git a/src/sdfparse.yy b/src/sdfparse.yy new file mode 100644 index 0000000..3f3cedd --- /dev/null +++ b/src/sdfparse.yy @@ -0,0 +1,935 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* sdfparse.y - BISON/YACC parser for sdf input */ + +%{ +#define YYERROR_VERBOSE + +#include +#include +#include +#include +#include "glue.h" +#include "sdflex.h" +#include "acc_user.h" +#include "veriuser.h" +#include "sdf.h" + +#ifdef __cplusplus + union YYSTYPE; + int sdf_lex (YYSTYPE *); +#endif // __cplusplus + +#define yymaxdepth sdf_maxdepth +#define yyparse sdf_parse +#define yylex sdf_lex +#define yyerror sdf_error +#define yylval sdf_lval +#define yychar sdf_char +#define yydebug sdf_debug +#define yypact sdf_pact +#define yyr1 sdf_r1 +#define yyr2 sdf_r2 +#define yydef sdf_def +#define yychk sdf_chk +#define yypgo sdf_pgo +#define yyact sdf_act +#define yyexca sdf_exca +#define yyerrflag sdf_errflag +#define yynerrs sdf_nerrs +#define yyps sdf_ps +#define yypv sdf_pv +#define yys sdf_s +#define yy_yys sdf_yys +#define yystate sdf_state +#define yytmp sdf_tmp +#define yyv sdf_v +#define yy_yyv sdf_yyv +#define yyval sdf_val +#define yylloc sdf_lloc +#define yyreds sdf_reds +#define yytoks sdf_toks +#define yylhs sdf_yylhs +#define yylen sdf_yylen +#define yydefred sdf_yydefred +#define yydgoto sdf_yydgoto +#define yysindex sdf_yysindex +#define yyrindex sdf_yyrindex +#define yygindex sdf_yygindex +#define yytable sdf_yytable +#define yycheck sdf_yycheck +#define yyname sdf_yyname +#define yyrule sdf_yyrule + +/* Used in BISON.SIM */ +extern char *token_buffer; + + +void initSDFParse() +{ + sdflexInit(); +} + +%} +%pure_parser + +%union { + int integer; + double floating; + char *ptr; + eScaleType_t etype; + eDelayType_t dtype; + eSDFConstruct_t stype; + eVerilogConstruct_t vtype; + char character; + creal_t creal; + triple_t triple; + elist_t elist; + port_t port; +}; + +%nonassoc IF +%nonassoc ELSE + +%right '?' ':' +%left OROR +%left ANDAND +%left ANDANDAND +%left '|' +%left '^' XNOR +%left '&' +%left LOGICAL_EQUALITY LOGICAL_INEQUALITY CASE_EQUALITY CASE_INEQUALITY +%left LT LE GT GE +%left LEFT_SHIFT RIGHT_SHIFT +%left '+' '-' +%left '*' '/' '%' +%left '(' '[' +%right '!' '~' +%right REDUCTION_NOR +%right REDUCTION_NAND +%right UNARY + + +%token INTEGER +%token SCALAR_CONSTANT +%token FLOATING +%token QSTRING +%token IDENTIFIER +%token BLOB + +%token POSEDGE +%token NEGEDGE +%token DELAYFILE +%token SDFVERSION +%token DESIGN +%token DATE +%token VENDOR +%token PROGRAM +%token VERSION_ +%token PROGRAM +%token DIVIDER +%token VOLTAGE +%token PROCESS +%token TEMPERATURE +%token TIMESCALE +%token CELL +%token CELLTYPE +%token INSTANCE +%token DELAY +%token TIMINGCHECK +%token INCLUDE +%token ABSOLUTE +%token INCREMENT +%token USERDEF +%token PATHPULSE +%token GLOBALPATHPULSE +%token IOPATH +%token COND +%token PORT +%token INTERCONNECT +%token NETDELAY +%token DEVICE +%token SETUP +%token HOLD +%token SETUPHOLD +%token RECOVERY +%token SKEW +%token WIDTH +%token PERIOD +%token NOCHANGE +%token PATHCONSTRAINT +%token SUM +%token DIFF +%token SKEWCONSTRAINT +%token MICROSECOND +%token NANOSECOND +%token PICOSECOND +%token EDGE_01 +%token EDGE_10 +%token EDGE_0z +%token EDGE_1z +%token EDGE_z0 +%token EDGE_z1 + + + +%token EOF_ + +%type real +%type preal +%type nstring +%type creal +%type rexpression +%type cpreal +%type expression +%type exp_list +%type rexp_list +%type tc_rvalue +%type double_tc_rvalue +%type value +%type rvalue +%type port +%type port_spec +%type port_path +%type port_instance +%type port_edge +%type name +%type net +%type net_instance +%type string_instance +%type ts + +%% + +sdf + : delay_file EOF_ + ; + +delay_file + : '(' DELAYFILE sdf_version design_name date vendor program_name + program_version hierarchy_divider voltage process + temperature time_scale cells rp + {} + ; + +sdf_version + : '(' SDFVERSION nstring rp + {} + ; + +design_name + : '(' DESIGN nstring rp + {} + ; + +date + : '(' DATE nstring rp + {} + ; + +vendor + : '(' VENDOR nstring rp + {} + ; + +program_name + : '(' PROGRAM nstring rp + {} + ; + +program_version + : '(' VERSION_ nstring rp + {} + ; + +hierarchy_divider + : '(' DIVIDER { setParseBlob(); } BLOB rp + {} + ; + +voltage + : '(' VOLTAGE rexpression rp + {} + | '(' VOLTAGE rp + {} + ; + +process + : '(' PROCESS nstring rp + {} + ; + +temperature + : '(' TEMPERATURE rexpression rp + {} + | '(' TEMPERATURE rp + {} + ; + +time_scale + : '(' TIMESCALE ts NANOSECOND rp + { + /* set time scale for back annotation */ + setTimeScale( $3 - 9 ); + } + | '(' TIMESCALE ts MICROSECOND rp + { + /* set time scale for back annotation */ + setTimeScale( $3 - 6 ); + } + | '(' TIMESCALE ts PICOSECOND rp + { + /* set time scale for back annotation */ + setTimeScale( $3 - 12 ); + } + | '(' TIMESCALE rp + { + /* set default (1ns) time scale for back annotation */ + setTimeScale( -9 ); + } + ; + +ts + : INTEGER + { + switch( $1 ) { + case 1: + $$ = 0; + break; + case 10: + $$ = 1; + break; + case 100: + $$ = 2; + break; + default: + sdf_error( "Timescale multiplier must be either 1,10, or 100" ); + $$ = 0; + } + } + +cells + : cell cells + | cell + | /* NULL */ + ; +cell + : '(' CELL + { + /* reset current instance */ + resetInstance(); + /* free all allocated strings */ + purgeStrings(); + } + celltype '(' instances timing_specs rp + ; + +celltype + : '(' CELLTYPE QSTRING rp + { + /* set current cell type */ + setCellType( $3 ); + } + ; + +instances + : instance '(' instances + | instance '(' + ; + +instance + : INSTANCE IDENTIFIER rp + { + /* set down thru the hierarchy */ + findInstance( $2 ); + } + | INSTANCE '*' rp + { + /* this is a wild card */ + findInstance( "*" ); + } + ; + +string_instance + : INSTANCE IDENTIFIER rp + { + $$ = $2; + } + ; + +timing_specs + : timing_spec + | timing_spec '(' timing_specs + +timing_spec + : /* NULL */ + | DELAY deltypes rp + | TIMINGCHECK {setAbsoluteDelay(TRUE);} tcdefs rp + | INCLUDE { setParseBlob(); } BLOB rp + { + sdflexOpenFile( $3 ); + } + ; + +tcdefs + : tcdef tcdefs + | tcdef + ; + +tcdef + : + '(' COND timing_check_condition tcheck rp + {} + | tcheck + {} + ; + +timing_check_condition + : /* NULL for now */ + ; + +tcheck + : '(' SETUP port_path port_spec tc_rvalue rp + { + setConstraint( eSETUP, &$3, &$4, $5 ); + } + | '(' HOLD port_path port_spec tc_rvalue rp + { + setConstraint( eHOLD, &$4, &$3, $5 ); + } + | '(' SETUPHOLD port_path port_spec double_tc_rvalue rp + { + setConstraint( eSETUPHOLD, &$4, &$3, $5 ); + } + | '(' RECOVERY port_spec port_spec tc_rvalue rp + { + setConstraint( eRECOVERY, &$4, &$3, $5 ); + } + | '(' SKEW port_spec port_spec tc_rvalue rp + { + setConstraint( eSKEW, &$3, &$4, $5 ); + } + | '(' WIDTH port_spec tc_rvalue rp + { + setConstraint( eWIDTH, &$3, NULL, $4 ); + } + | '(' PERIOD port_spec tc_rvalue rp + { + setConstraint( ePERIOD, &$3, NULL, $4 ); + } + | '(' NOCHANGE port_spec port_path double_tc_rvalue rp + { + setConstraint( eNOCHANGE, &$3, &$4, $5 ); + } + ; + +deltypes + : deltype deltypes + | deltype + ; + +deltype + : '(' ABSOLUTE + { + /* mark delay type as absolute */ + setAbsoluteDelay( TRUE ); + } + absvals rp + | '(' INCREMENT + { + /* mark delay type as incremental */ + setAbsoluteDelay( FALSE ); + } + incvals rp + ; + +absvals + : absval absvals + | absval + ; + +incvals + : incval incval + | incval + ; + +name + : port_instance + | net_instance + ; + +net_instance + : net + | string_instance net + { + $$ = $2; + $$.path = $1; + } + ; + +net + : IDENTIFIER + { + $$.path = NULL; + $$.name = $1; + $$.scalar = TRUE; + $$.edge = accNoEdge; + } + ; + +port_instance + : port_path + | string_instance port_path + { + $$ = $2; + $$.path = $1; + } + ; + + +absval + : '(' IOPATH port_spec port_path value rp + { + setConstraint( eIOPATH, &$3, &$4, $5 ); + } + | '(' COND conditional_port_expr '(' IOPATH port_spec port_path value rp rp + { + /* -------- support for COND needs to be added ----------- */ + setConstraint( eIOPATH, &$6, &$7, $8 ); + } + | '(' PORT port_path value rp + { + setConstraint( ePORT, &$3, (port_t*)NULL, $4 ); + } + | '(' INTERCONNECT port_instance port_instance value rp + { + setConstraint( eINTERCONNECT, &$3, &$4, $5 ); + } + | '(' NETDELAY name value rp + { + setConstraint( eNETDELAY, &$3, (port_t*)NULL, $4 ); + } + | '(' DEVICE value rp + { + setConstraint( eDEVICE, (port_t*)NULL, (port_t*)NULL, $3 ); + } + | '(' DEVICE port_instance value rp + { + setConstraint( eDEVICE, &$3, (port_t*)NULL, $4 ); + } + ; + +conditional_port_expr + : /* NULL for now....... */ + ; + +incval + : '(' IOPATH port_spec port_path rvalue rp + { + setConstraint( eIOPATH, &$3, &$4, $5 ); + } + | '(' COND conditional_port_expr '(' IOPATH port_spec port_path rvalue rp rp + { + /* -------- support for COND needs to be added ----------- */ + setConstraint( eIOPATH, &$6, &$7, $8 ); + } + | '(' PORT port_path rvalue rp + { + setConstraint( ePORT, &$3, (port_t*)NULL, $4 ); + } + | '(' INTERCONNECT port_instance port_instance rvalue rp + { + setConstraint( eINTERCONNECT, &$3, &$4, $5 ); + } + | '(' NETDELAY name rvalue rp + { + setConstraint( eNETDELAY, &$3, (port_t*)NULL, $4 ); + } + | '(' DEVICE value rp + { + setConstraint( eDEVICE, (port_t*)NULL, (port_t*)NULL, $3 ); + } + | '(' DEVICE port_instance rvalue rp + { + setConstraint( eDEVICE, &$3, (port_t*)NULL, $4 ); + } + ; +port_spec + : port_path + | '(' {sdfEnableEdges( TRUE ); } port_edge + { + sdfEnableEdges( FALSE ); + $$ = $3; + } + ; +port_path + : port + ; + +port + : IDENTIFIER + { + $$.path = NULL; + $$.name = $1; + $$.scalar = TRUE; + $$.edge = accNoEdge; + } + | IDENTIFIER '[' INTEGER rb + { + $$.path = NULL; + $$.name = $1; + $$.scalar = FALSE; + $$.msb = $3; + $$.lsb = $3; + $$.edge = accNoEdge; + } + | IDENTIFIER '[' INTEGER ':' INTEGER rb + { + $$.path = NULL; + $$.name = $1; + $$.scalar = FALSE; + $$.msb = $3; + $$.lsb = $5; + $$.edge = accNoedge; + } + ; + +port_edge + : POSEDGE port_path rp + { + $$ = $2; + $$.edge = accPosedge; + } + | NEGEDGE port_path rp + { + $$ = $2; + $$.edge = accNegedge; + } + | EDGE_01 port_path rp + { + $$ = $2; + $$.edge = accEdge01; + } + | EDGE_10 port_path rp + { + $$ = $2; + $$.edge = accEdge10; + } + | EDGE_z1 port_path rp + { + $$ = $2; + $$.edge = accEdgex1; + } + | EDGE_z0 port_path rp + { + $$ = $2; + $$.edge = accEdgex0; + } + | EDGE_1z port_path rp + { + $$ = $2; + $$.edge = accEdge1x; + } + | EDGE_0z port_path rp + { + $$ = $2; + $$.edge = accEdge0x; + } + ; + + +value + : '(' preal rp + { + memset( &$$, 0, sizeof($$) ); + $$.values[0].triple[0].value = $2; + $$.values[0].triple[0].valid = TRUE; + $$.values[0].triple[1].value = $2; + $$.values[0].triple[1].valid = TRUE; + $$.values[0].triple[2].value = $2; + $$.values[0].triple[2].valid = TRUE; + $$.argCount = 1; + } + | exp_list + ; + +double_tc_rvalue + : tc_rvalue tc_rvalue + { + $$.values[0] = $1.values[0]; + $$.values[1] = $2.values[0]; + $$.argCount = 2; + } + ; + +tc_rvalue + : '(' real rp + { + memset( &$$, 0, sizeof($$) ); + $$.values[0].triple[0].value = $2; + $$.values[0].triple[0].valid = TRUE; + $$.values[0].triple[1].value = $2; + $$.values[0].triple[1].valid = TRUE; + $$.values[0].triple[2].value = $2; + $$.values[0].triple[2].valid = TRUE; + $$.argCount = 1; + } + | '(' rexpression rp + { + $$.values[0] = $2; + $$.argCount = 1; + } + ; + +rvalue + : '(' real rp + { + memset( &$$, 0, sizeof($$) ); + $$.values[0].triple[0].value = $2; + $$.values[0].triple[0].valid = TRUE; + $$.values[0].triple[1].value = $2; + $$.values[0].triple[1].valid = TRUE; + $$.values[0].triple[2].value = $2; + $$.values[0].triple[2].valid = TRUE; + $$.argCount = 1; + } + | rexp_list + ; + +exp_list + : '(' expression rp + { + $$.values[0] = $2; + $$.argCount = 1; + } + | '(' expression rp '(' expression rp + { + $$.values[0] = $2; + $$.values[1] = $5; + $$.argCount = 2; + } + | '(' expression rp '(' expression rp '(' expression rp + { + $$.values[0] = $2; + $$.values[1] = $5; + $$.values[2] = $8; + $$.argCount = 3; + } + | '(' expression rp '(' expression rp '(' expression rp + '(' expression rp + { + $$.values[0] = $2; + $$.values[1] = $5; + $$.values[2] = $8; + $$.values[3] = $11; + $$.argCount = 4; + } + | '(' expression rp '(' expression rp '(' expression rp + '(' expression rp '(' expression rp + { + $$.values[0] = $2; + $$.values[1] = $5; + $$.values[2] = $8; + $$.values[3] = $11; + $$.values[4] = $14; + $$.argCount = 5; + } + | '(' expression rp '(' expression rp '(' expression rp + '(' expression rp '(' expression rp '(' expression rp + { + $$.values[0] = $2; + $$.values[1] = $5; + $$.values[2] = $8; + $$.values[3] = $11; + $$.values[4] = $14; + $$.values[5] = $17; + $$.argCount = 6; + } + ; + + +rexp_list + : '(' rexpression rp + { + $$.values[0] = $2; + $$.argCount = 1; + } + | '(' rexpression rp '(' rexpression rp + { + $$.values[0] = $2; + $$.values[1] = $5; + $$.argCount = 2; + } + | '(' rexpression rp '(' rexpression rp '(' rexpression rp + { + $$.values[0] = $2; + $$.values[1] = $5; + $$.values[2] = $8; + $$.argCount = 3; + } + | '(' rexpression rp '(' rexpression rp '(' rexpression rp + '(' rexpression rp + { + $$.values[0] = $2; + $$.values[1] = $5; + $$.values[2] = $8; + $$.values[3] = $11; + $$.argCount = 4; + } + | '(' rexpression rp '(' rexpression rp '(' rexpression rp + '(' rexpression rp '(' rexpression rp + { + $$.values[0] = $2; + $$.values[1] = $5; + $$.values[2] = $8; + $$.values[3] = $11; + $$.values[4] = $14; + $$.argCount = 5; + } + | '(' rexpression rp '(' rexpression rp '(' rexpression rp + '(' rexpression rp '(' rexpression rp '(' rexpression rp + { + $$.values[0] = $2; + $$.values[1] = $5; + $$.values[2] = $8; + $$.values[3] = $11; + $$.values[4] = $14; + $$.values[5] = $17; + $$.argCount = 6; + } + ; + +rexpression + : real ':' creal ':' creal + { + $$.triple[0].value = $1; + $$.triple[0].valid = TRUE; + $$.triple[1] = $3; + $$.triple[2] = $5; + } + | creal ':' real ':' creal + { + $$.triple[0] = $1; + $$.triple[1].value = $3; + $$.triple[1].valid = TRUE; + $$.triple[2] = $5; + } + | creal ':' creal ':' real + { + $$.triple[0] = $1; + $$.triple[1] = $3; + $$.triple[2].value = $5; + $$.triple[2].valid = TRUE; + } + | /* NULL */ + { + $$.triple[0].valid = FALSE; + $$.triple[1].valid = FALSE; + $$.triple[2].valid = FALSE; + } + ; + +expression + : preal ':' cpreal ':' cpreal + { + $$.triple[0].value = $1; + $$.triple[0].valid = TRUE; + $$.triple[1] = $3; + $$.triple[2] = $5; + } + | cpreal ':' preal ':' cpreal + { + $$.triple[0] = $1; + $$.triple[1].value = $3; + $$.triple[1].valid = TRUE; + $$.triple[2] = $5; + } + | cpreal ':' cpreal ':' preal + { + $$.triple[0] = $1; + $$.triple[1] = $3; + $$.triple[2].value = $5; + $$.triple[2].valid = TRUE; + } + | /* NULL */ + { + $$.triple[0].valid = FALSE; + $$.triple[1].valid = FALSE; + $$.triple[2].valid = FALSE; + } + ; + +real + : preal + | '+' preal + { $$ = $2; } + | '-' preal + { $$ = -$2; } + ; +preal + : FLOATING + | INTEGER + { $$ = (double) $1; } + ; + +creal + : real + { + $$.value = $1; + $$.valid = TRUE; + } + | /* NULL */ + { $$.valid = FALSE; } + ; + +cpreal + : preal + { + $$.value = $1; + $$.valid = TRUE; + } + | /* NULL */ + { $$.valid = FALSE; } + ; + +nstring + : QSTRING + | /* NULL */ + { $$ = ""; } + ; + +/* +"Important" terminals +*/ + +rp + : ')' + { yyerrok; } + ; + +rb + : ']' + { yyerrok; } + | error + { yyerrok; } + ; + +%% + diff --git a/src/specify.cc b/src/specify.cc new file mode 100644 index 0000000..7586878 --- /dev/null +++ b/src/specify.cc @@ -0,0 +1,1800 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ +/********************************************************************** + * + * specify.c + * - specify block code + * + ********************************************************************** + */ + +#define SPECIFY_C + +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "specify.h" +#include "decl.h" +#include "schedule.h" +#include "parse.h" +#include "acc_user.h" +#include "pli.h" +#include "systask.h" +#include "strobe.h" +#include "gates.h" +#include "io.h" +#include "eval.h" +#include "pass3.h" +#include "store.h" +#include "veriwell.h" +#include "glue.h" +#include "print.h" +#include "copy.h" +#include "timescal.h" + +#define edgeMask(a,b) (edge_mask[(a)][(b)]) +#if 0 // obsolate +unsigned int edge_mask[4][4] = { +/* 0 1 Z X */ +/* 0 */ 0x0000, 0x0002, 0x0008, 0x0008, +/* 1 */ 0x0010, 0x0000, 0x0080, 0x0080, +/* Z */ 0x1000, 0x2000, 0x0000, 0x0000, +/* X */ 0x1000, 0x2000, 0x0000, 0x0000 +}; + +unsigned int posedgeMask = 0x8 | 0x2 | 0x2000; +unsigned int alledgeMask = 0x309a; +unsigned int negedgeMask = 0x80 | 0x10 | 0x1000; +#endif // 0 + +unsigned int edge_mask[4][4] = { +/* 0 1 Z X */ +/* 0 */ accNoedge, accEdge01, accEdge0x, accEdge0x, +/* 1 */ accEdge10, accNoedge, accEdge1x, accEdge1x, +/* Z */ accEdgex0, accEdgex1, accNoedge, accNoedge, +/* X */ accEdgex0, accEdgex1, accNoedge, accNoedge +}; + +unsigned int posedgeMask = accPosedge; +unsigned int alledgeMask = accPosedge + accNegedge; +unsigned int negedgeMask = accNegedge; + + + +extern tree current_scope; +extern struct Marker_info marker_info; +extern Group **R; +extern lineno_t stmt_lineno; +extern lineno_t lineno; +extern char *input_filename; +extern int in_initial; + + +#define minimum(a,b) ((a)>(b)?(b):(a)) +#define maximum(a,b) ((a)<(b)?(b):(a)) + + +/********************************************************************** + * + * check_input_port + * - verify the given identifier is currently defined + * as an input or inout port + * + ********************************************************************** + */ +tree check_input_port(tree identifier) +{ + tree t = IDENT_CURRENT_DECL(identifier); + + /* validate port ref */ + if (!t || DECL_CONTEXT(t) != current_scope /* || + root_port_decl(t) != identifier */ ) { + error("'%s' is not in the port list", IDENT(identifier), + NULL_CHAR); + return (error_mark_node); + } + if (!PORT_INPUT_ATTR(t)) { + error("'%s' is not an input or inout port", IDENT(identifier), + NULL_CHAR); + return (error_mark_node); + } + return (identifier); +} + +/********************************************************************** + * + * check_output_port + * - verify the given identifier is currently defined + * as an output or inout port + * + ********************************************************************** + */ +tree check_output_port(tree identifier) +{ + tree t = IDENT_CURRENT_DECL(identifier); + + /* validate port ref */ + if (!t || DECL_CONTEXT(t) != current_scope /* || + root_port_decl(t) != identifier */ ) { + error("'%s' is not in the port list", IDENT(identifier), + NULL_CHAR); + return (error_mark_node); + } + if (!PORT_OUTPUT_ATTR(t)) { + error("'%s' is not an output or inout port", IDENT(identifier), + NULL_CHAR); + return (error_mark_node); + } + return (identifier); +} + +/********************************************************************** + * + * check_path + * validate path arguments + * + ********************************************************************** + */ +tree check_path(tree path) +{ + runtime_error(path); + + if (PATH_SOURCE(path) != NULL_TREE) { + warning("Edge sensitive paths are not supported in this version", + NULL_CHAR, NULL_CHAR); + if (TREE_CHAIN(PATH_INPUTS(path))) { + error + ("Multiple inputs are not allowed for edge sensitive paths", + NULL_CHAR, NULL_CHAR); + } + } else if (PATH_CONDITION(path) != NULL_TREE) { + warning("Level sensitive paths are not supported in this version", + NULL_CHAR, NULL_CHAR); + } else if (PATH_POLARITY(path) != 0) { + warning("Polarized paths are not supported in this version", + NULL_CHAR, NULL_CHAR); + } else if (PATH_PARALLEL(path)) { + warning("Parallel paths are not supported in this version", + NULL_CHAR, NULL_CHAR); + } +// If you follow the cadence bnf this is correct but..... +// if( PATH_PARALLEL(path) && (TREE_CHAIN(PATH_OUTPUTS(path)) || +// TREE_CHAIN(PATH_INPUTS(path)) ) ) { +// error( "Multiple inputs/outputs are not allowed for with => paths", +// NULL_CHAR, NULL_CHAR ); +// } + + return (path); +} + +/********************************************************************** + * + * specify_save_param_list + * - save specparam list in module + * + ********************************************************************** + */ + +void specify_save_param_list(tree currentModule, tree list) +{ + + tree t; + + /* + convert all PARAM_DECL's to SPECPARAM_DECL's + validate param list: + should not contain any parameter refs in expressions ?????? + */ + + for (t = list; t; t = TREE_CHAIN(t)) { + ASSERT(TREE_CODE(t) == PARAM_DECL); + TREE_SET_CODE(t, SPECPARAM_DECL); + } + + /* append list to spec params of current scope + */ + + MODULE_SPECDEFS(currentModule) = + chainon(list, MODULE_SPECDEFS(currentModule)); + +} + + +/********************************************************************** + * + * build_path( tree inputs, tree outputs, int parallelFlag ) + * - create a PATH_NODE + * + ********************************************************************** + */ + +tree +build_path(tree inputs, tree outputs, tree source, tree delays, + tree condition, int parallelFlag, int edge, int polarity) +{ + tree t; + + ASSERT(parallelFlag == TRUE || parallelFlag == FALSE); + ASSERT(outputs != NULL_TREE); + ASSERT(inputs != NULL_TREE); + ASSERT(edge >= -1 && edge <= 1); + ASSERT(polarity >= -1 && polarity <= 1); + + t = make_node(PATH_NODE); + PATH_SOURCE_LINE(t) = lineno; + PATH_SOURCE_FILE(t) = input_filename; + PATH_SOURCE(t) = source; + PATH_DELAYS(t) = delays; + PATH_INPUTS(t) = inputs; + PATH_OUTPUTS(t) = outputs; + PATH_PARALLEL(t) = parallelFlag; + PATH_EDGE(t) = edge; + PATH_CONDITION(t) = condition; + PATH_POLARITY(t) = polarity; + return (t); +} + +/********************************************************************** + * + * insert_specify_paths( tree module ) + * - validate and insert specify paths + * + ********************************************************************** + */ +void insert_specify_paths(tree module) +{ + tree paths; + tree out_list; + tree out_decl; + tree out_ident; + tree t; + tree gate; + int driver_count; + int msb; + int lsb; + int bitNumber; + tree instance; + int outputNumber; + + + ASSERT(module != NULL_TREE); + for (paths = MODULE_SPECDEFS(module); paths; paths = TREE_CHAIN(paths)) { + if (TREE_CODE(paths) != PATH_NODE) { + continue; + } + runtime_error(paths); + + /* this node is only used by pli to iterate though the modpaths */ + + instance = make_node(PATH_INSTANCE); + PATH_INSTANCE_MODULE(instance) = module; + PATH_INSTANCE_PATHDESC(instance) = paths; + TREE_CHAIN(instance) = MODULE_SPECINST(module); + MODULE_SPECINST(module) = instance; + + outputNumber = 0; + for (out_list = PATH_OUTPUTS(paths); out_list; + out_list = TREE_CHAIN(out_list)) { + t = TREE_PURPOSE(out_list); + ASSERT(t != NULL_TREE); + switch (TREE_CODE(t)) { + case PART_REF: + out_ident = PART_NAME(t); + out_decl = IDENT_CURRENT_DECL(out_ident); + msb = + get_range(PART_MSB_(t), IDENTIFIER_POINTER(out_ident)); + lsb = + get_range(PART_LSB_(t), IDENTIFIER_POINTER(out_ident)); + break; + case BIT_REF: + out_ident = BIT_REF_NAME(t); + out_decl = IDENT_CURRENT_DECL(out_ident); + msb = + get_range(BIT_EXPR(t), IDENTIFIER_POINTER(out_ident)); + lsb = msb; + break; + + + default: + out_ident = t; + out_decl = IDENT_CURRENT_DECL(out_ident); + if (TREE_CODE(out_decl) == NET_VECTOR_DECL) { + msb = MSB(out_decl); + lsb = LSB(out_decl); + } else { + msb = 0; + lsb = 0; + } + break; + } + ASSERT(out_decl != NULL_TREE); + if (lsb > msb) { + int temp; + temp = lsb; + lsb = msb; + msb = temp; + } + for (bitNumber = lsb; bitNumber <= msb; bitNumber++) { + driver_count = get_driver_count(out_decl, bitNumber); + if (driver_count == 0) { + error + ("specify path for net %s does not connect to a gate primitive", + IDENT(out_ident), NULL_CHAR); + continue; + } + if (driver_count > 1) { + error("net %s has more than one driver", + IDENT(out_ident), NULL_CHAR); + return; + } + gate = get_first_driver(out_decl, bitNumber); + ASSERT(gate != NULL_TREE); + if (TREE_CODE(gate) != GATE_INSTANCE) { + warning + ("specify path for net %s does not connect to a gate primitive", + IDENT(out_ident), NULL_CHAR); + return; + } + switch ((int) TREE_TYPE(gate)) { + case GATE_AND_TYPE: + case GATE_NAND_TYPE: + case GATE_OR_TYPE: + case GATE_NOR_TYPE: + case GATE_XOR_TYPE: + case GATE_XNOR_TYPE: + case GATE_BUF_TYPE: + case GATE_NOT_TYPE: + case GATE_BUFIF0_TYPE: + case GATE_BUFIF1_TYPE: + case GATE_NOTIF0_TYPE: + case GATE_NOTIF1_TYPE: + case GATE_NMOS_TYPE: + case GATE_PMOS_TYPE: + case GATE_RNMOS_TYPE: + case GATE_RPMOS_TYPE: + case GATE_CMOS_TYPE: + case GATE_RCMOS_TYPE: + case GATE_UDP_TYPE: + break; + + case GATE_TRAN_TYPE: + case GATE_RTRAN_TYPE: + case GATE_TRANIF0_TYPE: + case GATE_TRANIF1_TYPE: + case GATE_RTRANIF0_TYPE: + case GATE_RTRANIF1_TYPE: + error + ("specify paths cannot be assigned to bidirectional switch\n", + NULL_CHAR, NULL_CHAR); + return; + + case GATE_PULLUP_TYPE: + case GATE_PULLDN_TYPE: + error + ("specify paths cannot be assigned to pullups or pulldowns\n", + NULL_CHAR, NULL_CHAR); + return; + + default: + ASSERT(FALSE); + } + if (TREE_CHAIN(GATE_OUTPUT_LIST(gate)) != NULL_TREE) { + error + ("specify paths cannot be assigned to buf/not gates driving multiple outputs\n", + NULL_CHAR, NULL_CHAR); + return; + } + add_spec_to_gate(module, gate, paths, outputNumber); + outputNumber++; + } + } + } +} + +/********************************************************************** + * + * is_driven_by + * - return TRUE if decl[bit] is driven by gate + * bit is ignore if scalar + * + ********************************************************************** + */ +int is_driven_by(tree driver, tree decl, int bit) +{ + tree t; + tree t1; + int lsb; + int msb; + tree surrogate; + + if (TREE_CODE(driver) != GATE_INSTANCE) { + return (TRUE); + } + for (t = GATE_OUTPUT_LIST(driver); t != NULL_TREE; t = TREE_CHAIN(t)) { + ASSERT(TREE_CODE(t) == TREE_LIST); + t1 = TREE_PURPOSE(t); + switch (TREE_CODE(t1)) { + case BIT_REF: + surrogate = BIT_REF_DECL(t1); + ASSERT(surrogate != NULL_TREE); + if (TREE_CHAIN(surrogate) != decl) { + return (FALSE); + } + msb = get_range(BIT_EXPR(t1), + IDENTIFIER_POINTER(BIT_REF_NAME(t1))); + if (msb == bit) { + return (TRUE); + } + break; + case PART_REF: + surrogate = PART_DECL(t1); + ASSERT(surrogate != NULL_TREE); + if (TREE_CHAIN(surrogate) != decl) { + return (FALSE); + } + msb = get_range(PART_MSB_(t1), + IDENTIFIER_POINTER(PART_NAME(t1))); + lsb = get_range(PART_LSB_(t1), + IDENTIFIER_POINTER(PART_NAME(t1))); + if (bit >= lsb && bit <= msb) { + return (TRUE); + } + break; + default: + surrogate = t1; + ASSERT(surrogate != NULL_TREE); + if (TREE_CHAIN(surrogate) == decl) { + return (TRUE); + } + break; + } + } + return (FALSE); +} + +/********************************************************************** + * + * get_driver_count(tree decl, int bit) + * - count the number of drivers on net given its decl + * + ********************************************************************** + */ + +int get_driver_count(tree decl, int bit) +{ + int count; + tree t; + tree driver; + + ASSERT(decl != NULL_TREE); + count = 0; + for (t = NET_SOURCE(decl); t; t = NET_SOURCE(t)) { + driver = NET_ASSIGNMENT(t); + if (driver != NULL && TREE_CODE(driver) == TREE_LIST && + GATE_TERMINAL_GATE(driver) != NULL && + TREE_CODE(GATE_TERMINAL_GATE(driver)) == GATE_INSTANCE) { + driver = GATE_TERMINAL_GATE(driver); + } + if (driver == NULL || is_driven_by(driver, decl, bit)) { + count++; + } + } + return (count); +} + +/********************************************************************** + * + * get_first_driver(tree decl, bit) + * - return the first driver of the net given its decl + * + ********************************************************************** + */ + +tree get_first_driver(tree decl, int bit) +{ + int count; + tree t; + tree driver; + + ASSERT(decl != NULL_TREE); + for (t = NET_SOURCE(decl); t; t = NET_SOURCE(t)) { + driver = NET_ASSIGNMENT(t); + if (driver != NULL && TREE_CODE(driver) == TREE_LIST && + GATE_TERMINAL_GATE(driver) != NULL && + TREE_CODE(GATE_TERMINAL_GATE(driver)) == GATE_INSTANCE) { + driver = GATE_TERMINAL_GATE(driver); + } + if (driver == NULL || is_driven_by(driver, decl, bit)) { + return (driver); + } + } + return (NULL_TREE); +} + +/********************************************************************** + * + * add_spec_to_gate( tree module, tree driver, tree pathdesc ) + * - add path info to gate + * + * + ********************************************************************** + */ + +void +add_spec_to_gate(tree module, tree gate, tree pathdesc, int outputNumber) +{ + tree t; + tree spec; + + ASSERT(pathdesc != NULL_TREE); + ASSERT(gate != NULL_TREE); + + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + spec = GATE_PATH_OUTPUT(gate); + if (spec == NULL_TREE) { + spec = make_node(PATH_OUTPUT); + PATH_OUTPUT_GATE(spec) = gate; + GATE_PATH_OUTPUT(gate) = spec; + PATH_OUTPUT_VALUE(spec) = X; + PATH_OUTPUT_CURRENT_VALUE(spec) = X; + PATH_OUTPUT_PATHDESC(spec) = NULL_TREE; + PATH_OUTPUT_CONSTRAINTS(spec) = NULL_TREE; + PATH_OUTPUT_SCB(spec) = BuildSCB(spec, NOLIST); + TREE_CHAIN(spec) = MODULE_SPECINST(module); + MODULE_SPECINST(module) = spec; + } + + t = make_node(TREE_LIST); + t->common.sub_label = outputNumber; + TREE_PURPOSE(t) = pathdesc; + TREE_CHAIN(t) = PATH_OUTPUT_PATHDESC(spec); + PATH_OUTPUT_PATHDESC(spec) = t; +// TREE_CHAIN(spec) = MODULE_SPECINST(module); +// MODULE_SPECINST(module) = spec; + + + +} + +/********************************************************************** + * + * pass3_specify( tree spec ) + * - perform pass3 setup on specify path. + * + ********************************************************************** + */ + +void pass3_specify(tree gate) +{ + tree in_list; + tree t; + tree pathdesc; + tree pathdescList; + tree decl; + tree constraint; + tree spec; + tree ref; + tree t1; + tree instance; + + ASSERT(gate != NULL_TREE); + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + spec = GATE_PATH_OUTPUT(gate); + if (spec == NULL_TREE) { + return; + } + pathdescList = PATH_OUTPUT_PATHDESC(spec); + if (pathdescList == NULL_TREE) { + return; + } + + for (; pathdescList; pathdescList = TREE_CHAIN(pathdescList)) { + ASSERT(TREE_CODE(pathdescList) == TREE_LIST); + pathdesc = TREE_PURPOSE(pathdescList); + ASSERT(pathdesc != NULL_TREE); + + /* find instance */ + for (instance = MODULE_SPECINST(GATE_SCOPE(gate)); + instance; instance = TREE_CHAIN(instance)) { + + if (TREE_CODE(instance) != PATH_INSTANCE) { + continue; + } + if (PATH_INSTANCE_PATHDESC(instance) == pathdesc) { + break; + } + } + ASSERT(instance != NULL); + constraint = make_node(PATH_CONSTRAINT); + PATH_CONSTRAINT_OUTPUT_NUMBER(constraint) = + pathdescList->common.sub_label; + PATH_CONSTRAINT_DEPENDENCIES(constraint) = NULL_TREE; + PATH_CONSTRAINT_INSTANCE(constraint) = instance; + PATH_CONSTRAINT_PATHDESC(constraint) = pathdesc; + TREE_CHAIN(constraint) = PATH_OUTPUT_CONSTRAINTS(spec); + PATH_OUTPUT_CONSTRAINTS(spec) = constraint; + runtime_error(pathdesc); + calculate_delays(constraint); + for (in_list = PATH_INPUTS(pathdesc); in_list; + in_list = TREE_CHAIN(in_list)) { + t = make_node(TREE_LIST); + MODPATH_INPUT_TERMINAL_PARENT(t) = constraint; + if (PATH_CONSTRAINT_DEPENDENCIES(constraint) == NULL) { + PATH_CONSTRAINT_DEPENDENCIES(constraint) = t; + } else { + for (t1 = PATH_CONSTRAINT_DEPENDENCIES(constraint); + TREE_CHAIN(t1); t1 = TREE_CHAIN(t1)); + TREE_CHAIN(t1) = t; + } + ref = TREE_PURPOSE(in_list); + ASSERT(ref); + switch (TREE_CODE(ref)) { + case BIT_REF: + TREE_PURPOSE(t) = + build_bit_ref(BIT_REF_NAME(ref), BIT_EXPR(ref)); + ref = TREE_PURPOSE(t); + decl = IDENT_CURRENT_DECL(BIT_REF_NAME(ref)); + BIT_REF_DECL(ref) = decl; + ASSERT(decl != NULL_TREE); + break; + + case PART_REF: + TREE_PURPOSE(t) = + build_part_ref(PART_NAME(ref), PART_MSB_(ref), + PART_LSB_(ref)); + ref = TREE_PURPOSE(t); + decl = IDENT_CURRENT_DECL(PART_NAME(ref)); + PART_DECL(ref) = decl; + ASSERT(decl != NULL_TREE); + break; + + default: + decl = IDENT_CURRENT_DECL(ref); + ASSERT(decl != NULL_TREE); + TREE_PURPOSE(t) = decl; + break; + } + } + } +} + +/********************************************************************** + * + * handle_specify_path + * - check specify path and schedule if needed + * return TRUE if propagation will be handled by + * specify_block node + * + ********************************************************************** + */ + +int handle_specify_path(tree gate) +{ + enum logical_value oldValue; + enum logical_value newValue; + delay_t delay; + tree dependency; + tree constraint; + tree t; + time64 latestTime; + delay_t currentDelay; + tree spec; + BOOL result; + BOOL compareFlag; + + ASSERT(gate != NULL_TREE); + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + spec = GATE_PATH_OUTPUT(gate); + ASSERT(spec != NULL_TREE); + ASSERT(!in_initial); + + + latestTime.timeh = 0; + latestTime.timel = 0; + + result = FALSE; + delay = INT_MAX; + newValue = GATE_OUTPUT(gate); + oldValue = PATH_OUTPUT_CURRENT_VALUE(spec); + ASSERT(PATH_OUTPUT_CONSTRAINTS(spec) != NULL_TREE); + for (constraint = PATH_OUTPUT_CONSTRAINTS(spec); constraint; + constraint = TREE_CHAIN(constraint)) { + ASSERT(TREE_CODE(constraint) == PATH_CONSTRAINT); + ASSERT(PATH_CONSTRAINT_DEPENDENCIES(constraint) != NULL_TREE); + for (t = PATH_CONSTRAINT_DEPENDENCIES(constraint); t; + t = TREE_CHAIN(t)) { + ASSERT(TREE_CODE(t) == TREE_LIST); + dependency = TREE_PURPOSE(t); + ASSERT(dependency != NULL_TREE); + + // this is a hack for now - any bit will activate + switch (TREE_CODE(dependency)) { + case BIT_REF: + dependency = BIT_REF_DECL(dependency); + ASSERT(dependency != NULL_TREE); + break; + case PART_REF: + dependency = PART_DECL(dependency); + ASSERT(dependency != NULL_TREE); + break; + } + if (CMPTIME64(&latestTime, &DECL_UPDATE_TIME(dependency)) < 0) { + ASSIGNTIME64(&latestTime, &DECL_UPDATE_TIME(dependency)); + delay = + PATH_CONSTRAINT_DELAY(constraint, oldValue, newValue); + } else + if (CMPTIME64(&latestTime, &DECL_UPDATE_TIME(dependency)) + == 0) { + currentDelay = + PATH_CONSTRAINT_DELAY(constraint, oldValue, newValue); + if (currentDelay < delay) { + delay = currentDelay; + } + } + + } + } + ADDTIME6432(&latestTime, &latestTime, delay); + compareFlag = CMPTIME64(&latestTime, &CurrentTime); + if (compareFlag >= 0) { + + /* this should work for the wrap around case */ + + delay = latestTime.timel - CurrentTime.timel; + // this is a test kludge +// if( PATH_OUTPUT_VALUE(spec)==PATH_OUTPUT_CURRENT_VALUE(spec) ) { + Schedule(delay, PATH_OUTPUT_SCB(spec), 0); +// } + PATH_OUTPUT_VALUE(spec) = newValue; + result = TRUE; + } else { + PATH_OUTPUT_VALUE(spec) = newValue; + PATH_OUTPUT_CURRENT_VALUE(spec) = newValue; + } + return (result); +} + +/********************************************************************** + * + * propagate_specify_path( tree pc ) + * - pass on specify path output + * + ********************************************************************** + */ +void propagate_specify_path(tree pc) +{ + tree gate; + + ASSERT(pc != NULL_TREE); + ASSERT(TREE_CODE(pc) == PATH_OUTPUT); + gate = PATH_OUTPUT_GATE(pc); + ASSERT(gate != NULL_TREE); + ASSERT(TREE_CODE(gate) == GATE_INSTANCE); + propagate_specify_output(gate, PATH_OUTPUT_VALUE(pc)); + PATH_OUTPUT_CURRENT_VALUE(pc) = PATH_OUTPUT_VALUE(pc); +} + +/********************************************************************** + * + * calculate_delays( tree constraint ) + * - recalculate the delays for path. + * + ********************************************************************** + */ + +void calculate_delays(tree constraint) +{ + int delays[6]; + tree t; + int count; + tree pathdesc; + nbits_t *dummy; + + ASSERT(X >= 0 && X <= 3); + ASSERT(Z >= 0 && Z <= 3); + ASSERT(ONE >= 0 && ONE <= 3); + ASSERT(ZERO >= 0 && ZERO <= 3); + ASSERT(constraint != NULL); + ASSERT(TREE_CODE(constraint) == PATH_CONSTRAINT); + pathdesc = PATH_CONSTRAINT_PATHDESC(constraint); + ASSERT(pathdesc != NULL_TREE); + ASSERT(TREE_CODE(pathdesc) == PATH_NODE); + for (t = PATH_DELAYS(pathdesc), count = 0; t; + t = TREE_CHAIN(t), count++) { + ASSERT(count < 6); + ASSERT(TREE_PURPOSE(t) != NULL_TREE); + delays[count] = get_delay(TREE_PURPOSE(t)); + } + switch (count) { + case 1: + PATH_CONSTRAINT_DELAY(constraint, ZERO, ONE) = delays[0]; + PATH_CONSTRAINT_DELAY(constraint, ONE, ZERO) = delays[0]; + PATH_CONSTRAINT_DELAY(constraint, ZERO, Z) = delays[0]; + PATH_CONSTRAINT_DELAY(constraint, Z, ONE) = delays[0]; + PATH_CONSTRAINT_DELAY(constraint, ONE, Z) = delays[0]; + PATH_CONSTRAINT_DELAY(constraint, Z, ZERO) = delays[0]; + break; + case 2: + PATH_CONSTRAINT_DELAY(constraint, ZERO, ONE) = delays[0]; + PATH_CONSTRAINT_DELAY(constraint, ZERO, Z) = delays[0]; + PATH_CONSTRAINT_DELAY(constraint, Z, ONE) = delays[0]; + + PATH_CONSTRAINT_DELAY(constraint, ONE, Z) = delays[1]; + PATH_CONSTRAINT_DELAY(constraint, Z, ZERO) = delays[1]; + PATH_CONSTRAINT_DELAY(constraint, ONE, ZERO) = delays[1]; + break; + case 3: + PATH_CONSTRAINT_DELAY(constraint, ZERO, ONE) = delays[0]; + PATH_CONSTRAINT_DELAY(constraint, Z, ONE) = delays[0]; + + PATH_CONSTRAINT_DELAY(constraint, ONE, ZERO) = delays[1]; + PATH_CONSTRAINT_DELAY(constraint, Z, ZERO) = delays[1]; + + PATH_CONSTRAINT_DELAY(constraint, ZERO, Z) = delays[2]; + PATH_CONSTRAINT_DELAY(constraint, ONE, Z) = delays[2]; + break; + case 6: + PATH_CONSTRAINT_DELAY(constraint, ZERO, ONE) = delays[0]; + PATH_CONSTRAINT_DELAY(constraint, ONE, ZERO) = delays[1]; + PATH_CONSTRAINT_DELAY(constraint, ZERO, Z) = delays[2]; + PATH_CONSTRAINT_DELAY(constraint, Z, ONE) = delays[3]; + PATH_CONSTRAINT_DELAY(constraint, ONE, Z) = delays[4]; + PATH_CONSTRAINT_DELAY(constraint, Z, ZERO) = delays[5]; + break; + default: + ASSERT(FALSE); + } + setXPathConstraints(constraint); + +} + +/********************************************************************** + * + * setXPathConstraints( tree constraint ) + * - calculate the x delays for paths + * + ********************************************************************** + */ +void setXPathConstraints(tree constraint) +{ + ASSERT(constraint != NULL); + ASSERT(TREE_CODE(constraint) == PATH_CONSTRAINT); + + PATH_CONSTRAINT_DELAY(constraint, ZERO, X) = + minimum(PATH_CONSTRAINT_DELAY(constraint, ZERO, Z), + PATH_CONSTRAINT_DELAY(constraint, ZERO, ONE)); + PATH_CONSTRAINT_DELAY(constraint, ONE, X) = + minimum(PATH_CONSTRAINT_DELAY(constraint, ONE, Z), + PATH_CONSTRAINT_DELAY(constraint, ONE, ZERO)); + PATH_CONSTRAINT_DELAY(constraint, Z, X) = + minimum(PATH_CONSTRAINT_DELAY(constraint, Z, ONE), + PATH_CONSTRAINT_DELAY(constraint, Z, ZERO)); + PATH_CONSTRAINT_DELAY(constraint, X, ZERO) = + maximum(PATH_CONSTRAINT_DELAY(constraint, Z, ZERO), + PATH_CONSTRAINT_DELAY(constraint, ONE, ZERO)); + PATH_CONSTRAINT_DELAY(constraint, X, ONE) = + maximum(PATH_CONSTRAINT_DELAY(constraint, Z, ONE), + PATH_CONSTRAINT_DELAY(constraint, ZERO, ONE)); + PATH_CONSTRAINT_DELAY(constraint, X, Z) = + maximum(PATH_CONSTRAINT_DELAY(constraint, ONE, Z), + PATH_CONSTRAINT_DELAY(constraint, ZERO, Z)); + +} + +/********************************************************************** + * + * specify_update_timings( tree module ) + * - recalculate the delays for paths in module and + * timing checks. + * + ********************************************************************** + */ + +void specify_update_timings(tree module) +{ + tree t; + tree constraint; + + ASSERT(module != NULL_TREE); + ASSERT(TREE_CODE(module) == MODULE_BLOCK); + + for (t = MODULE_SPECINST(module); t; t = TREE_CHAIN(t)) { + if (TREE_CODE(t) == PATH_OUTPUT) { + ASSERT(PATH_OUTPUT_CONSTRAINTS(t) != NULL_TREE); + for (constraint = PATH_OUTPUT_CONSTRAINTS(t); constraint; + constraint = TREE_CHAIN(constraint)) { + ASSERT(TREE_CODE(constraint) == PATH_CONSTRAINT); + calculate_delays(constraint); + } + } else if (TREE_CODE(t) == TIMING_CHECK) { + calculate_params(t); + } + } + +} + +/********************************************************************** + * + * build_timing_event + * - build parse node for an event related to a timing check. + * + ********************************************************************** + */ + +tree build_timing_event(int edge, tree expression, tree condition) +{ + tree t; + + ASSERT(expression != NULL_TREE); + t = make_node(TIMING_EVENT); + TIMING_EVENT_EXPRESSION(t) = expression; + TIMING_EVENT_CONDITION(t) = condition; + TIMING_EVENT_EDGESPEC(t) = edge; + return (t); +} + +/********************************************************************** + * + * build_timing_statement + * - build parse node for a timing check. + * + ********************************************************************** + */ + +tree +build_timing_statement(int checkType, tree event1, tree event2, + tree param1, tree param2, tree notifier) +{ + tree t; + + ASSERT(checkType == SETUP || + checkType == HOLD || + checkType == WIDTH || + checkType == PERIOD || + checkType == SKEW || + checkType == RECOVERY || checkType == SETUPHOLD); + t = make_node(CHECK_SPEC); + CHECK_SPEC_EVENT1(t) = event1; + CHECK_SPEC_EVENT2(t) = event2; + CHECK_SPEC_PARAM1(t) = param1; + CHECK_SPEC_PARAM2(t) = param2; + CHECK_SPEC_NOTIFIER(t) = notifier; + CHECK_SPEC_CHECKTYPE(t) = checkType; + return (t); + +} + +/********************************************************************** + * + * pass3_timing_check( tree check ) + * - perform pass3 setup on timing checks. + * + ********************************************************************** + */ + +void pass3_timing_check(tree check, tree module) +{ + tree event1; + tree event2; + tree condition1; + tree condition2; + unsigned int edgeSpec1; + unsigned int edgeSpec2; + tree expression; + tree timing_check; + unsigned int msb1; + unsigned int msb2; + unsigned int lsb1; + unsigned int lsb2; + tree decl1; + tree decl2; + tree expr1; + tree expr2; + tree notifier; + unsigned int i; + unsigned int j; + unsigned int temp; + + ASSERT(check != NULL_TREE); + ASSERT(TREE_CODE(check) == CHECK_SPEC); + event1 = CHECK_SPEC_EVENT1(check); + ASSERT(event1 != NULL_TREE); + event2 = CHECK_SPEC_EVENT2(check); // note event2 may be null + runtime_error(check); + + if (CHECK_SPEC_NOTIFIER(check)) { +// CHECK_SPEC_NOTIFIER(check) = + notifier = make_notifier(CHECK_SPEC_NOTIFIER(check)); + } else + notifier = NULL_TREE; + + condition1 = TIMING_EVENT_CONDITION(event1); + edgeSpec1 = TIMING_EVENT_EDGESPEC(event1); + if (CHECK_SPEC_CHECKTYPE(check) == WIDTH) { + condition2 = condition1; + edgeSpec2 = edgeSpec1 ^ 0xffff; + } else if (event2) { + condition2 = TIMING_EVENT_CONDITION(event2); + edgeSpec2 = TIMING_EVENT_EDGESPEC(event2); + } else { + condition2 = NULL_TREE; + edgeSpec2 = 0; + } + + expression = TIMING_EVENT_EXPRESSION(event1); + ASSERT(expression != NULL_TREE); + switch (TREE_CODE(expression)) { + case BIT_REF: + decl1 = BIT_REF_DECL(expression); + msb1 = 0; + lsb1 = 0; + break; + case NET_SCALAR_DECL: + msb1 = 0; + lsb1 = 0; + decl1 = expression; + break; + case PART_REF: + decl1 = PART_DECL(expression); + msb1 = get_range(PART_MSB_(expression), + IDENTIFIER_POINTER(DECL_NAME(decl1))); + lsb1 = get_range(PART_LSB_(expression), + IDENTIFIER_POINTER(DECL_NAME(decl1))); + break; + case NET_VECTOR_DECL: + decl1 = expression; + msb1 = MSB(decl1); + lsb1 = LSB(decl1); + break; + default: + ASSERT(FALSE); + } + + decl2 = NULL_TREE; + msb2 = 0; + lsb2 = 0; + if (event2) { + expression = TIMING_EVENT_EXPRESSION(event2); + ASSERT(expression != NULL_TREE); + switch (TREE_CODE(expression)) { + case BIT_REF: + decl2 = BIT_REF_DECL(expression); + msb2 = 0; + lsb2 = 0; + break; + case NET_SCALAR_DECL: + msb2 = 0; + lsb2 = 0; + decl2 = expression; + break; + case PART_REF: + decl2 = PART_DECL(expression); + msb2 = get_range(PART_MSB_(expression), + IDENTIFIER_POINTER(DECL_NAME(decl2))); + lsb2 = get_range(PART_LSB_(expression), + IDENTIFIER_POINTER(DECL_NAME(decl2))); + break; + case NET_VECTOR_DECL: + decl2 = expression; + msb2 = MSB(decl2); + lsb2 = LSB(decl2); + break; + default: + ASSERT(FALSE); + } + } + + if (lsb1 > msb1) { + temp = msb1; + msb1 = lsb1; + lsb1 = temp; + } + if (lsb2 > msb2) { + temp = msb2; + msb2 = lsb2; + lsb2 = temp; + } + + for (i = lsb1; i <= msb1; i++) { + if (lsb1 == msb1) { + expr1 = decl1; + } else { + expr1 = build_bit_ref(decl1, build_int_cst(i)); + } + for (j = lsb2; j <= msb2; j++) { + if (lsb2 == msb2) { + expr2 = decl2; + } else { + expr2 = build_bit_ref(decl2, build_int_cst(j)); + } + timing_check = make_timing_check(module, check, edgeSpec1, + expr1, condition1, edgeSpec2, + expr2, condition2, notifier); + } + } + + + + +} + +/********************************************************************** + * + * make_timing_check + * - build a timing check node in pass3. + * + ********************************************************************** + */ +tree +make_timing_check(tree module, tree check, unsigned int edgespec1, + tree expression1, tree condition1, + unsigned int edgespec2, tree expression2, + tree condition2, tree notifier) +{ + tree t; + time64 zero_time = { 0, 0 }; + Marker *markerList; + + markerList = NULL; + + ASSERT(check != NULL_TREE); + ASSERT(TREE_CODE(check) == CHECK_SPEC); + ASSERT(expression1 != NULL); + + t = make_node(TIMING_CHECK); + + TIMING_CHECK_CONDITION(t, 0) = condition1; + TIMING_CHECK_CONDITION(t, 1) = condition2; + TIMING_CHECK_CURRENTVALUE(t, 0) = X; + TIMING_CHECK_CURRENTVALUE(t, 1) = X; + TIMING_CHECK_CHECKSPEC(t) = check; + TIMING_CHECK_EXPRESSION(t, 0) = build_tree_list(expression1, t); + if (expression2 != NULL) { + TIMING_CHECK_EXPRESSION(t, 1) = build_tree_list(expression2, t); + } else { + TIMING_CHECK_EXPRESSION(t, 1) = NULL; + } + + ASSIGNTIME64(&TIMING_CHECK_CHANGETIME(t, 0), &zero_time); + ASSIGNTIME64(&TIMING_CHECK_CHANGETIME(t, 1), &zero_time); + + + TIMING_CHECK_EDGESPEC(t, 0) = edgespec1; + TIMING_CHECK_EDGESPEC(t, 1) = edgespec2; +// TIMING_CHECK_NOTIFIER(t) = CHECK_SPEC_NOTIFIER(check); + TIMING_CHECK_NOTIFIER(t) = notifier; + TIMING_CHECK_EXPRESSIONCODE(t, 0) = pass3_expr_marker + (expression1, &markerList, (enum marker_flags) (M_FIXED + M_IDLE), + t, NULL_TREE); + if (expression2 != NULL_TREE) { + TIMING_CHECK_EXPRESSIONCODE(t, 1) = pass3_expr_marker + (expression2, &markerList, + (enum marker_flags) (M_FIXED + M_IDLE), t, NULL_TREE); + } else { + TIMING_CHECK_EXPRESSIONCODE(t, 1) = NULL; + } + if (condition1) { + TIMING_CHECK_CONDITIONCODE(t, 0) = pass3_expr(condition1); + if (!check_scalar(condition1)) { + error("the condition clause must be scalar", NULL_CHAR, + NULL_CHAR); + } + } else { + TIMING_CHECK_CONDITIONCODE(t, 0) = NULL; + } + if (condition2) { + TIMING_CHECK_CONDITIONCODE(t, 1) = pass3_expr(condition2); + if (!check_scalar(condition2)) { + error("the condition clause must be scalar", NULL_CHAR, + NULL_CHAR); + } + } else { + TIMING_CHECK_CONDITIONCODE(t, 1) = NULL; + } + calculate_params(t); + + + ASSERT(module != NULL_TREE); + ASSERT(TREE_CODE(module) == MODULE_BLOCK); + TREE_CHAIN(t) = MODULE_SPECINST(module); + MODULE_SPECINST(module) = t; + TIMING_CHECK_MODULE(t) = module; + return (t); + +} + +/********************************************************************** + * + * make_notifier + * - create notifier node. + * + ********************************************************************** + */ +tree make_notifier(tree ident) +{ + tree decl; + tree notifier; + + ASSERT(ident != NULL_TREE); + ASSERT(TREE_CODE(ident) == IDENTIFIER_NODE); + decl = IDENT_CURRENT_DECL(ident); + ASSERT(decl != NULL_TREE); + if (TREE_CODE(decl) != REG_SCALAR_DECL) { + error("%s must be a single bit register", IDENT(ident), NULL_CHAR); + return (error_mark_node); + } + notifier = make_node(NOTIFIER_NODE); + NOTIFIER_DECL(notifier) = decl; + NOTIFIER_TIMESTAMP(notifier).timel = 0; + NOTIFIER_TIMESTAMP(notifier).timeh = 0; + return (notifier); +} + +/********************************************************************** + * + * calculate_params( tree timing_check ) + * - recalculate timing check parameters. + * + ********************************************************************** + */ +void calculate_params(tree t) +{ + tree check; + nbits_t *dummy; + + ASSERT(t != NULL_TREE); + ASSERT(TREE_CODE(t) == TIMING_CHECK); + check = TIMING_CHECK_CHECKSPEC(t); + ASSERT(check != NULL_TREE); + ASSERT(TREE_CODE(check) == CHECK_SPEC); + TIMING_CHECK_PARAM1(t) = get_delay(CHECK_SPEC_PARAM1(check)); + if (TIMING_CHECK_PARAM1(t) < 0) { + TIMING_CHECK_PARAM1(t) = 0; + } + if (CHECK_SPEC_PARAM2(check)) { + TIMING_CHECK_PARAM2(t) = get_delay(CHECK_SPEC_PARAM2(check)); + if (TIMING_CHECK_PARAM2(t) < 0) { + TIMING_CHECK_PARAM2(t) = 0; + } + } +} + +/********************************************************************** + * + * check_scalar + * - verify the given node is scalar + * + ********************************************************************** + */ +int check_scalar(tree node) +{ + tree t; + + t = node; + ASSERT(node != NULL_TREE); + if (TREE_CODE(t) == IDENTIFIER) { + t = IDENT_CURRENT_DECL(node); + ASSERT(t != NULL_TREE); + } + + if (TREE_CODE(t) != NET_SCALAR_DECL && TREE_NBITS(t) != 1) { + return (FALSE); + } + return (TRUE); +} + + +/********************************************************************** + * + * check_one_bit_constant + * - verify the given node is a one bit constant + * + ********************************************************************** + */ +tree check_one_bit_constant(tree constant) +{ + ASSERT(constant != NULL_TREE); + ASSERT(TREE_CODE(constant) == INTEGER_CST + || TREE_CODE(constant) == BIT_CST); + if (TREE_CODE(constant) == INTEGER_CST) { + if (INT_CST_DATA(constant) != 0 && INT_CST_DATA(constant) != 1) { + error("expecting a single bit constant", NULL_CHAR, NULL_CHAR); + return (error_mark_node); + } + } else { + if (TREE_NBITS(constant) != 1 || !TREE_CONSTANT_ATTR(constant)) { + error("expecting a single bit constant", NULL_CHAR, NULL_CHAR); + return (error_mark_node); + } + } + return (constant); +} + +/********************************************************************** + * + * timingCheck + * - perform timing check + * + ********************************************************************** + */ + + +void timingCheck(tree node) +{ + enum logical_value bit1; + enum logical_value bit2; + enum logical_value was_bit1; + enum logical_value was_bit2; + int event1; + int event2; + int result; + tree check; + char *name; + + ASSERT(TREE_CODE(node) == TIMING_CHECK); + check = TIMING_CHECK_CHECKSPEC(node); + ASSERT(check != NULL_TREE); + was_bit1 = (enum logical_value) TIMING_CHECK_CURRENTVALUE(node, 0); + was_bit2 = (enum logical_value) TIMING_CHECK_CURRENTVALUE(node, 1); + bit1 = eval_bit(TIMING_CHECK_EXPRESSIONCODE(node, 0)); + if (TIMING_CHECK_EXPRESSIONCODE(node, 1)) { + bit2 = eval_bit(TIMING_CHECK_EXPRESSIONCODE(node, 1)); + } else { + bit2 = bit1; + } + + if (was_bit1 != bit1 && + (edgeMask(was_bit1, bit1) & TIMING_CHECK_EDGESPEC(node, 0)) && + (TIMING_CHECK_CONDITIONCODE(node, 0) == NULL || + test(TIMING_CHECK_CONDITIONCODE(node, 0)))) { + event1 = TRUE; + } else { + event1 = FALSE; + } + + if (was_bit2 != bit2 && + (edgeMask(was_bit2, bit2) & TIMING_CHECK_EDGESPEC(node, 1)) && + (TIMING_CHECK_CONDITIONCODE(node, 1) == NULL || + test(TIMING_CHECK_CONDITIONCODE(node, 1)))) { + event2 = TRUE; + } else { + event2 = FALSE; + } + + switch (CHECK_SPEC_CHECKTYPE(check)) { + case SETUP: + name = "setup"; + result = setupCheck(node, event1, event2); + break; + case HOLD: + name = "hold"; + result = holdCheck(node, event1, event2); + break; + case WIDTH: + name = "width"; + result = widthCheck(node, event1, event2); + break; + case PERIOD: + name = "period"; + result = periodCheck(node, event1, event2); + break; + case SKEW: + name = "skew"; + result = skewCheck(node, event1, event2); + break; + case RECOVERY: + name = "recovery"; + result = recoveryCheck(node, event1, event2); + break; + case SETUPHOLD: + name = "setuphold"; + result = setupholdCheck(node, event1, event2); + break; + default: + ASSERT(FALSE); + return; + } + + if (!result) { + printf_V(" \"%s\", %d: Timing violation in ", + STMT_SOURCE_FILE(check), STMT_SOURCE_LINE(check)); + print_scope((handle_t) 1, TIMING_CHECK_MODULE(node)); + printf_V("\n$%s( ", name); + trace_timing_event(TIMING_EVENT_EXPRESSION + (CHECK_SPEC_EVENT1(check)), + TIMING_CHECK_EDGESPEC(node, 0), + TIMING_EVENT_CONDITION(CHECK_SPEC_EVENT1 + (check))); + printf_V(":"); + if (CHECK_SPEC_CHECKTYPE(check) == SETUPHOLD && event1) { + print_time(&CurrentTime); + } else if (CHECK_SPEC_CHECKTYPE(check) == HOLD && event1) { + print_time(&CurrentTime); + } else { + print_time(&TIMING_CHECK_CHANGETIME(node, 0)); + } + + printf_V(", "); + if (TIMING_CHECK_EXPRESSIONCODE(node, 1)) { + trace_timing_event(TIMING_EVENT_EXPRESSION + (CHECK_SPEC_EVENT2(check)), + TIMING_CHECK_EDGESPEC(node, 1), + TIMING_EVENT_CONDITION(CHECK_SPEC_EVENT2 + (check))); + } + printf_V(":"); + if (CHECK_SPEC_CHECKTYPE(check) == SETUPHOLD && !event2) { + print_time(&TIMING_CHECK_CHANGETIME(node, 1)); + } else { + print_time(&CurrentTime); + } + + if (CHECK_SPEC_PARAM1(check)) { + printf_V(", "); + print_expr(CHECK_SPEC_PARAM1(check)); + printf_V(":%d", TIMING_CHECK_PARAM1(node)); + } + if (CHECK_SPEC_PARAM2(check)) { + printf_V(", "); + print_expr(CHECK_SPEC_PARAM2(check)); + printf_V(":%d", TIMING_CHECK_PARAM2(node)); + } + + printf_V(" );\n"); + if (TIMING_CHECK_NOTIFIER(node)) { + toggle_notifier(TIMING_CHECK_NOTIFIER(node)); + } + } + + if (event1) { + ASSIGNTIME64(&TIMING_CHECK_CHANGETIME(node, 0), &CurrentTime); + } + if (event2) { + ASSIGNTIME64(&TIMING_CHECK_CHANGETIME(node, 1), &CurrentTime); + } + TIMING_CHECK_CURRENTVALUE(node, 0) = bit1; + TIMING_CHECK_CURRENTVALUE(node, 1) = bit2; +} + +/********************************************************************** + * + * toggle_notifier + * - toggle notifier expression + * + ********************************************************************** + */ + +void toggle_notifier(tree notifier) +{ + Group *g; + tree decl; + + ASSERT(notifier != NULL_TREE); + /* only allow notifier to be toggled once a tick */ + if (CMPTIME64(&NOTIFIER_TIMESTAMP(notifier), &CurrentTime) == 0) { + return; + } + NOTIFIER_TIMESTAMP(notifier) = CurrentTime; + decl = NOTIFIER_DECL(notifier); + ASSERT(decl != NULL_TREE); + eval_1(decl); + g = *(R - 1); + if (BVAL(g) & 1) { + if (AVAL(g) & 1) { + AVAL(g) = 0; + BVAL(g) = 0; + } + } else { + AVAL(g) = AVAL(g) ^ 1; + } + store(decl, notifier); +} + +/********************************************************************** + * + * eval_bit + * - evaluate a 1 bit expression + * + ********************************************************************** + */ + +static enum logical_value eval_bit(tree * code) +{ + Group *g; + int result; + + ASSERT(code != NULL); + eval(code); + + g = *--R; + result = ((BVAL(g) & 0x1) << 1) | (AVAL(g) & 0x1); + return ((enum logical_value) result); + +} + +/********************************************************************** + * + * setupCheck + * - perform setup timing check + * returns TRUE on pass. + ********************************************************************** + */ +int setupCheck(tree node, int event1, int event2) +{ + time64 time; + + if (event2) { + ASSIGNTIME64(&time, &TIMING_CHECK_CHANGETIME(node, 0)); + if (time.timel == 0 && time.timeh == 0) { + return (TRUE); + } + ADDTIME6432(&time, &time, TIMING_CHECK_PARAM1(node)); + if (CMPTIME64(&time, &CurrentTime) > 0) { + return (FALSE); + } + } + return (TRUE); + +} + + +/********************************************************************** + * + * holdCheck + * - perform hold timing check + * returns TRUE on pass. + ********************************************************************** + */ +int holdCheck(tree node, int event1, int event2) +{ + time64 time; + int zeroHoldCheck; + + if (event2) { + ASSIGNTIME64(&time, &TIMING_CHECK_CHANGETIME(node, 0)); + if (time.timel == 0 && time.timeh == 0) { + return (TRUE); + } + zeroHoldCheck = TIMING_CHECK_PARAM1(node) == 0; + ADDTIME6432(&time, &time, TIMING_CHECK_PARAM1(node)); + if ((event1 && !zeroHoldCheck) + || (CMPTIME64(&time, &CurrentTime) > 0)) { + return (FALSE); + } + } + return (TRUE); + +} + +/********************************************************************** + * + * widthCheck + * - perform width timing check + * returns TRUE on pass. + ********************************************************************** + */ +int widthCheck(tree node, int event1, int event2) +{ + time64 time; + + if (event2) { + ASSIGNTIME64(&time, &TIMING_CHECK_CHANGETIME(node, 0)); + if (time.timel == 0 && time.timeh == 0) { + return (TRUE); + } + ADDTIME6432(&time, &time, TIMING_CHECK_PARAM1(node)); + if (CMPTIME64(&time, &CurrentTime) > 0) { + return (FALSE); + } + } + return (TRUE); + +} + +/********************************************************************** + * + * periodCheck + * - perform period timing check + * returns TRUE on pass. + ********************************************************************** + */ +int periodCheck(tree node, int event1, int event2) +{ + time64 time; + + if (event1) { + ASSIGNTIME64(&time, &TIMING_CHECK_CHANGETIME(node, 0)); + if (time.timel == 0 && time.timeh == 0) { + return (TRUE); + } + ADDTIME6432(&time, &time, TIMING_CHECK_PARAM1(node)); + if (CMPTIME64(&time, &CurrentTime) > 0) { + return (FALSE); + } + } + return (TRUE); + +} + +/********************************************************************** + * + * skewCheck + * - perform skew timing check + * returns TRUE on pass. + ********************************************************************** + */ +int skewCheck(tree node, int event1, int event2) +{ + time64 time; + + if (event2) { + ASSIGNTIME64(&time, &TIMING_CHECK_CHANGETIME(node, 0)); + if (time.timel == 0 && time.timeh == 0) { + return (TRUE); + } + ADDTIME6432(&time, &time, TIMING_CHECK_PARAM1(node)); + if ((CMPTIME64(&time, &CurrentTime) < 0)) { + return (FALSE); + } + } + return (TRUE); + +} + +/********************************************************************** + * + * recoveryCheck + * - perform recovery timing check + * returns TRUE on pass. + ********************************************************************** + */ +int recoveryCheck(tree node, int event1, int event2) +{ + time64 time; + + if (event2) { + ASSIGNTIME64(&time, &TIMING_CHECK_CHANGETIME(node, 0)); + if (time.timel == 0 && time.timeh == 0) { + return (TRUE); + } + ADDTIME6432(&time, &time, TIMING_CHECK_PARAM1(node)); + if (CMPTIME64(&time, &CurrentTime) > 0) { + return (FALSE); + } + } + return (TRUE); + +} + +/********************************************************************** + * + * setupholdCheck + * - perform setuphold timing check + * returns TRUE on pass. + ********************************************************************** + */ +int setupholdCheck(tree node, int event1, int event2) +{ + time64 time; + int zeroHoldCheck; + + if (event1) { + ASSIGNTIME64(&time, &TIMING_CHECK_CHANGETIME(node, 1)); + if (time.timel == 0 && time.timeh == 0) { + goto skip; + } + ADDTIME6432(&time, &time, TIMING_CHECK_PARAM1(node)); + if (CMPTIME64(&time, &CurrentTime) > 0) { + return (FALSE); + } + } + skip: + if (event2) { + ASSIGNTIME64(&time, &TIMING_CHECK_CHANGETIME(node, 0)); + if (time.timel == 0 && time.timeh == 0) { + goto skip1; + } + zeroHoldCheck = TIMING_CHECK_PARAM2(node) == 0; + ADDTIME6432(&time, &time, TIMING_CHECK_PARAM2(node)); + if ((event1 && !zeroHoldCheck) + || (CMPTIME64(&time, &CurrentTime) > 0)) { + return (FALSE); + } + } + skip1: + return (TRUE); + +} + +/********************************************************************** + * + * trace_timing_event + * - print out trace of timing event + ********************************************************************** + */ +void trace_timing_event(tree event, unsigned int edge, tree condition) +{ + int first; + + ASSERT(event != NULL_TREE); + if (edge == posedgeMask) { + printf_V("(posedge "); + print_expr(event); + printf_V(")"); + } else if (edge == negedgeMask) { + printf_V("(negedge "); + print_expr(event); + printf_V(")"); + } else if (edge == alledgeMask) { + print_expr(event); + } else { + first = TRUE; + printf_V("edge["); + if (edgeMask(0, X) & edge) { + if (!first) { + printf_V(","); + } + printf_V("0x"); + first = FALSE; + } + if (edgeMask(0, 1) & edge) { + if (!first) { + printf_V(","); + } + printf_V("01"); + first = FALSE; + } + if (edgeMask(X, 1) & edge) { + if (!first) { + printf_V(","); + } + printf_V("x1"); + first = FALSE; + } + if (edgeMask(X, 0) & edge) { + if (!first) { + printf_V(","); + } + printf_V("x0"); + first = FALSE; + } + if (edgeMask(1, 0) & edge) { + if (!first) { + printf_V(","); + } + printf_V("10"); + first = FALSE; + } + if (edgeMask(1, X) & edge) { + if (!first) { + printf_V(","); + } + printf_V("1x"); + first = FALSE; + } + printf_V("] "); + print_expr(event); + } + if (condition) { + printf_V("&&&("); + print_expr(condition); + printf_V(")"); + } +} diff --git a/src/specify.h b/src/specify.h new file mode 100644 index 0000000..a516b72 --- /dev/null +++ b/src/specify.h @@ -0,0 +1,88 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + + +/********************************************************************** + * + * specify.h + * - header file for specify block code + * + ********************************************************************** + */ + + +#ifndef SPECIFY_H +#define SPECIFY_H + + + +// public prototypes + +void specify_save_param_list(tree scope, tree list); +tree build_path(tree inputs, tree outputs, tree source, tree delays, + tree condition, int parallelFlag, int edge, int polarity); +tree check_input_port(tree identifier); +tree check_output_port(tree identifier); +tree check_path(tree path); +void insert_specify_paths(tree module); +tree get_first_driver(tree decl, int bit); +int get_driver_count(tree decl, int bit); +int is_driven_by(tree gate, tree decl, int bit); +void add_spec_to_gate(tree module, tree driver, tree pathdesc, + int outputNumber); +void pass3_specify(tree spec); +int handle_specify_path(tree gate); +void propagate_specify_path(tree pc); +void calculate_delays(tree constraint); +void specify_update_timings(tree module); +tree build_timing_statement(int checkType, tree event1, tree event2, + tree param1, tree param2, tree notifier); + +tree build_timing_event(int edge, tree expression, tree condition); +void pass3_timing_check(tree check, tree module); +tree make_timing_check(tree module, tree check, unsigned int edgeSpec1, + tree expression1, tree condition1, + unsigned int edgeSpec2, tree expression2, + tree condition2, tree notifier); +int check_scalar(tree node); +tree check_one_bit_constant(tree constant); +void validate_timing_checks(tree module); +void timing_check(tree node); +int setupCheck(tree node, int event1, int event2); +int holdCheck(tree node, int event1, int event2); +int widthCheck(tree node, int event1, int event2); +int periodCheck(tree node, int event1, int event2); +int skewCheck(tree node, int event1, int event2); +int recoveryCheck(tree node, int event1, int event2); +int setupholdCheck(tree node, int event1, int event2); +void trace_timing_event(tree event, unsigned int edge, tree condition); +void calculate_params(tree timing_check); +tree make_notifier(tree ident); +void toggle_notifier(tree notifier); +void timingCheck(tree node); +void setXPathConstraints(tree constraint); + +// private methods +#ifdef SPECIFY_C + +static enum logical_value eval_bit(tree * code); + +#endif // SPECIFY_C + +#endif // SPECIFY_H diff --git a/src/store.cc b/src/store.cc new file mode 100644 index 0000000..57c6930 --- /dev/null +++ b/src/store.cc @@ -0,0 +1,529 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* STORE.C - Routines for storing results of expressions */ + +#define STORE_C + +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "schedule.h" +#include "eval.h" +#include "runtime.h" +#include "flags.h" +#include "store.h" +#include "veriwell.h" + + +int store_computeOnly = 0; +int store_useCached = 0; +SCB *store_scb = 0; + +void store_array(tree decl, Bit index) +{ +// tree decl = ARRAY_REF_DECL (lval); + ngroups_t array_hi = ARRAY_HI(decl); + ngroups_t array_lo = ARRAY_LO(decl); +// Bit aval = AVAL (g1); + Group *g1, *g2; + ngroups_t ngroups = 1 + bits_to_groups(TREE_NBITS(decl)); + ngroups_t offset, i; + nbits_t nbits; + int cond = 0; + + if (VECTOR_DIRECTION_ATTR(decl)) { + if (index < array_lo || index > array_hi) + cond = X; + else { + offset = (index - array_lo) * ngroups; + } + } else { + if (index < array_hi || index > array_lo) + cond = X; + else { + offset = (index - array_hi) * ngroups; + } + } + + g2 = *--R; + if (!cond) + g1 = DECL_STORAGE(decl) + offset; + else + return; + +// nbits = TREE_NBITS (lval); + nbits = TREE_NBITS(decl); + ngroups = bits_to_groups(nbits); + + for (i = 1; i <= ngroups; i++, g1++, g2++) { + if (!cond) { + AVAL(g1) = AVAL(g2); + BVAL(g1) = BVAL(g2); + } else { + AVAL(g1) = (Bit) - 1; + BVAL(g1) = (Bit) - 1; + } + } + if (!cond) { + AVAL(g1) = AVAL(g2) & mask_right1[nbits & NBITS_MASK]; + BVAL(g1) = BVAL(g2) & mask_right1[nbits & NBITS_MASK]; + } else { + AVAL(g1) = (Bit) - 1 & mask_right1[nbits & NBITS_MASK]; + BVAL(g1) = (Bit) - 1 & mask_right1[nbits & NBITS_MASK]; + } +} + +static int deferred = 0; /* set during the storing of concats */ + +void notify(tree LVAL, enum logical_value STATE, int CHANGED, tree pc) +{ +/* Currently, pc is null only on PLI calls to here */ + if (pc) { + DECL_UPDATE_FILE(LVAL) = STMT_SOURCE_FILE(pc); + DECL_UPDATE_LINE(LVAL) = STMT_SOURCE_LINE(pc); + } + ASSIGNTIME64(&DECL_UPDATE_TIME(LVAL), &CurrentTime); + if (DECL_EVENT_CHAIN(LVAL) && (CHANGED)) + NotifyEvent(DECL_EVENT_CHAIN(LVAL), STATE, deferred); +} + +// ??? mdh - delay part selects and arrays need to be fixed +void store(tree lval, tree pc) +{ + enum tree_code lval_code; + Group *g1, *g2; + Bit a, b, current_a, current_b, save_R_mask; + int cond; + int changed; + ngroups_t i, ngroups, save_R_ngroups; + nbits_t nbits, save_R_nbits; + tree t; + enum logical_value old_state, new_state; + struct part_info *p; +// tree lval; + int offset; + int saveUseCached = store_useCached; + store_useCached = 0; + +// eval (STMT_ASSIGN_RVAL_CODE (pc)); +// lval = STMT_ASSIGN_LVAL (pc); + lval_code = TREE_CODE(lval); + + switch (lval_code) { +/***************************************************************************/ +/* Integer DECL */ +/***************************************************************************/ +/* + case INTEGER_DECL: + if( store_computeOnly ) { + break; + } + g1 = DECL_STORAGE (lval); + g2 = *--R; + SET_DECL_STATE (lval, ZERO); + changed = 0; + if (AVAL (g1) != AVAL (g2)) { + if (AVAL (g1) != AVAL (g2)) { + AVAL (g1) = AVAL (g2); + changed = 1; + } + if (BVAL (g1) != BVAL (g2)) { + BVAL (g1) = BVAL (g2); + changed = 1; + } + } +// g1++; g2++; +// AVAL (g1) = AVAL (g2); +// BVAL (g1) = BVAL (g2); + SET_DECL_STATE (lval, ZERO); + SET_STATE (g1); + notify (lval, DECL_STATE (lval), changed, pc); + break; +*/ +/***************************************************************************/ +/* REG scalar DECL */ +/***************************************************************************/ + + case REG_SCALAR_DECL: + case NET_SCALAR_DECL: + if (store_computeOnly) { + break; + } + g1 = DECL_STORAGE(lval); + g2 = *--R; + old_state = DECL_STATE(lval); + AVAL(g1) = AVAL(g2) & 1; + BVAL(g1) = BVAL(g2) & 1; + SET_DECL_STATE(lval, ZERO); + SET_STATE(g1); + changed = old_state != DECL_STATE(lval); + notify(lval, DECL_STATE(lval), changed, pc); + break; + +/***************************************************************************/ +/* REG vector DECL */ +/***************************************************************************/ + + case INTEGER_DECL: + case REG_VECTOR_DECL: + case NET_VECTOR_DECL: + case TMP_DECL: + case TIME_DECL: + case PARAM_DECL: + case SPECPARAM_DECL: + if (store_computeOnly) { + break; + } + nbits = TREE_NBITS(lval); + ngroups = bits_to_groups(nbits); + g1 = DECL_STORAGE(lval); + g2 = *--R; + old_state = DECL_STATE(lval); +/* MAKE THIS changed = 0 AFTER DEBUGGING!!! */ + changed = 0; + SET_DECL_STATE(lval, ZERO); + if (ngroups > 0) + for (i = 1; i <= ngroups; i++, g1++, g2++) { + if (AVAL(g1) != AVAL(g2)) { + AVAL(g1) = AVAL(g2); + changed = 1; + } + if (BVAL(g1) != BVAL(g2)) { + BVAL(g1) = BVAL(g2); + changed = 1; + } + SET_STATE(g1); + } + if (((AVAL(g1) ^ AVAL(g2)) & mask_right1[nbits & NBITS_MASK]) + || ((BVAL(g1) ^ BVAL(g2)) & mask_right1[nbits & NBITS_MASK])) { + AVAL(g1) = AVAL(g2) & mask_right1[nbits & NBITS_MASK]; + BVAL(g1) = BVAL(g2) & mask_right1[nbits & NBITS_MASK]; + changed = 1; + } + SET_STATE(g1); + notify(lval, DECL_STATE(lval), changed, pc); + break; + +/***************************************************************************/ +/* Part reference */ +/***************************************************************************/ + + case PART_REF: + if (store_computeOnly) { + break; + } + g1 = PART_STORAGE(lval); + g2 = *--R; + + changed = part_lref(g1, g2, PART_INFO(lval)); + notify(PART_DECL(lval), ZERO, changed, pc); + break; + +/***************************************************************************/ +/* Bit reference */ +/***************************************************************************/ + + case BIT_REF: + /* evaluate the index */ + nbits = R_nbits; /* save these */ + ngroups = R_ngroups; + eval(BIT_EXPR_CODE(lval)); + g2 = DECL_STORAGE(BIT_REF_DECL(lval)); +// g1 = *--R; /* points to index */ + + cond = 0; + changed = 0; + new_state = ZERO; + /* if index is a big number, make sure all high bits are zero */ + if (R_ngroups) /* R_ngroups is from the index eval */ + for (i = 1, g1 = *(R - 1) + 1; i < R_ngroups; i++, g1++) { + if (BVAL(g1) || AVAL(g1)) { + cond = X; + break; + } + } + g1 = *--R; /* Points to index */ + if (BVAL(g1) || cond) + cond = X; + { + tree decl = BIT_REF_DECL(lval); + nbits_t decl_lsb = LSB(decl); + nbits_t decl_msb = MSB(decl); + Bit aval = AVAL(g1); + nbits_t bit_offset; + ngroups_t group_offset; + + /* Make sure index is within bounds, else ignore */ + if (VECTOR_DIRECTION_ATTR(decl)) { + if (aval < decl_lsb || aval > decl_msb) + cond = Z; /* will make store not happen */ + else { + bit_offset = (aval - decl_lsb) % BITS_IN_GROUP; + group_offset = bits_to_groups(aval - decl_lsb + 1); + } + } else { + if (aval < decl_msb || aval > decl_lsb) + cond = Z; /* Will make store not happen */ + else { +// bit_offset = (aval - decl_msb) % BITS_IN_GROUP; +// group_offset = bits_to_groups (aval - decl_msb + 1); + bit_offset = (decl_lsb - aval) % BITS_IN_GROUP; + group_offset = bits_to_groups(decl_lsb - aval + 1); + } + } + + if (store_computeOnly) { + // handle cond==Z case + store_scb->bit_offset = bit_offset; + if (cond == Z) { + store_scb->group_offset = 0xffffffff; + } else { + store_scb->group_offset = group_offset; + } + R_nbits = nbits; /* restore original values in case trace */ + R_ngroups = ngroups; /* need them. */ + break; + } + if (saveUseCached) { + bit_offset = readylist->bit_offset; + group_offset = readylist->group_offset; + cond = 0; + if (group_offset == 0xffffffff) { + cond = Z; + } + } + + /* take out the least significant bit and pop the stack */ + a = AVAL(*--R) & 1; + b = BVAL(*R) & 1; + if (cond == Z) + goto bit_ref_end; /* Don't do store, but clean up */ + + + current_a = AVAL(g2 + group_offset) & ((Bit) 1 << bit_offset); + current_b = BVAL(g2 + group_offset) & ((Bit) 1 << bit_offset); + + if (a || cond == X) { /* set bit */ + if (!current_a) { + AVAL(g2 + group_offset) |= (Bit) 1 << bit_offset; + changed = 1; + new_state = ONE; + } + } else { /* clear bit */ + + if (current_a) { + AVAL(g2 + group_offset) &= ~((Bit) 1 << bit_offset); + changed = 1; + } else + new_state = ONE; /* never changed; reflects current val */ + } + + if (b || cond == X) { /* set bit */ + if (!current_b) { + BVAL(g2 + group_offset) |= (Bit) 1 << bit_offset; + changed = 1; + new_state = (new_state == ZERO) ? Z : X; + } + } else { /* clear bit */ + + if (current_b) { + Bit bval = BVAL(g2 + group_offset); + bval &= ~((Bit) 1 << bit_offset); + BVAL(g2 + group_offset) = bval; +// BVAL (g2 + group_offset) &= ~((Bit) 1 << bit_offset); + changed = 1; + } else + new_state = (new_state == ZERO) ? Z : X; + } + } + + bit_ref_end: + R_nbits = nbits; /* restore original values in case trace */ + R_ngroups = ngroups; /* need them. */ + notify(BIT_REF_DECL(lval), new_state, changed, pc); + break; + +/****************************************************************************/ +/* Array reference */ +/****************************************************************************/ + + case ARRAY_REF: +//{ int test = farheapcheck (); +// if (test < 0) +// fatal ("Corrupted before array store"); +//} + /* evaluate the index */ + save_R_nbits = R_nbits; /* save these */ + save_R_ngroups = R_ngroups; + save_R_mask = R_mask; + + eval(ARRAY_EXPR_CODE(lval)); + + + R_nbits = save_R_nbits; /* save these */ + R_ngroups = save_R_ngroups; + R_mask = save_R_mask; + cond = 0; + + /* if index is a big number, make sure all high bits are zero */ +// if (R_ngroups) +// for (i = 1, g1 = *(R - 1); i < R_ngroups; i++, g1++) { +// if (BVAL (g1) || AVAL (g1)) { +// cond = 'X'; +// break; +// } +// } + g1 = *--R; /* Points to index */ + if (BVAL(g1)) { + cond = Z; + } + + offset = AVAL(g1); + if (store_computeOnly) { + // handle cond==Z case + if (cond == Z) { + store_scb->group_offset = 0xffffffff; + } else { + store_scb->group_offset = offset; + } + break;; + } + if (saveUseCached) { + offset = readylist->group_offset; + cond = 0; + if (offset == 0xffffffff) { + cond = Z; + } + } + if (cond) { + --R; + break; + } + + store_array(ARRAY_REF_DECL(lval), offset); + + // R_nbits = nbits; /* restore original values in case trace */ + // R_ngroups = ngroups; /* need them. */ + notify(ARRAY_REF_DECL(lval), ZERO, 1, pc); + break; + +/***************************************************************************/ +/* Concatenation */ +/***************************************************************************/ + + case CONCAT_REF: + store_useCached = saveUseCached; + if (store_computeOnly) { + for (t = CONCAT_LIST(lval); t; t = TREE_CHAIN(t)) { + p = (struct part_info *) TREE_VALUE(TREE_VALUE(t)); + store(*(tree *) TREE_PURPOSE(TREE_VALUE(t)), pc); + } + break; + } + g1 = *--R; + g2 = g1; + nbits = R_nbits; /* save these */ + ngroups = R_ngroups; + i = 0; + deferred++; /* Don't trigger con't assgn yet */ + /* assume TREE_LIST is in reverse order (lsb first) */ + for (t = CONCAT_LIST(lval); t; t = TREE_CHAIN(t)) { + p = (struct part_info *) TREE_VALUE(TREE_VALUE(t)); + i += PART_NEXT(p); + current_a = AVAL(g1 + i); + current_b = BVAL(g1 + i); +// g2 += part_rref (g1, g2, (struct part_info *) TREE_VALUE (TREE_VALUE (t))); + g2 += part_rref(g1, g2, p); + R++; + store(*(tree *) TREE_PURPOSE(TREE_VALUE(t)), pc); + AVAL(g1 + i) = current_a; + BVAL(g1 + i) = current_b; + } + { /* Save the global deferred_marker and clear. This is done + because NotifyDeferred is not automic. The case in + that excersizes this is where two module have + concatenated argument ports which connect to + each other and are defined as INOUTs: + foo f0 ({a0, a1}); + bar b0 ({a0, a1}); */ + extern tree deferred_markers; + tree local_deferred = deferred_markers; + deferred_markers = NULL; + if (!--deferred) + NotifyDeferred(local_deferred); + } + R_nbits = nbits; /* restore original values in case trace */ + R_ngroups = ngroups; /* need them. */ + saveUseCached = store_useCached; + break; + +/***************************************************************************/ +/* Shadow lval reference (from hierarchical ref) */ +/***************************************************************************/ + + case SHADOW_LVAL_REF: + if (store_computeOnly) { + break; + } + store(TREE_CHAIN(lval), pc); + break; + +/***************************************************************************/ +/* Real DECL */ +/***************************************************************************/ + + case REAL_DECL: + if (store_computeOnly) { + break; + } + g1 = DECL_STORAGE(lval); + g2 = *--R; + SET_DECL_STATE(lval, ZERO); + changed = 0; + if (AVAL(g1) != AVAL(g2)) { + AVAL(g1) = AVAL(g2); + changed = 1; + } + if (BVAL(g1) != BVAL(g2)) { + BVAL(g1) = BVAL(g2); + changed = 1; + } +// g1++; g2++; +// AVAL (g1) = AVAL (g2); +// BVAL (g1) = BVAL (g2); + SET_DECL_STATE(lval, ZERO); + SET_STATE(g1); + notify(lval, DECL_STATE(lval), changed, pc); + break; + + default: +// printf ("Line: %ld, File %s: \n", STMT_SOURCE_LINE (pc), STMT_SOURCE_FILE (pc)); + fatal("Internal error: Unimplemented lval reference: %s", + tree_code_name[lval_code]); +// abort (); + } /* switch */ + store_useCached = saveUseCached; +} + +void init_store() +{ + deferred = 0; +} diff --git a/src/store.h b/src/store.h new file mode 100644 index 0000000..4c5ab4d --- /dev/null +++ b/src/store.h @@ -0,0 +1,40 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* STORE.H - Macros and prototypes for Store.c */ + +#ifndef STORE_H +#define STORE_H + +// public methods + +extern int store_computeOnly; +extern int store_useCached; +extern SCB *store_scb; +void notify(tree LVAL, enum logical_value STATE, int CHANGED, tree pc); +void store_array(tree decl, Bit index); +void store(tree lval, tree pc); +void init_store(void); + +// private methods + +#ifdef STORE_C +#endif // STORE_C + +#endif // STORE_H diff --git a/src/strobe.cc b/src/strobe.cc new file mode 100644 index 0000000..7371e49 --- /dev/null +++ b/src/strobe.cc @@ -0,0 +1,312 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* Strobe.c - strobe tasks and functions */ + +#define STROBE_C + +#include +#include "glue.h" +#include "vtypes.h" +#include "tree.h" +#include "acc_user.h" +#include "pli.h" +#include "schedule.h" +#include "strobe.h" +#include "dumpvar.h" +#include "systask.h" +#include "veriwell.h" + +/* free strobe queue - one for all strobe queues */ + +static sched_strobe_t *strobe_free = (sched_strobe_t *) BADPTR; +static sched_strobe_t *active_strobe = (sched_strobe_t *) BADPTR; + +/* strobe queue defines */ + +strobe_queue_t idle_strobe_queue = + { (sched_strobe_t *) BADPTR, (sched_strobe_t *) BADPTR, NULL }; +strobe_queue_t final_strobe_queue = + { (sched_strobe_t *) BADPTR, (sched_strobe_t *) BADPTR, NULL }; + +/************************************************************** + * + * tickle_monitor + * - enqueue strobe for monitoring if not already queued + * + ************************************************************* + */ + +void tickle_monitor(strobe_queue_t * queue, tree pc) +{ + sched_strobe_t *s; + + ASSERT(queue != NULL); + ASSERT(queue->head != BADPTR); + ASSERT(queue->tail != BADPTR); + ASSERT(pc != NULL); + ASSERT(strobe_free != BADPTR); + ASSERT(active_strobe != BADPTR); + + + for (s = queue->head; s; s = s->next) { + if (s->pc == pc) { + return; + } + } + + enqueue_strobe(queue, pc); +} + +/************************************************************** + * + * tickle_monitor_old + * - old way currently works with markers of type M_STROBE + * + ************************************************************* + */ + +void +tickle_monitor_old(strobe_queue_t * queue, + struct monitor_info *monitor_info) +{ + sched_strobe_t *s; + + ASSERT(queue != NULL); + ASSERT(queue->head != BADPTR); + ASSERT(queue->tail != BADPTR); + ASSERT(monitor_info != NULL); + ASSERT(strobe_free != BADPTR); + ASSERT(active_strobe != BADPTR); + + if (!monitor_info->enable) { + return; + } + + + for (s = queue->head; s; s = s->next) { + if (s->pc == monitor_info->node) { + return; + } + } + + enqueue_strobe(queue, monitor_info->node); +} + +/************************************************************** + * + * is_strobe_active + * - returns TRUE if given pc is the active strobe + * - returns address of queue is pc is active strobe + * + ************************************************************* + */ +//BOOL is_strobe_active( tree pc ) +strobe_queue_t *is_strobe_active(tree pc) +{ + ASSERT(pc != NULL); + ASSERT(strobe_free != BADPTR); + ASSERT(active_strobe != BADPTR); + if (active_strobe && active_strobe->pc == pc) { + return (active_strobe->list); + } else { + return (NULL); + } +} + +/************************************************************** + * + * enqueue_strobe + * - enqueue pc to be executed on given strobe queue + * + ************************************************************* + */ + +void enqueue_strobe(strobe_queue_t * queue, tree pc) +{ + sched_strobe_t *strobe_tmp; + + ASSERT(queue != NULL); + ASSERT(queue->head != BADPTR); + ASSERT(queue->tail != BADPTR); + ASSERT(pc != NULL); + ASSERT(strobe_free != BADPTR); + ASSERT(active_strobe != BADPTR); + if (!strobe_free) { + strobe_tmp = (sched_strobe_t *) xmalloc(sizeof(sched_strobe_t)); + } else { + strobe_tmp = strobe_free; + strobe_free = strobe_free->next; + } + strobe_tmp->pc = pc; + strobe_tmp->next = NULL; +// strobe_tmp->list = STROBE_ON; + strobe_tmp->list = queue; + if (queue->tail) { + queue->tail->next = strobe_tmp; + queue->tail = strobe_tmp; + } else { + queue->head = strobe_tmp; + queue->tail = strobe_tmp; + } +} + + +/************************************************************** + * + * remove_strobe + * - remove given strobe from queue. returns + * TRUE on success. + * + ************************************************************* + */ + +BOOL remove_strobe(strobe_queue_t * queue, sched_strobe_t * s) +{ + sched_strobe_t *s1, *prev; + + ASSERT(queue != NULL); + ASSERT(queue->head != BADPTR); + ASSERT(queue->tail != BADPTR); + ASSERT(s != NULL); + ASSERT(strobe_free != BADPTR); + ASSERT(active_strobe != BADPTR); + for (s1 = queue->head, prev = NULL; s1; prev = s1, s1 = s1->next) { + if (s1 == s) { + if (!prev) { /* Remove from front of list */ + queue->head = s->next; + if (!queue->head) { + queue->tail = NULL; + } + } else { + prev->next = s->next; + if (s == queue->tail) { + queue->tail = prev; + } + } + + /* thread onto free list */ + s->next = strobe_free; +// s->list = STROBE_OFF; + // s->list = NULL; + strobe_free = s; + return (TRUE); + } + } + return (FALSE); +} + +/************************************************************** + * + * dequeue_strobe + * - remove strobe entry for a given pc + * returns TRUE if pc is found. + * + ************************************************************* + */ + +BOOL dequeue_strobe(strobe_queue_t * queue, tree pc) +{ + sched_strobe_t *s; + BOOL result; + + ASSERT(queue != NULL); + ASSERT(queue->head != BADPTR); + ASSERT(queue->tail != BADPTR); + ASSERT(pc != NULL); + ASSERT(strobe_free != BADPTR); + ASSERT(active_strobe != BADPTR); + + result = FALSE; + + for (s = queue->head; s; s = s->next) { + if (s->pc == pc) { + remove_strobe(queue, s); + result = TRUE; + } + } + return (result); +} + +/************************************************************** + * + * check_strobe + * - execute all strobes on queue, removing them + * as we go + * + ************************************************************* + */ + +void check_strobe(strobe_queue_t * queue) +{ + sched_strobe_t *s; + + ASSERT(queue != NULL); + ASSERT(queue->head != BADPTR); + ASSERT(queue->tail != BADPTR); + ASSERT(strobe_free != BADPTR); + ASSERT(active_strobe != BADPTR); + + dumpvar.new_time = 1; + + /* + * set fence at current end of list so + * newly enqueue strobes are processed in + * the next pass + */ + queue->fence = queue->tail; + for (s = queue->head; s; s = queue->head) { + active_strobe = s; + remove_strobe(queue, s); + exec_systask(s->pc); + active_strobe = NULL; + if (s == queue->fence) { + break; + } + } + queue->fence = NULL; +} + +/************************************************************** + * + * empty_strobe + * - return TRUE if strobe queue is empty + * + ************************************************************* + */ +int empty_strobe(strobe_queue_t * queue) +{ + return queue->head == NULL; +} + +/************************************************************** + * + * init_strobe + * - initializes global and static variables for strobe.c + * + ************************************************************* + */ + +void init_strobe() +{ + strobe_free = NULL; + active_strobe = NULL; + memset(&idle_strobe_queue, 0, sizeof(idle_strobe_queue)); + memset(&final_strobe_queue, 0, sizeof(final_strobe_queue)); +} diff --git a/src/strobe.h b/src/strobe.h new file mode 100644 index 0000000..4f62269 --- /dev/null +++ b/src/strobe.h @@ -0,0 +1,77 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* STROBE.H - all maintaince methods for managing strobes */ + +#ifndef STROBE_H +#define STROBE_H + +// public methods + +#define BOOL int + +struct strobe_queue; + +/* Thread strobe or monitor request; exec() checks when time changes */ +typedef struct sched_strobe { + tree pc; + struct strobe_queue *list; /* Which list; 0 for OFF */ + struct sched_strobe *next; +} sched_strobe_t; + + +/* monitor structure */ + +typedef struct monitor_info { + int enable; + tree node; +} monitor_info_t; + +/* strobe queue structure */ + +typedef struct strobe_queue { + sched_strobe_t *head; + sched_strobe_t *tail; + sched_strobe_t *fence; +} strobe_queue_t; + +/* extern strobe queue defines */ + +extern strobe_queue_t idle_strobe_queue; +extern strobe_queue_t final_strobe_queue; + +/* access routine prototypes */ + +void init_strobe(void); +void check_strobe(strobe_queue_t * queue); +void enqueue_strobe(strobe_queue_t * queue, tree pc); +BOOL remove_strobe(strobe_queue_t * queue, struct sched_strobe *strobe); +BOOL dequeue_strobe(strobe_queue_t * queue, tree pc); +strobe_queue_t *is_strobe_active(tree pc); +void tickle_monitor_old(strobe_queue_t * queue, + monitor_info_t * monitor_info); +void tickle_monitor(strobe_queue_t * queue, tree t); +void init_strobe(void); +int empty_strobe(strobe_queue_t * queue); + +#ifdef STROBE_C +// private methods +#endif // STROBE_C + +#endif /* STROBE_H */ diff --git a/src/systask.cc b/src/systask.cc new file mode 100644 index 0000000..4548e65 --- /dev/null +++ b/src/systask.cc @@ -0,0 +1,2102 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* SYSTASK.C - System tasks and functions */ + +#define SYSTASK_C + +#include +#include +#include +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "lex.h" +#include "flags.h" +#include "runtime.h" +#include "schedule.h" +#include "print.h" +#include "io.h" +#include "macro.h" +#include "glue.h" +#include "dumpvar.h" +#include "pass3.h" +#include "strobe.h" +#include "scope.h" +#include "veriuser.h" +#include "eval.h" +#include "timescal.h" +#include "specify.h" +#include "veriwell.h" +#include "pass2.h" +#include "store.h" +#include "trace.h" +#include "acc_user.h" +#include "pli.h" +#include "systask.h" +#include "usertask.h" + + +int systime_once = 0; /* initialize the following only once */ +tree systime_return; /* variable for returning $time value */ + +int sysstime_once = 0; /* initialize the following only once */ +tree sysstime_return; /* variable for returning $stime value */ + +int sysrealtime_once = 0; /* initialize the following only once */ +tree sysrealtime_return; /* variable for returning $realtime value */ + +int sysopen_once = 0; /* initialize the following only once */ +tree sysopen_return; /* variable for returning $fopen value */ + +int sysrand_once = 0; /* initialize the following only once */ +tree sysrand_return; /* variable for returning $random value */ + +int sysplus_once = 0; /* initialize the following only once */ +tree sysplus_return; /* variable for returning $test$plusargs value */ + +int roFlag = FALSE; /* true when in a misc routine for rosynch */ + +static tree pliInstanceList; /* linked list of all pli instances */ + +struct monitor_info monitor_info = { 1, NULL_TREE }; +struct monitor_info mwaves_info = { 1, NULL_TREE }; + +/* There are 3 kinds of system tasks/functions (names that start with '$'): + - internal tasks implemented either before there were PLI hooks or that + require direct access to VeriWell structures -- these are implemented + here; + - internal tasks written using all PLI functions as if they were + user-defined functions -- they are implemented elsewhere but the + name resolution is here; + - user-defined tasks using PLI functions implemented outside VeriWell -- + the name resolution is also done here. + */ + +/* [tf: task/function] */ + +/* These are the internal non-PLI tasks/functions: (some could eventually + be re-written into PLI...) */ + +struct systask_info systask_info[] = { + "$scope", SCOPE, + "$showscopes", SHOWSCOPES, + "$display", DISPLAY, + "$displayh", DISPLAYH, + "$displayb", DISPLAYB, + "$displayo", DISPLAYO, + "$write", WRITE, + "$writeh", WRITEH, + "$writeb", WRITEB, + "$writeo", WRITEO, + "$fdisplay", FDISPLAY, + "$fdisplayh", FDISPLAYH, + "$fdisplayb", FDISPLAYB, + "$fdisplayo", FDISPLAYO, + "$fwrite", T_FWRITE, + "$fwriteh", T_FWRITEH, + "$fwriteb", T_FWRITEB, + "$fwriteo", T_FWRITEO, + "$monitor", MONITOR, + "$monitorb", MONITORB, + "$monitorh", MONITORH, + "$monitoro", MONITORO, + "$fmonitor", FMONITOR, + "$fmonitorb", FMONITORB, + "$fmonitorh", FMONITORH, + "$fmonitoro", FMONITORO, + "$strobe", STROBE, + "$strobeb", STROBEB, + "$strobeh", STROBEH, + "$strobeo", STROBEO, + "$fstrobe", FSTROBE, + "$fstrobeb", FSTROBEB, + "$fstrobeh", FSTROBEH, + "$fstrobeo", FSTROBEO, + "$monitoron", T_MONITORON, + "$monitoroff", T_MONITOROFF, + "$stop", STOP, + "$finish", FINISH, + "$settrace", SETTRACE, + "$cleartrace", CLEARTRACE, + "$showstats", SHOWSTATS, + "$fclose", T_FCLOSE, + "$log", T_LOG, + "$nolog", T_NOLOG, + "$key", T_KEY, + "$nokey", T_NOKEY, + "$input", T_INPUT, + "$showvars", T_SHOWVARS, + "$readmemh", T_READMEMH, + "$readmemb", T_READMEMB, + "$dumpvars", T_DUMPVARS, + "$dumpon", T_DUMPON, + "$dumpoff", T_DUMPOFF, + "$dumpfile", T_DUMPFILE, + "$dumpall", T_DUMPALL, + "$dumpflush", T_DUMPFLUSH, + "$update_timings", T_UPDATETIMINGS, + "$timeformat", T_TIMEFORMAT, + 0, (enum systask_type) 0 +}; + +struct sysfunction_info sysfunction_info[] = { + "$stime", F_STIME, + "$time", F_TIME, + "$realtime", F_REALTIME, + "$fopen", F_FOPEN, + "$random", F_RANDOM, + "$test$plusargs", F_TEST_PLUSARGS, + 0, (enum sysfunction_type) 0 +}; + +tree current_tf_instance; /* node of systask being executed or compiled */ + +extern s_tfcell veriusertfs[]; /* Hooks into user tfs */ +extern s_tfcell verisystfs[]; /* Hooks into internal tfs */ + +void broadcast_tf(int reason) +{ + tree t; + + t = pliInstanceList; + while (t) { + current_tf_instance = t; + switch (TREE_CODE(t)) { + case SYSFUNCTION_REF: + call_misc_tf(FUNC_REF_USERTF(t), reason); + t = FUNC_REF_NEXT(t); + break; + case SYSTASK_STMT: + call_misc_tf(STMT_SYSTASK_USERTF(t), reason); + t = STMT_SYSTASK_NEXT(t); + break; + } + } + +} + +/* lookup by name a PLI tf either user or internal (user first since it can + override an internal tf); retun pointer to structure. */ + +p_tfcell lookup_user_tf(char *name) +{ + int i; + + p_tfcell userFunction = Usertask_Lookup(name); + if (userFunction) { + return userFunction; + } + for (i = 0; verisystfs[i].type; i++) { + if (!strcmp(name, verisystfs[i].tfname)) + return &verisystfs[i]; + } + return 0; +} + +/* Lookup a PLI _task_ (either internal or user-defined); return pointer + to structure */ + +p_tfcell lookup_user_task(char *name) +{ + p_tfcell p_tf = lookup_user_tf(name); /* look it up in both tables */ + if (p_tf == 0) /* not found */ + return 0; + + if (p_tf->type != USERTASK) /* its not a task */ + return 0; + else + return p_tf; +} + +/* Same as above but for a function */ + +p_tfcell lookup_user_func(char *name) +{ + p_tfcell p_tf = lookup_user_tf(name); /* look it up in both tables */ + if (p_tf == 0) /* not found */ + return 0; + + if (p_tf->type != USERFUNCTION) /* its not a function */ + return 0; + else + return p_tf; +} + +/* Call the correct _check_ routine for the given user task/function */ + +void call_check_tf(p_tfcell p_tf) +{ + if (p_tf->checktf) + (p_tf->checktf) (p_tf->data, (int) REASON_CHECKTF); +} + +/* Call the correct _call_ routine for the given user task/function */ + +void call_call_tf(p_tfcell p_tf) +{ + if (p_tf->calltf) + (p_tf->calltf) (p_tf->data, (int) REASON_CALLTF); +} + +/* Call the correct _size_ routine for the given user task/function */ + +int call_size_tf(p_tfcell p_tf) +{ + if (p_tf->sizetf) + return (p_tf->sizetf) (p_tf->data, (int) REASON_SIZETF); + return 0; +} + +/* Call the correct _misc_ routine for the given user task/function */ + +void call_misc_tf(p_tfcell p_tf, int reason) +{ + if (p_tf->misctf) + (p_tf->misctf) (p_tf->data, reason); +} + +void call_misc_tf1(p_tfcell p_tf, int reason, int arg) +{ + if (p_tf->misctf) + ((int (*)(int, int, int)) p_tf->misctf) (p_tf->data, reason, arg); +} + +void systaskDoDelay(tree delayNode) +{ + tree node; + + ASSERT(delayNode != NULL); + ASSERT(TREE_CODE(delayNode) == PLI_DELAY); + + node = PLI_DELAY_NODE(delayNode); + ASSERT(node != NULL); + current_tf_instance = node; + switch (TREE_CODE(node)) { + case SYSFUNCTION_REF: + call_misc_tf(FUNC_REF_USERTF(node), reason_reactivate); + break; + case SYSTASK_STMT: + call_misc_tf(STMT_SYSTASK_USERTF(node), reason_reactivate); + break; + } +} + + +void pli_asynccall(PliInfo_t * info) +{ + tree node; + + node = info->instance; + + if (ASYNCH_ATTR(node)) { + roFlag = TRUE; + info->pvc = TRUE; + current_tf_instance = node; + switch (TREE_CODE(node)) { + case SYSFUNCTION_REF: + call_misc_tf1(FUNC_REF_USERTF(node), + reason_paramvc, info->argNumber); + break; + case SYSTASK_STMT: + call_misc_tf1(STMT_SYSTASK_USERTF(node), + reason_paramvc, info->argNumber); + break; + } + roFlag = FALSE; + } +} + + + +/* "top-level" lookup called from pass3; look for user PLI, internal PLI, + internal custom, in that order. Return the enum of the internal + tf and the pointer to the PLI tf through the arg list */ + +enum systask_type lookup_systask(char *name, p_tfcell * pp_tf) +{ + int i; + + *pp_tf = lookup_user_task(name); + if (*pp_tf) + return USER_TASK; /* found PLI, pass pointer through arg list */ + + for (i = 0; systask_info[i].name; i++) { + if (!strcmp(name, systask_info[i].name)) + return systask_info[i].type; + } + return (enum systask_type) -1; +} + +enum sysfunction_type lookup_sysfunction(char *name, p_tfcell * pp_tf) +{ + int i; + + *pp_tf = lookup_user_func(name); + if (*pp_tf) + return USER_FUNC; + + for (i = 0; sysfunction_info[i].name; i++) { + if (!strcmp(name, sysfunction_info[i].name)) + return sysfunction_info[i].type; + } + return (enum sysfunction_type) -1; +} + +/* Convert bits in a group to a null-terminated string. It is assumed that + 'buffer' is large enough to handle the string. */ + +void bits_to_string(char *buffer, Group * g, nbits_t nbits) +{ + char *p = buffer; + ngroups_t ngroups, i; + int j, c; + Group *g1; + + ngroups = bits_to_groups(nbits); +// start_bit = ((nbits - 1) % (sizeof (Bit) * 8)) + 1; + g1 = g + ngroups; + + for (i = ngroups; i >= 0; i--, g1--) + for (j = sizeof(Bit) - 1; j >= 0; j--) { +#ifdef WORDS_BIGENDIAN + c = *(((char *) &AVAL(g1)) + sizeof(Bit) - 1 - j); /* endianess problem */ +#else + c = (AVAL(g1) >> j * 8) & 255; +#endif + if (c) + *p++ = c; + } + *p = 0; +} + +handle_t get_handle(tree * code) +{ + nbits_t nbits; + Group *val; + + val = eval_(code, &nbits); + return check_handle((handle_t) AVAL(val)); +} + +tree init_function_return(char *name, int size, enum tree_code code) +{ + tree var_name = make_node(IDENTIFIER_NODE); + tree rtn = make_node(code); + + IDENTIFIER_LENGTH(var_name) = strlen(name); + IDENTIFIER_POINTER(var_name) = name; + DECL_NAME(rtn) = var_name; +// if (code == REG_VECTOR_DECL) + TREE_NBITS(rtn) = size; + DECL_STORAGE(rtn) = (Group *) malloc_X(bits_to_groups(size) + 1); + if (!DECL_STORAGE(rtn)) + fatal("Not enough memory to allocate for '%s' system function", + name); +// STMT_TASK_ARGS (node) = NULL_TREE; + return rtn; +} + +int args_one(int num_args, char *taskname) +{ + if (num_args > 1) + error("Unexpected arguments in system function '%s'", taskname, + NULL); + else if (num_args == 0) + error("Missing arguments in call to system function '%s'", + taskname, NULL); + else + return 1; + return 0; +} + +int args_zero(int num_args, char *taskname) +{ + if (num_args != 0) + error("Unexpected arguments in system function '%s'", taskname, + NULL); + else + return 1; + return 0; +} + +int args_zero_or_one(int num_args, char *taskname) +{ + if (num_args > 1) + error("Unexpected arguments in system function '%s'", taskname, + NULL); + else + return 1; + return 0; +} + +void arg_common(tree args) +{ + tree t; + + for (t = args; t; t = TREE_CHAIN(t)) + if (TREE_EXPR(t)) + TREE_EXPR_CODE(t) = pass3_expr(TREE_EXPR(t)); +} + +int count_args(tree node) +{ + tree t; + int arg_count = 0; + + if (TREE_CODE(node) == SYSTASK_STMT) + t = STMT_TASK_ARGS(node); + else if (TREE_CODE(node) == SYSFUNCTION_REF) + t = FUNC_REF_ARGS(node); + else { + error("Illegal node type", NULL, NULL); /* do error handling later */ + return 0; + } + + if (!t || !TREE_EXPR(t)) /* This covers $foo; and $foo(); */ + return 0; + for (; t; t = TREE_CHAIN(t)) + arg_count++; + return arg_count; +} + +void init_sysfunction(tree node) +{ + int num_args; + tree t; + enum tree_code code; + PliInfo_t *info; + int count; + +/* First, count the number of arguments */ + num_args = count_args(node); + TREE_NBITS(node) = 1; /* make sure this is something if error causes early exit */ + + switch (FUNC_REF_SYSTYPE(node)) { + + case USER_FUNC: + + FUNC_REF_NEXT(node) = pliInstanceList; + pliInstanceList = node; + FUNC_REF_DELAYSCB(node) = NULL; + // setup for async marker + count = 1; + +// ??? mdh - change +// for (t = STMT_TASK_ARGS (node); t; t = TREE_CHAIN (t)) { + for (t = FUNC_REF_ARGS(node); t; t = TREE_CHAIN(t)) { + info = (PliInfo_t *) xmalloc(sizeof(PliInfo_t)); + info->storage = NULL; + info->pvc = FALSE; + info->saved_pvc = FALSE; + info->vclSet = FALSE; + info->instance = node; + info->argNumber = count; + info->marker = NULL; + TREE_PLIINFO(t) = (tree) info; + count++; + + if (TREE_EXPR(t)) { + // ??? mdh - but this version doen't install markers so + // pvc calls won't be performed + TREE_EXPR_CODE(t) = pass3_expr_intrude(TREE_EXPR(t), 1); + // ??? mdh - this destroys function return code +// TREE_EXPR_CODE (t) = pass3_expr_marker (TREE_EXPR (t), +// &info->marker, (enum marker_flags)(M_ASYNCH + M_FIXED), (tree)info, NULL_TREE ); + } + } + + current_tf_instance = node; + ASYNCH_ATTR(node) = FALSE; + call_check_tf(FUNC_REF_USERTF(node)); +// arg_common (FUNC_REF_ARGS (node)); + TREE_NBITS(node) = call_size_tf(FUNC_REF_USERTF(node)); + FUNC_REF_RETURNDECL(node) = + init_function_return(((p_tfcell) FUNC_REF_USERTF(node))-> + tfname, TREE_NBITS(node), + REG_VECTOR_DECL); + return; + + + case F_STIME: + if (!args_zero(num_args, "$stime")) + break; + + TREE_NBITS(node) = 32; + if (!sysstime_once) { + sysstime_return = + init_function_return("$stime", 32, REG_VECTOR_DECL); + sysstime_once = 1; + } + break; + + case F_TIME: + if (!args_zero(num_args, "$time")) + break; + + TREE_NBITS(node) = 64; + if (!systime_once) { + systime_return = + init_function_return("$time", 64, REG_VECTOR_DECL); + systime_once = 1; + } + break; + + case F_REALTIME: + if (!args_zero(num_args, "$realtime")) + break; + + TREE_NBITS(node) = 32; + TREE_REAL_ATTR(node) = 1; /* make $realtime a real (not int) node */ + if (!sysrealtime_once) { + sysrealtime_return = + init_function_return("$realtime", 32, REAL_DECL); + sysrealtime_once = 1; + } + break; + + case F_RANDOM: + if (!args_zero_or_one(num_args, "$random")) + break; + + if (num_args == 1) { + t = TREE_PURPOSE(FUNC_REF_ARGS(node)); /* 1st arg */ + if (HIERARCHICAL_ATTR(t)) { + FUNC_REF_INASSIGN(node) = resolve_hierarchical_name(t); + if (FUNC_REF_INASSIGN(node) == error_mark_node) { + TREE_NBITS(t) = 1; + break; + } + } else + FUNC_REF_INASSIGN(node) = t; + code = TREE_CODE(FUNC_REF_INASSIGN(node)); + if (code != REG_VECTOR_DECL && code != INTEGER_DECL + && code != TIME_DECL) { + error("Illegal arguments is call to $random", NULL, NULL); + break; + } + } + TREE_NBITS(node) = 32; + if (!sysrand_once) { + sysrand_return = + init_function_return("$random", 32, REG_VECTOR_DECL); + sysrand_once = 1; + } + break; + + case F_FOPEN: + if (!args_one(num_args, "$fopen")) + break; + + FUNC_REF_INASSIGN(node) = build_tree_list((tree) + pass3_expr_intrude + (TREE_PURPOSE + (FUNC_REF_ARGS(node)), + 1), NULL_TREE); + + TREE_NBITS(node) = 32; + if (!sysopen_once) { + sysopen_return = + init_function_return("$fopen", 32, REG_VECTOR_DECL); + sysopen_once = 1; + } + break; + + case F_TEST_PLUSARGS: + if (!args_one(num_args, "$test$plusargs")) + break; + + if (num_args == 0) + yyerror + ("Missing arguments in call to system function '$test$plusargs'"); + FUNC_REF_INASSIGN(node) = build_tree_list((tree) + pass3_expr_intrude + (TREE_PURPOSE + (FUNC_REF_ARGS(node)), + 1), NULL_TREE); + + TREE_NBITS(node) = 1; + if (!sysplus_once) { + sysplus_return = + init_function_return("$test$plusargs", 1, REG_SCALAR_DECL); + sysplus_once = 1; + } + break; + } +} + +void init_systask(tree node) +{ + int num_args; + int is_file = 0; + tree t; + tree decl; + PliInfo_t *info; + int count; + +/* First, count the number of arguments */ + num_args = count_args(node); + R_alloc(10, 10); + TREE_NBITS(node) = 1; /* in case an error causes an early exit */ + + + switch (STMT_SYSTASK_TYPE(node)) { + + case USER_TASK: + // setup for async marker + STMT_SYSTASK_NEXT(node) = pliInstanceList; + pliInstanceList = node; + STMT_SYSTASK_DELAYSCB(node) = NULL; + count = 1; + for (t = STMT_TASK_ARGS(node); t; t = TREE_CHAIN(t)) { + info = (PliInfo_t *) xmalloc(sizeof(PliInfo_t)); + info->storage = NULL; + info->pvc = FALSE; + info->saved_pvc = FALSE; + info->instance = node; + info->argNumber = count; + info->marker = NULL; + TREE_PLIINFO(t) = (tree) info; + count++; + + if (TREE_EXPR(t)) { + TREE_EXPR_CODE(t) = pass3_expr_marker(TREE_EXPR(t), + &info->marker, + (enum + marker_flags) + (M_ASYNCH + M_FIXED), + (tree) info, + NULL_TREE); + } + + } + + current_tf_instance = node; + call_check_tf(STMT_SYSTASK_USERTF(node)); +// arg_common (STMT_TASK_ARGS (node)); + ASYNCH_ATTR(node) = FALSE; + break; + + case SCOPE: + if (!args_one(num_args, "$scope")) + break; + + t = TREE_PURPOSE(STMT_TASK_ARGS(node)); +// if (*tree_code_type [TREE_CODE (t)] != 'b' && !HIERARCHICAL_ATTR (t)) + if (TREE_CODE(t) != BLOCK_DECL && !HIERARCHICAL_ATTR(t)) + yyerror("Illegal argument type for $scope system task"); + break; + + case SHOWSCOPES: + case T_NOLOG: + case T_NOKEY: + case T_MONITORON: + case T_MONITOROFF: + case T_DUMPON: + case T_DUMPOFF: + case T_DUMPALL: + case T_DUMPFLUSH: + case T_UPDATETIMINGS: + + if (!args_zero(num_args, STMT_TASK_NAME(node))) + break; + break; + + case T_SHOWVARS: + if (num_args > 1) + yyerror("Unexpected arguments in system task $showvars"); + else if (num_args == 1) + arg_common(STMT_TASK_ARGS(node)); + break; + + case T_LOG: + case T_KEY: + if (num_args > 1 || STMT_TASK_ARGS(node) + && !TREE_EXPR(STMT_TASK_ARGS(node))) + error("Unexpected arguments in system task %s", + STMT_TASK_NAME(node), NULL_CHAR); + else + arg_common(STMT_TASK_ARGS(node)); + break; + + case T_FCLOSE: + case T_INPUT: + case T_DUMPFILE: + if (args_one(num_args, STMT_TASK_NAME(node))) + arg_common(STMT_TASK_ARGS(node)); + break; + + case FDISPLAY: + case FDISPLAYB: + case FDISPLAYH: + case FDISPLAYO: + case T_FWRITE: + case T_FWRITEB: + case T_FWRITEH: + case T_FWRITEO: + case FSTROBE: + case FSTROBEB: + case FSTROBEH: + case FSTROBEO: + case FMONITOR: + case FMONITORB: + case FMONITORH: + case FMONITORO: + is_file = 1; + case DISPLAY: + case DISPLAYB: + case DISPLAYH: + case DISPLAYO: + case WRITE: + case WRITEB: + case WRITEH: + case WRITEO: + case STROBE: + case STROBEB: + case STROBEH: + case STROBEO: + case MONITOR: + case MONITORB: + case MONITORH: + case MONITORO: + if (!disp_common(node, DEC, is_file, 1)) { + error("Illegal arguments in call to %s", STMT_TASK_NAME(node), + NULL_CHAR); + break; + } + arg_common(STMT_TASK_ARGS(node)); + break; + + case T_READMEMH: + case T_READMEMB: + if (num_args < 2) { + error("Missing arguments in call to %s", STMT_TASK_NAME(node), + NULL_CHAR); + break; + } + if (num_args > 4) { + error("Too many arguments in call to %s", STMT_TASK_NAME(node), + NULL_CHAR); + break; + } + /* Process file name */ + t = STMT_TASK_ARGS(node); + if (TREE_EXPR(t)) + TREE_EXPR_CODE(t) = pass3_expr(TREE_EXPR(t)); + else { + error("Missing file name in call to %s", STMT_TASK_NAME(node), + NULL_CHAR); + break; + } + + /* Make sure 2nd argument is an array */ + t = TREE_CHAIN(t); + decl = TREE_EXPR(t); + if (HIERARCHICAL_ATTR(decl)) + decl = resolve_hierarchical_name(decl); + if (TREE_CODE(decl) != ARRAY_DECL) { + error("Second argument to %s must be an array", + STMT_TASK_NAME(node), NULL_CHAR); + break; + } + for (t = TREE_CHAIN(t); t; t = TREE_CHAIN(t)) + if (TREE_EXPR(t)) { + TREE_EXPR_CODE(t) = pass3_expr(TREE_EXPR(t)); + if (TREE_NBITS(*TREE_EXPR_CODE(t)) > MAX_BITS_IN_NUMBER) + yyerror("Array index must be within 32 bits"); + } else + error("Missing argument in call to %s", + STMT_TASK_NAME(node), NULL_CHAR); + + break; + + case T_WWAVES: + /* For waves, make sure arguments are in label-signal pairs */ + for (t = STMT_TASK_ARGS(node); t; t = TREE_CHAIN(t)) { + if (is_string(TREE_EXPR(t))) + TREE_EXPR_CODE(t) = pass3_expr(TREE_EXPR(t)); + else { + error("Missing label in call to %s", STMT_TASK_NAME(node), + NULL_CHAR); + break; + } + if (((t = TREE_CHAIN(t)) == NULL_TREE) || !TREE_EXPR(t)) { + error("Missing argument in call to %s", + STMT_TASK_NAME(node), NULL_CHAR); + break; + } + if (is_array(TREE_EXPR(t))) { + error("Illegal array reference in call to %s", + STMT_TASK_NAME(node), NULL_CHAR); + break; + } + if (is_string(TREE_EXPR(t))) { + error("Missing signal in call to %s", + STMT_TASK_NAME(node), NULL_CHAR); + break; + } + TREE_EXPR_CODE(t) = pass3_expr(TREE_EXPR(t)); + } + break; + + case T_DUMPVARS: + dumpvar.markers_first = NULL; + dumpvar.markers_last = NULL; + dumpvar.printed = NULL; + dumpvar.unprinted = NULL; + dumpvar.disallow_dumpvars = 0; + dumpvar.first_dumpvars = 1; + dumpvar.enabled = 0; + dumpvar.new_time = 1; + + if (!num_args) /* No args, simple case */ + break; + + t = STMT_TASK_ARGS(node); + if (is_block(TREE_EXPR(t), &decl)) + error("Illegal type in first argument of $dumpvars", NULL, + NULL); + else + TREE_EXPR_CODE(t) = pass3_expr(TREE_EXPR(t)); + + /* Put actual decl or block node in TREE_STMT */ + for (t = TREE_CHAIN(t); t; t = TREE_CHAIN(t)) + if (is_var(TREE_EXPR(t), &TREE_STMT(t)) + || is_block(TREE_EXPR(t), &TREE_STMT(t))); + else + error("Illegal argument in $dumpvars list", NULL, NULL); + break; + + case T_TIMEFORMAT: + default: + arg_common(STMT_TASK_ARGS(node)); + } +} + +void exec_systask(tree node) +{ + tree t, t1; + extern tree current_scope; + extern char *token_buffer; + enum radii radix; + int is_file = 0; /* to distiguish between $display and $fdisplay, etc */ + int level = 0; + + if (TREE_CODE(node) == TIMING_CHECK) { + timingCheck(node); + return; + } + + switch (STMT_SYSTASK_TYPE(node)) { + + case USER_TASK: + current_tf_instance = node; + { + strobe_queue_t *queue = is_strobe_active(node); + + /* Get here because of call to user task, call call_tf */ + if (!queue) + call_call_tf(STMT_SYSTASK_USERTF(node)); + /* Get here at end of time unit and [ro]synchronize had been armed */ + else { + if (queue == &idle_strobe_queue) + call_misc_tf(STMT_SYSTASK_USERTF(node), REASON_SYNCH); + else { + roFlag = TRUE; + call_misc_tf(STMT_SYSTASK_USERTF(node), + REASON_ROSYNCH); + roFlag = FALSE; + } + } + } + break; + + case SCOPE: + /* arg is either string or block node */ + t1 = TREE_PURPOSE(STMT_TASK_ARGS(node)); +// if (*tree_code_type [TREE_CODE (t1)] != 'b') { + if (TREE_CODE(t1) != BLOCK_DECL) { + strcpy(token_buffer, IDENTIFIER_POINTER(t1)); + t = search_scope(token_buffer, 0); /* traverse the scope */ + if (t != error_mark_node) { + strcpy(token_buffer, IDENTIFIER_POINTER(t1)); + search_scope(token_buffer, 1); /* actually set the scope */ + } + } else { + t = DECL_THREAD(t1); + if (!t) + error("'%s' not declared", IDENT(DECL_NAME(t)), NULL_CHAR); + else + look_for_and_set_scope(t); + } + +// if (BLOCK_UP (t) == current_scope) /* down one */ +// set_scope (t); +// else +// lookupward_scope (t); /* go up and set scope */ +// } + broadcast_tf(reason_scope); + + break; + + case SHOWSCOPES: + printf_V("Directory of scopes at current scope level:\n"); + for (t = BLOCK_DOWN(current_scope); t; t = TREE_CHAIN(t)) { + if (TREE_CODE(t) == MODULE_BLOCK) { + printf_V("module (%s), instance (%s)\n", + MODULE_NAME(t), IDENT(BLOCK_NAME(t))); + } else if (TREE_CODE(t) == TASK_BLOCK) { + printf_V("task (%s)\n", IDENT(BLOCK_NAME(t))); + } else if (TREE_CODE(t) == FUNCTION_BLOCK) { + printf_V("function (%s)\n", IDENT(BLOCK_NAME(t))); + } else if (TREE_CODE(t) == NAMED_BLOCK) { + printf_V("named block (%s)\n", IDENT(BLOCK_NAME(t))); + } + } + printf_V("\nCurrent scope is ("); + print_scope((handle_t) 1, current_scope); + printf_V(")\n"); + print_top_modules(); + break; + + case T_SHOWVARS: + if (STMT_TASK_ARGS(node) && TREE_EXPR(STMT_TASK_ARGS(node))) + showvar(*TREE_EXPR_CODE(STMT_TASK_ARGS(node))); + else { + for (t = BLOCK_PORTS(current_scope); t; t = TREE_CHAIN(t)) + showvar(t); + for (t = BLOCK_DECL(current_scope); t; t = TREE_CHAIN(t)) + showvar(t); + + /* only module blocks have spec parameters */ + if (TREE_CODE(current_scope) == MODULE_BLOCK) { + for (t = MODULE_SPECDEFS(current_scope); t; + t = TREE_CHAIN(t)) + if (TREE_CODE(t) == SPECPARAM_DECL) { + showvar(t); + } + } + + } + break; + + case SETTRACE: + trace_flag = 1; + normal_flag = 0; + break; + + case CLEARTRACE: + trace_flag = 0; + normal_flag = 0; + break; + + case T_UPDATETIMINGS: + if (TREE_CODE(current_scope) == MODULE_BLOCK) { + specify_update_timings(current_scope); + } + break; + + case T_NOLOG: + log_enable = 0; + break; + + case T_NOKEY: + key_enable = 0; + break; + + case T_LOG: + if (STMT_TASK_ARGS(node)) { + eval(TREE_EXPR_CODE(STMT_TASK_ARGS(node))); + bits_to_string(token_buffer, *--R, R_nbits); + fclose(log_file); + log_file = shell_fopen(token_buffer, "w+t"); + if (!log_file) { + warning("Cannot open log file '%s'", token_buffer, + NULL_CHAR); + log_available = 0; + log_enable = 0; + } else { + log_file_name = (char *) xmalloc(strlen(token_buffer)); + strcpy(log_file_name, token_buffer); + log_enable = 1; + log_available = 1; + } + } else /* no arguments */ + log_enable = 1; + break; + + case T_KEY: + if (STMT_TASK_ARGS(node)) { + eval(TREE_EXPR_CODE(STMT_TASK_ARGS(node))); + bits_to_string(token_buffer, *--R, R_nbits); + fclose(key_file); + key_file = shell_fopen(token_buffer, "wt"); + if (!key_file) { + warning("Cannot open key file '%s'", token_buffer, + NULL_CHAR); + key_available = 0; + key_enable = 0; + } else { + key_file_name = (char *) xmalloc(strlen(token_buffer)); + strcpy(key_file_name, token_buffer); + key_enable = 1; + key_available = 1; + } + } else /* no arguments */ + key_enable = 1; + break; + + case T_INPUT: + { + File *input; + extern int prompt_flag; /* in exec.c */ + + eval(TREE_EXPR_CODE(STMT_TASK_ARGS(node))); + bits_to_string(token_buffer, *--R, R_nbits); + input = File::fopen(token_buffer, "r+t"); + if (!input) { + error("Cannot open input file '%s'", token_buffer, + NULL_CHAR); + } else { +// extern char i_buf[]; + push_stream(fin, 0); + fin = input; + prompt_flag = 1; +// setbuf (fin, i_buf); + } + } + break; + + case STOP: + do_stop(); + if (STMT_TASK_ARGS(node) && TREE_EXPR(STMT_TASK_ARGS(node))) + print_info(); + break; + + case FINISH: + do_finish(); + break; + + case T_FCLOSE: + fclose_V(get_handle(TREE_EXPR_CODE(STMT_TASK_ARGS(node)))); + break; + + case T_MONITOROFF: + monitor_info.enable = 0; + dequeue_strobe(&final_strobe_queue, monitor_info.node); + break; + + case T_MONITORON: + monitor_info.enable = 1; + tickle_monitor_old(&final_strobe_queue, &monitor_info); + break; + + case FDISPLAY: + case T_FWRITE: + is_file = 1; + case DISPLAY: + case WRITE: + disp_common(node, DEC, is_file, 0); + break; + + case FDISPLAYH: + case T_FWRITEH: + is_file = 1; + case DISPLAYH: + case WRITEH: + disp_common(node, HEX, is_file, 0); + break; + + case FDISPLAYB: + case T_FWRITEB: + is_file = 1; + case DISPLAYB: + case WRITEB: + disp_common(node, BIN, is_file, 0); + break; + + case FDISPLAYO: + case T_FWRITEO: + is_file = 1; + case DISPLAYO: + case WRITEO: + disp_common(node, OCT, is_file, 0); + break; + +/* Strobes get here in one of two ways: 1) a call to $strobe; this queues + a message to strobe_first. 2) at the end of a simulation time; this + actually performs the action */ + case FSTROBE: + is_file = 1; + case STROBE: + if (!is_strobe_active(node)) + enqueue_strobe(&final_strobe_queue, node); + else + disp_common(node, DEC, is_file, 0); + break; + + case FSTROBEB: + is_file = 1; + case STROBEB: + if (!is_strobe_active(node)) + enqueue_strobe(&final_strobe_queue, node); + else + disp_common(node, BIN, is_file, 0); + break; + + case FSTROBEH: + is_file = 1; + case STROBEH: + if (!is_strobe_active(node)) + enqueue_strobe(&final_strobe_queue, node); + else + disp_common(node, HEX, is_file, 0); + break; + + case FSTROBEO: + is_file = 1; + case STROBEO: + if (!is_strobe_active(node)) + enqueue_strobe(&final_strobe_queue, node); + else + disp_common(node, OCT, is_file, 0); + break; + +/* Monitor gets here in one of two ways: 1) a call to $monitor which + sets up the markers; 2) at the end of a simulation time when the action + happens. When an argument changes, NotifyEvent calls enqueue_strobe + to queue the action. Note that this is slightly different from XL; + monitors in XL trigger when the argument expression changes -- here, + we trigger is any operand in the expression changes. Eg: $monitor (x+y); + if x changes from 2->3 and y changes from 3->2, we will trigger, XL + would not. If we implement PLI later, we'll change it then. */ + + case FMONITOR: + is_file = 1; + case MONITOR: + if (!is_strobe_active(node)) + monitor_args(node, &monitor_info); + else + disp_common(node, DEC, is_file, 0); + break; + + case FMONITORB: + is_file = 1; + case MONITORB: + if (!is_strobe_active(node)) + monitor_args(node, &monitor_info); + else + disp_common(node, BIN, is_file, 0); + break; + + case FMONITORH: + is_file = 1; + case MONITORH: + if (!is_strobe_active(node)) + monitor_args(node, &monitor_info); + else + disp_common(node, HEX, is_file, 0); + break; + + case FMONITORO: + is_file = 1; + case MONITORO: + if (!is_strobe_active(node)) + monitor_args(node, &monitor_info); + else + disp_common(node, OCT, is_file, 0); + break; + + case SHOWSTATS: + print_stats(); + break; + + case T_READMEMH: + radix = HEX; + do_readmem(node, radix); + break; + + case T_READMEMB: + radix = BIN; + do_readmem(node, radix); + break; + + case T_DUMPVARS: + if (!is_strobe_active(node)) { + if (dumpvar.disallow_dumpvars) { + runtime_error(node); + warning("Too late to call $dumpvars, this call ignored", + NULL, NULL); + break; + } + + /* Case 1: no arguments */ + if (!STMT_TASK_ARGS(node)) + dumpvars_all(); + /* Case 2: Parse arguments */ + else { + nbits_t nbits; + Group *val = + eval_(TREE_EXPR_CODE(STMT_TASK_ARGS(node)), &nbits); + + if (BVAL(val)) { + runtime_error(node); + error("Illegal value in first argument of $dumpvar", + NULL, NULL); + } + level = AVAL(val); + if (!level) + level = 64000; + for (t = TREE_CHAIN(STMT_TASK_ARGS(node)); t; + t = TREE_CHAIN(t)) + if (*tree_code_type[TREE_CODE(TREE_STMT(t))] == 'b') + dumpvars_scope_down(TREE_STMT(t), level); + else + dumpvars_mark(TREE_STMT(t)); + } + if (dumpvar.first_dumpvars) + enqueue_strobe(&final_strobe_queue, node); /* Schedule this to run at end of time */ + dumpvar.first_dumpvars = 0; + } + + /* Get here at the end of the time unit in which all dumpvars are + called */ + else { + dumpvar.disallow_dumpvars = 1; /* don't allow any more calls */ + dumpvar.unprinted = dumpvar.markers_first; + if (dumpvars_header(node)) { + dumpvars_enable(); + dumpvars_checkpoint("$dumpvars"); + } + } + break; + + case T_DUMPFILE: + if (dumpvar.disallow_dumpvars) { + runtime_error(node); + error("Too late to change dump file name", NULL, NULL); + break; + } + eval(TREE_EXPR_CODE(STMT_TASK_ARGS(node))); + bits_to_string(token_buffer, *--R, R_nbits); + dumpvar.file_name = (char *) xmalloc(strlen(token_buffer) + 1); + strcpy(dumpvar.file_name, token_buffer); + break; + + case T_DUMPON: + /* 2nd condition is needed in case $dumpon is called before dump + file is opened in dumpvar_header */ + if (!dumpvar.enabled && dumpvar.disallow_dumpvars) { + dumpvars_enable(); + dumpvars_checkpoint("$dumpon"); + } + break; + + case T_DUMPOFF: + if (dumpvar.enabled) { + dumpvars_disable(); + dumpvars_x("$dumpoff"); + } + break; + + case T_DUMPALL: + if (!dumpvar.enabled && dumpvar.disallow_dumpvars) + dumpvars_checkpoint("$dumpall"); + break; + + case T_DUMPFLUSH: + dumpvars_flush(); + break; + +/* $timeformat (units, prec, string, width) + default: time_precision, 0, "", 20 */ +#if 0 + case T_TIMEFORMAT: + nbits_t nbits; + int units, prec, width; + + t = STMT_TASK_ARGS(node); /* first arg: units */ + Group *val = eval_(TREE_EXPR_CODE(t), &nbits); + + if (BVAL(val)) { + runtime_error(node); + error("Illegal value in first argument of $timeformat", NULL, + NULL); + } + units = AVAL(val); + + t = TREE_CHAIN(t); /* 2nd arg: precision */ + Group *val = eval_(TREE_EXPR_CODE(t), &nbits); + + if (BVAL(val)) { + runtime_error(node); + error("Illegal value in second argument of $timeformat", NULL, + NULL); + } + prec = AVAL(val); + + t = TREE_CHAIN(t); /* 3rd arg: suffix string */ + eval(TREE_EXPR_CODE(t)); + bits_to_string(token_buffer, *--R, R_nbits); + + t = TREE_CHAIN(t); /* 2nd arg: precision */ + Group *val = eval_(TREE_EXPR_CODE(t), &nbits); + + if (BVAL(val)) { + runtime_error(node); + error("Illegal value in fourth argument of $timeformat", NULL, + NULL); + } + width = AVAL(val); + + timeformat(units, prec, token_buffer, width); + break; +#endif + } +} + +void exec_sysfunc(tree node, nbits_t nbits) +{ + Group *g; + struct Time64 tmpTime; + + switch FUNC_REF_SYSTYPE + (node) { + case USER_FUNC: + current_tf_instance = node; + { + strobe_queue_t *queue = is_strobe_active(node); + + /* Get here because of call to user task, call call_tf */ + if (!queue) { + call_call_tf(FUNC_REF_USERTF(node)); + eval_nbits(FUNC_REF_RETURNDECL(node), TREE_NBITS(node)); + /* Get here at end of time unit and [ro]synchronize had been armed */ + } else { + if (queue == &idle_strobe_queue) + call_misc_tf(FUNC_REF_USERTF(node), REASON_SYNCH); + else + call_misc_tf(FUNC_REF_USERTF(node), REASON_ROSYNCH); + } + } + break; + case F_TIME: + tmpTime = CurrentTime; + timescale_divide(&tmpTime, FUNC_REF_CONTEXT(node)); + AVAL(DECL_STORAGE(systime_return)) = tmpTime.timel; + BVAL(DECL_STORAGE(systime_return)) = 0; + AVAL(DECL_STORAGE(systime_return) + 1) = tmpTime.timeh; + BVAL(DECL_STORAGE(systime_return) + 1) = 0; + eval_nbits(systime_return, nbits); + break; + case F_STIME: + tmpTime = CurrentTime; + timescale_divide(&tmpTime, FUNC_REF_CONTEXT(node)); + AVAL(DECL_STORAGE(sysstime_return)) = tmpTime.timel; + BVAL(DECL_STORAGE(sysstime_return)) = 0; + eval_nbits(sysstime_return, nbits); + break; + case F_REALTIME: + tmpTime = CurrentTime; + REAL_(DECL_STORAGE(sysrealtime_return)) = + timescale_divide(&tmpTime, FUNC_REF_CONTEXT(node)); + eval_nbits(sysrealtime_return, nbits); + break; + case F_FOPEN: + eval((tree *) TREE_PURPOSE(FUNC_REF_INASSIGN(node))); + { + unsigned_32_t handle; + extern char *token_buffer; + + bits_to_string(token_buffer, *--R, R_nbits); + handle = fopen_V(token_buffer); + AVAL(DECL_STORAGE(sysopen_return)) = handle; + BVAL(DECL_STORAGE(sysopen_return)) = 0; + eval_nbits(sysopen_return, nbits); + break; + } + case F_RANDOM: + if (FUNC_REF_INASSIGN(node)) { /* seed present? */ + eval_1(FUNC_REF_INASSIGN(node)); + srand((unsigned) AVAL(*--R)); + g = *R; + AVAL(g) = ((int) rand() << 16) + rand(); /* new seed */ + *++R = g + 1; + store(FUNC_REF_INASSIGN(node), node); + } + AVAL(DECL_STORAGE(sysrand_return)) = + ((int) rand() << 16) + rand(); + BVAL(DECL_STORAGE(sysrand_return)) = 0; + eval_nbits(sysrand_return, nbits); + break; + case F_TEST_PLUSARGS: + eval((tree *) TREE_PURPOSE(FUNC_REF_INASSIGN(node))); + { + extern char *token_buffer; + tree t; + + bits_to_string(token_buffer, *--R, R_nbits); + AVAL(DECL_STORAGE(sysplus_return)) = 0; + BVAL(DECL_STORAGE(sysplus_return)) = 0; + for (t = plusargs; t; t = TREE_CHAIN(t)) { + if (!strcmp(token_buffer, (char *) TREE_PURPOSE(t))) { + /* Found a plusarg */ + AVAL(DECL_STORAGE(sysplus_return)) = 1; + break; + } + } + eval_nbits(sysplus_return, nbits); + break; + } + + } /* switch */ +} + +/* Process monitor */ + +void monitor_args(tree node, struct monitor_info *monitor_info) +{ + tree t; + extern struct Marker_info marker_info; + + + if (monitor_info->node != NULL_TREE) { + /* clear the markers from previous invocation */ + for (t = STMT_TASK_ARGS(monitor_info->node); t; t = TREE_CHAIN(t)) + if (TREE_EXPR(t)) + event_undo((Marker *) TREE_STMT(t)); + dequeue_strobe(&final_strobe_queue, monitor_info->node); + + } + monitor_info->node = node; + + for (t = STMT_TASK_ARGS(node); t; t = TREE_CHAIN(t)) + if (TREE_EXPR(t)) { + tree save_current_scope = current_scope; + current_scope = STMT_SCOPE(node); /* use this when resolving + hierarchical names */ + TREE_EXPR_CODE(t) = pass3_expr_marker(TREE_EXPR(t), + (Marker **) & + TREE_STMT(t), + (enum + marker_flags) (M_STROBE + + + M_FIXED), + (tree) monitor_info, + NULL_TREE); + current_scope = save_current_scope; + } + + enqueue_strobe(&final_strobe_queue, node); /* Tickle it now */ +} + +#if 0 +void monitor_args(tree node, struct monitor_info *monitor_info) +{ + SCB *save_scb; + tree t; + extern struct Marker_info marker_info; + + + save_scb = marker_info.current_scb; + if (monitor_info->scb) { + /* clear the markers from previous invocation */ + for (t = STMT_TASK_ARGS(monitor_info->scb->pc); t; + t = TREE_CHAIN(t)) + if (TREE_EXPR(t)) + event_undo(TREE_STMT(t)); + dequeue_strobe(&final_strobe_queue, monitor_info->scb->pc); + + FreeSCB(monitor_info->scb); + } + /* Only one $monitor allow at on time */ + monitor_info->scb = marker_info.current_scb = BuildSCB(node, NOLIST); +// monitor_info->scb->context->scope = readylist->current_scope; +//printf ("Scope is %s\n", IDENT(readylist->current_scope->block_common.name)); + /* Save a pointer to out info in "fork" (ok, so its available). */ +// monitor_info->scb->fork = (SCB*) monitor_info; + monitor_info->node = node; + + for (t = STMT_TASK_ARGS(node); t; t = TREE_CHAIN(t)) + if (TREE_EXPR(t)) + TREE_EXPR_CODE(t) = pass3_expr_marker(TREE_EXPR(t), + (Marker **) & + TREE_STMT(t), + M_STROBE + M_FIXED, + (tree) monitor_info); + enqueue_strobe(&final_strobe_queue, node); /* Tickle it now */ + marker_info.current_scb = save_scb; +} +#endif + +int +disp_common(tree node, enum radii default_radix, int is_file, + int check_only) +{ + tree t, t1; + Group *g; + Group *val; + nbits_t nbits; + int c, j; + ngroups_t i; + int attr = 0; + handle_t handle; + int is_integer = 0, fill_space = 1; + char length_spec[10] = "%", *ls = &length_spec[1]; + + t = STMT_TASK_ARGS(node); + if (is_file) { + if (!check_only) + handle = get_handle(TREE_EXPR_CODE(t)); + t = TREE_CHAIN(t); + } else + handle = 1; + + for (; t; t = t ? TREE_CHAIN(t) : t) /* If too few args, t will be NULL */ + // for (; t; t = TREE_CHAIN (t)) /* If too few args, t will be NULL */ + { + + t1 = TREE_EXPR(t); + + if (!t1) { /* Null argument */ + if (!check_only) + fprintf_V(handle, " "); + } else if (TREE_CODE(t1) == BIT_CST + && BIT_CST_RADIX(t1) == STRING_) { + is_integer = TREE_INTEGER_ATTR(t1); + g = BIT_CST_GROUP(t1) + bits_to_groups(TREE_NBITS(t1)); + for (i = bits_to_groups(TREE_NBITS(t1)); i >= 0; i--, g--) { + for (j = sizeof(Bit) - 1; j >= 0; j--) { + c = (AVAL(g) >> j * 8) & 255; + if (attr) { + if (!t) + return 0; + attr = 0; + *ls = 0; + switch (tolower(c)) { + case 't': + t = print_next_arg(handle, t, TIME_, + check_only, 1, fill_space, + NULL, STMT_SCOPE(node)); + ls = &length_spec[1]; + break; + case 'd': + t = print_next_arg(handle, t, DEC, check_only, + 1, fill_space, NULL, NULL); +// is_integer, fill_space, NULL, NULL); + ls = &length_spec[1]; + break; + case 'o': + t = print_next_arg(handle, t, OCT, check_only, + is_integer, fill_space, + NULL, NULL); + ls = &length_spec[1]; + break; + case 'h': + case 'x': + t = print_next_arg(handle, t, HEX, check_only, + is_integer, fill_space, + NULL, NULL); + ls = &length_spec[1]; + break; + case 'b': + t = print_next_arg(handle, t, BIN, check_only, + is_integer, fill_space, + NULL, NULL); + ls = &length_spec[1]; + break; + case 's': + t = print_next_arg(handle, t, STRING_, + check_only, is_integer, + fill_space, NULL, NULL); + ls = &length_spec[1]; + break; + case 'c': + t = print_next_arg(handle, t, CHAR_, + check_only, is_integer, + fill_space, NULL, NULL); + ls = &length_spec[1]; + break; + case 'e': + strcat(length_spec, "le"); + t = print_next_arg(handle, t, EXP_, check_only, + is_integer, fill_space, + length_spec, NULL); + ls = &length_spec[1]; + break; + case 'f': + strcat(length_spec, "lf"); + t = print_next_arg(handle, t, FLOAT_, + check_only, is_integer, + fill_space, length_spec, + NULL); + ls = &length_spec[1]; + break; + case 'g': + strcat(length_spec, "lg"); + t = print_next_arg(handle, t, EXPFLOAT_, + check_only, is_integer, + fill_space, length_spec, + NULL); + ls = &length_spec[1]; + break; + case 'm': + if (!check_only) +// print_scope (handle, readylist -> current_scope); + print_scope(handle, STMT_SCOPE(node)); + ls = &length_spec[1]; + break; + case '%': + if (!check_only) + fprintf_V(handle, "%%%%"); + break; + case '0': +// if (check_only) +// warning ("%%0 spec not supported and will be ignored"); + fill_space = 0; + attr = 1; /* look at next character anyway */ + *ls++ = c; + break; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '.': + if (ls < length_spec + 10) { + *ls++ = c; + attr = 1; + break; + } + default: + if (check_only) + return 0; + if (length_spec[1] != '\0') { + *ls = 0; + fprintf_V(handle, "%%%s", length_spec); + ls = &length_spec[1]; + *ls = 0; + } + fprintf_V(handle, "%%%c", c); + } + } else if (c == '%') { + attr = 1; + fill_space = 1; + } else if (c != 0 && !check_only) + fprintf_V(handle, "%c", c); + } + } + } + + else { + if (check_only) { + if (TREE_REAL_ATTR(TREE_EXPR(t)) && default_radix != DEC) + error + ("Illegal arguments in call to display system task", + NULL, NULL); + } else { + is_integer = TREE_INTEGER_ATTR(t1); + val = eval_(TREE_EXPR_CODE(t), &nbits); + if (TREE_REAL_ATTR(TREE_EXPR(t))) { +// AVAL (val) = REAL_ (val); +// BVAL (val) = 0; + print_datum_file(handle, val, (nbits_t) 0, nbits, + FLOAT_, is_integer, fill_space, "%g"); + } else { + print_datum_file(handle, val, (nbits_t) 0, nbits, + default_radix, is_integer, fill_space, + NULL); + } + } + } + } + if (!check_only) { + if (STMT_SYSTASK_TYPE(node) != WRITE && + STMT_SYSTASK_TYPE(node) != WRITEH && + STMT_SYSTASK_TYPE(node) != WRITEB && + STMT_SYSTASK_TYPE(node) != T_FWRITE && + STMT_SYSTASK_TYPE(node) != T_FWRITEH && + STMT_SYSTASK_TYPE(node) != T_FWRITEB) + fprintf_V(handle, "\n"); + fflush_V(handle); + } + return 1; +} + +tree +print_next_arg(handle_t handle, tree node, enum radii radix, int check, + int is_integer, int fill_space, char *spec, tree scope) +{ + Group *val; + nbits_t nbits; + tree t = TREE_CHAIN(node); + extern void timeformatprint(handle_t, tree, double); /* in verisys */ + + if (check) { + if (!t) { + error("More format specs than arguments", NULL, NULL); + return t; + } + + switch (radix) { + case HEX: + case OCT: + case BIN: + case DEC: + case STRING_: + case CHAR_: + if (radix != DEC && TREE_REAL_ATTR(TREE_EXPR(t))) + error("Illegal argument in call to display system task", + NULL, NULL); + break; +// case EXP_: case FLOAT_: case EXPFLOAT_: +// if (!TREE_REAL_ATTR (TREE_EXPR (t))) +// error ("Illegal argument in call to display system task", NULL, NULL); +// break; + } + return t; + } + val = eval_(TREE_EXPR_CODE(t), &nbits); + is_integer = TREE_INTEGER_ATTR(*TREE_EXPR_CODE(t)); + switch (radix) { + case EXP_: + case FLOAT_: + case EXPFLOAT_: + case TIME_: + if (!TREE_REAL_ATTR(TREE_EXPR(t))) + REAL_(val) = reg_to_real(val, nbits); + if (radix == TIME_) { + timeformatprint(handle, scope, REAL_(val)); + return t; + } + + break; + case DEC: + if (TREE_REAL_ATTR(TREE_EXPR(t))) + real_to_reg(REAL_(val), val, bits_to_groups(nbits)); + } + print_datum_file(handle, val, (nbits_t) 0, nbits, radix, + is_integer, fill_space, spec); + return t; +} + +void showvar(tree decl) +{ + enum tree_code code = TREE_CODE(decl); + + /* If this is a hierarchical reference, sort it out */ + if (code == SHADOW_REF) { + decl = TREE_CHAIN(decl); + code = TREE_CODE(decl); + } else if (code == ERROR_MARK) + return; + + if (code == ARRAY_DECL) + return; + printf_V("%s (", IDENT(DECL_NAME(decl))); + print_scope((handle_t) 1, DECL_CONTEXT(decl)); + printf_V(") "); + if (code != BLOCK_DECL) + if (DECL_THREAD(decl)) + decl = DECL_THREAD(decl); + + switch (code) { + case REG_VECTOR_DECL: + printf_V("reg [%lu, %lu] = ", MSB(decl), LSB(decl)); + trace_result(DECL_STORAGE(decl), TREE_NBITS(decl), + TREE_NBITS(decl), 0); + break; + case REG_SCALAR_DECL: + printf_V("reg = "); + trace_result(DECL_STORAGE(decl), TREE_NBITS(decl), + TREE_NBITS(decl), 0); + break; + case NET_VECTOR_DECL: + trace_net_type((enum tree_type) TREE_TYPE(decl)); + printf_V("[%lu, %lu] = ", MSB(decl), LSB(decl)); + trace_result(DECL_STORAGE(decl), TREE_NBITS(decl), + TREE_NBITS(decl), 0); + break; + case NET_SCALAR_DECL: + trace_net_type((enum tree_type) TREE_TYPE(decl)); + printf_V("= "); + trace_result(DECL_STORAGE(decl), TREE_NBITS(decl), + TREE_NBITS(decl), 0); + break; + case INTEGER_DECL: + printf_V("integer = "); + trace_result(DECL_STORAGE(decl), TREE_NBITS(decl), + TREE_NBITS(decl), 0); + break; + case PARAM_DECL: + printf_V("parameter = "); + trace_result(DECL_STORAGE(decl), TREE_NBITS(decl), + TREE_NBITS(decl), 0); + break; + case SPECPARAM_DECL: + printf_V("specparam = "); + trace_result(DECL_STORAGE(decl), TREE_NBITS(decl), + TREE_NBITS(decl), 0); + break; + case BLOCK_DECL: + switch (TREE_CODE(DECL_THREAD(decl))) { + case MODULE_BLOCK: + printf_V("MODULE"); + break; + case NAMED_BLOCK: + printf_V("NAMED BLOCK"); + break; + case TASK_BLOCK: + printf_V("TASK"); + break; + case FUNCTION_BLOCK: + printf_V("FUNCTION"); + break; + } + printf_V("\n"); + return; + + default: + break; + } + if (var_debug_flag) { +// printf_V (" [line %lu, file '%s', time %lu]\n", DECL_UPDATE_LINE (decl), +// DECL_UPDATE_FILE (decl), DECL_UPDATE_TIME (decl)); + if (DECL_UPDATE_FILE(decl)) { + printf_V("\t[line %lu, file '%s', time ", + DECL_UPDATE_LINE(decl), DECL_UPDATE_FILE(decl)); + print_time(&DECL_UPDATE_TIME(decl)); + printf_V("]\n"); + } else + printf("\t[** Untouched **]\n"); + } else + printf_V("\n"); +} + +void do_readmem(tree node, enum radii radix) +{ + tree cst_node, decl, arg; + Group *val; + nbits_t nbits, length, numchars; + Bit addr, start_addr, end_addr, expected_words, num_words = 0; + File *readmem_file; + File *save_fin; + char *readmem_file_name; + int c, enable_check = 0; + int inc = 1; /* assume increment by one; could be -1 */ + extern char *token_buffer; /* defined in lex.c */ + + lineno = STMT_SOURCE_LINE(node); + input_filename = STMT_SOURCE_FILE(node); + arg = STMT_TASK_ARGS(node); /* 1st arg: file name */ + + /* First, try to open file */ + eval(TREE_EXPR_CODE(arg)); + bits_to_string(token_buffer, *--R, R_nbits); + readmem_file_name = (char *) xmalloc((strlen(token_buffer) + 1) + * sizeof(char)); + strcpy(readmem_file_name, token_buffer); + readmem_file = File::fopen(readmem_file_name, "rt"); + if (!readmem_file) { + error("Cannot open readmem file '%s'", token_buffer, NULL_CHAR); + return; + } + save_fin = fin; + fin = readmem_file; + + arg = TREE_CHAIN(arg); /* 2nd arg: array name */ + decl = TREE_PURPOSE(arg); + if (HIERARCHICAL_ATTR(decl)) + decl = resolve_hierarchical_name(decl); + + /* If low bounds not specified, use array's low bounds */ + arg = TREE_CHAIN(arg); /* 3rd arg: low bounds */ + if (!arg) + start_addr = addr = ARRAY_LO(decl); + else { + val = eval_(TREE_EXPR_CODE(arg), &nbits); + if (BVAL(val)) { + error("Illegal index value in call to %s", + STMT_TASK_NAME(node), NULL_CHAR); + goto readmem_cleanup; + } else + start_addr = addr = AVAL(val); + + arg = TREE_CHAIN(arg); /* 4th arg: high bounds */ + } + /* If array high bounds not specified, use infinity */ + if (!arg) + end_addr = (Bit) - 1; + else { + val = eval_(TREE_EXPR_CODE(arg), &nbits); + if (BVAL(val)) { + error("Illegal index value in call to %s", + STMT_TASK_NAME(node), NULL_CHAR); + goto readmem_cleanup; + } else + end_addr = AVAL(val); + + enable_check = 1; /* turn on line checking */ + if (VECTOR_DIRECTION_ATTR(decl)) + expected_words = end_addr - start_addr + 1; + else + expected_words = start_addr - end_addr + 1; + } + /* if specified bounds is backwards or vector is backwards, set negative + increment */ + if (addr > end_addr || !VECTOR_DIRECTION_ATTR(decl)) + inc = -1; + + /* allocate a single constant node to be used for all entries */ + cst_node = build_bit_cst(TREE_NBITS(decl), radix); + + length = TREE_NBITS(decl); + + /* Read file, look for '@' or anything else. If too many digits, + give warning and stop. */ + + lineno = 1; + input_filename = readmem_file_name; + for (c = readmem_file->fgetc(); c != EOF; c = readmem_file->fgetc()) { + c = skip_white_space(c); + if (c == EOF) + break; + if (c == '@') { + readmem_file->fscanf("%lx", &addr); + if (enable_check) { + if (VECTOR_DIRECTION_ATTR(decl)) { + if (addr < start_addr || addr > end_addr) + yyerror + ("Address outside specified range; aborting readmem"); + } else { + if (addr > start_addr || addr < end_addr) + yyerror + ("Address outside specified range; aborting readmem"); + } + } + continue; + } + fin->fungetc(c); + + numchars = read_num_token(token_buffer); + if (radix == HEX) { + if ((numchars - 1) * 4 >= length) { + yyerror("Line too long during $readmemh; aborting"); + goto readmem_cleanup; + } + } else { + if (numchars > length) { + yyerror("Line too long during $readmemb; aborting"); + goto readmem_cleanup; + } + } + parse_base_const1(radix, token_buffer + numchars - 1, length, + numchars, cst_node); + + eval_1(cst_node); + store_array(decl, addr); + + num_words++; + addr += inc; + } + + readmem_cleanup: + if (enable_check) + if (num_words != expected_words) + warning + ("Number of words read is not the number of words expected", + NULL_CHAR, NULL_CHAR); + + /* + * check if file has already been closed + */ + if (fin) { + readmem_file->fclose(); + } + fin = save_fin; +} + +/************************************************************** + * + * do_stop + * - stop the simulation + * + ************************************************************* + */ + +void do_stop() +{ + normal_flag = 0; + single_step_flag = 1; + printf_V("Stop at simulation time "); + print_time(&CurrentTime); + printf_V("\n"); + broadcast_tf(reason_interactive); +} + +/************************************************************** + * + * do_finish + * - exit the simulation + * + ************************************************************* + */ + +void do_finish() +{ + broadcast_tf(reason_finish); + printf_V("Exiting %s at time ", VERIWELL); + print_time(&CurrentTime); + printf_V("\n"); + print_info(); + finish(); +} + +/************************************************************** + * + * init_systask + * - initializes global and static variables for systask.c + * + ************************************************************* + */ + +void init_systask_1() +{ + systime_once = 0; /* initialize the following only once */ + sysstime_once = 0; /* initialize the following only once */ + sysopen_once = 0; /* initialize the following only once */ + sysrand_once = 0; + sysrealtime_once = 0; /* initialize the following only once */ + sysplus_once = 0; /* initialize the following only once */ + monitor_info.enable = 1; + monitor_info.node = NULL_TREE; + systime_return = NULL_TREE; + sysstime_return = NULL_TREE; + sysopen_return = NULL_TREE; + sysrand_return = NULL_TREE; + sysrealtime_return = NULL_TREE; + sysplus_return = NULL_TREE; + roFlag = FALSE; + pliInstanceList = NULL_TREE; + } diff --git a/src/systask.h b/src/systask.h new file mode 100644 index 0000000..bd72be3 --- /dev/null +++ b/src/systask.h @@ -0,0 +1,172 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* SYSTASK.H - Enums for all internal system tasks and functions */ + +/* These are temporary until PLI is used internally */ + +#ifndef SYSTASK_H +#define SYSTASK_H + +// public methods + +#define NUM_SYSTEM_TASKS 0 +#define NUM_SYSTEM_FUNCS 0 + +enum systask_type { + NO_SYSTYPE = 0, + DISPLAY, + DISPLAYH, + DISPLAYB, + DISPLAYO, + WRITE, + WRITEH, + WRITEB, + WRITEO, + FDISPLAY, + FDISPLAYH, + FDISPLAYB, + FDISPLAYO, + T_FWRITE, + T_FWRITEH, + T_FWRITEB, + T_FWRITEO, + MONITOR, + MONITORB, + MONITORH, + MONITORO, + FMONITOR, + FMONITORB, + FMONITORH, + FMONITORO, + STROBE, + STROBEB, + STROBEH, + STROBEO, + FSTROBE, + FSTROBEB, + FSTROBEH, + FSTROBEO, + STOP, + FINISH, + SETTRACE, + CLEARTRACE, + SCOPE, + SHOWSCOPES, + SHOWSTATS, + T_FCLOSE, + T_LOG, + T_NOLOG, + T_KEY, + T_NOKEY, + T_INPUT, + T_SHOWVARS, + T_MONITORON, + T_MONITOROFF, + T_READMEMH, + T_READMEMB, + T_WWAVES, + T_DUMPVARS, + T_DUMPON, + T_DUMPOFF, + T_DUMPFILE, + T_DUMPALL, + T_DUMPFLUSH, + T_UPDATETIMINGS, + T_TIMEFORMAT, + T_GWAVES, + SYSTEM_TASK, + USER_TASK, + LAST_TASK +}; + +enum sysfunction_type { +// NO_SYSFTYPE = LAST_TASK, + NO_SYSFTYPE = 1000, + F_TIME, + F_STIME, + F_REALTIME, + F_FOPEN, + F_RANDOM, + F_TEST_PLUSARGS, + SYSTEM_FUNC, + USER_FUNC, + LAST_FUNCTION +}; + +struct systask_info { + char *name; + enum systask_type type; +}; + +struct sysfunction_info { + char *name; + enum sysfunction_type type; +}; + + +enum systask_type lookup_systask(char *, p_tfcell *); +enum sysfunction_type lookup_sysfunction(char *, p_tfcell *); + +extern int roFlag; + +void init_sysfunction(tree); +void init_systask(tree); +p_tfcell lookup_user_func(char *); +p_tfcell lookup_user_task(char *); +void call_check_tf(p_tfcell); +void call_misc_tf(p_tfcell, int); +void call_misc_tf1(p_tfcell, int, int); +void call_call_tf(p_tfcell); +int call_size_tf(p_tfcell); +int count_args(tree); +void exec_systask(tree node); +void exec_sysfunc(tree node, nbits_t); +void monitor_args(tree node, struct monitor_info *monitor_info); +int disp_common(tree node, enum radii default_radix, int is_file, + int check_only); +tree print_next_arg(handle_t handle, tree node, enum radii radix, + int check, int is_integer, int fill_space, char *spec, + tree); +void broadcast_tf(int reason); +void showvar(tree decl); +void do_readmem(tree node, enum radii radix); +void init_systask_1(void); + +p_tfcell lookup_user_tf(char *name); +void bits_to_string(char *buffer, Group * g, nbits_t nbits); +handle_t get_handle(tree * code); +tree init_function_return(char *name, int size, enum tree_code); +int args_one(int num_args, char *taskname); +int args_zero(int num_args, char *taskname); +void arg_common(tree args); +void do_stop(void); +void do_finish(void); + +void pli_asynccall(PliInfo_t *); +int args_zero_or_one(int, char *); +void systaskDoDelay(tree); +int call_size_tf(p_tfcell p_tf); + +// private methods + +#ifdef SYSTASK_C +#endif // SYSTASK_C + +#endif // SYSTASK_H diff --git a/src/timescal.cc b/src/timescal.cc new file mode 100644 index 0000000..0892b09 --- /dev/null +++ b/src/timescal.cc @@ -0,0 +1,364 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* TIMESCAL.C - routines to support timescale and related stuff */ + +#define TIMESCAL_C + +#include +#include +#include +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "schedule.h" +#include "scope.h" +#include "pass3.h" +#include "timescal.h" +#include "acc_user.h" +#include "io.h" +#include "pli.h" +#include "systask.h" +#include "glue.h" + + +#define MIN(x,y) ((xy)?x:y) + +/* Timescales global info */ + +enum any_enum { T_NONE, T_YES, T_NO }; + +static struct { + int smallest_scale; + enum any_enum any; + int unit; + int prec; +} timescale_global; + +/* For timescales, convert units into a numerical form */ + +static int timescaleunits(char *units) +{ + if (!strncmp(units, "s", 1)) + return 0; + else if (!strncmp(units, "ms", 2)) + return -3; + else if (!strncmp(units, "us", 2)) + return -6; + else if (!strncmp(units, "ns", 2)) + return -9; + else if (!strncmp(units, "ps", 2)) + return -12; + else if (!strncmp(units, "fs", 2)) + return -15; + else + return 1; +} + +static char *unitnames[] = { "s", "ms", "us", "ns", "ps", "fs" }; +static int unitnums[] = { 1, 100, 10 }; + +char *timescale_string(int units, char *unitbuf) +{ + int unit; + int remain; + + unit = (units + 2) / 3; + remain = units % 3; + +// printf ("(%d,%d,%d)\n", remain, unit, units); + sprintf(unitbuf, "%d%s", unitnums[remain], unitnames[unit]); + return unitbuf; +} + +void timescale_get(tree scope, int *unit, int *prec) +{ + tree module; /* The current module */ + + module = module_of(scope); + *unit = MODULE_TIME_UNIT(module); + *prec = MODULE_TIME_PREC(module); +} + +/* Return the scaling factor for a particular scope. */ + +double timescale_precision(tree scope) +{ + double multiplier = 1; + int unit, prec, i; + + timescale_get(scope, &unit, &prec); /* get unit, prec */ + + /* Determine scaling factor. This is based on the units for this module + and the smallest precision of all the modules. */ + + for (i = timescale_global.smallest_scale - unit; i > 0; i--) + multiplier *= 10; + + return multiplier; +} + +/* Scale the simulation time to the timescale of the scope */ + +double timescale_divide(struct Time64 *ptime, tree scope) +{ + double x, y; + const double pow2_32 = ldexp((double) 1, 32); + + /* First, convert time to real */ + x = ptime->timeh; + x = ldexp(x, sizeof(Bit) * 8); /* shift by 32 */ + x += ptime->timel; + + /* Next, divide by the precision */ + x /= timescale_precision(scope); + + /* Finally, convert back into integer */ + + y = x + 0.5; /* round to compensate for small errors in conversion */ + + ptime->timel = (unsigned int) fmod(y, pow2_32); /* mod 2^32 */ + ptime->timeh = (unsigned int) ldexp(y, -(sizeof(Bit) * 8)); /* div 2^32 */ + return x; +} + +/* process the `timescale directive; save info in global table. Subsequent + module definitions will copy the global data into the module block. + Return non-zero if successful. */ + +int process_timescale(void) +{ + int magnitude, unit, prec, u; + char buffer[32]; + char *ptr; + int c; + if (current_scope) { + warning("`timescale directive must be outside a module", NULL, + NULL); + return 0; + } + + if (timescale_global.any == T_NO) { + error("Modules defined before `timescale encountered", NULL, NULL); + return 0; + } + c = fin->fgetc(); + while (strchr(" \t", c)) { + c = fin->fgetc(); + } + ptr = buffer; + while (isdigit(c) && ptr < buffer + sizeof(buffer) - 1) { + *ptr++ = c; + c = fin->fgetc(); + } + *ptr = 0; + magnitude = atoi(buffer); + unit = magnitude == 1 ? 0 : + magnitude == 10 ? -1 : magnitude == 100 ? -2 : 1; + + if (unit == 1) { + error("`timescale unit spec must be 1, 10 or 100", NULL, NULL); + return 0; + } + while (strchr(" \t", c)) { + c = fin->fgetc(); + } + ptr = buffer; + while (isalpha(c) && ptr < buffer + sizeof(buffer) - 1) { + *ptr++ = c; + c = fin->fgetc(); + } + *ptr = 0; + u = timescaleunits(buffer); /* Convert units to number */ + unit -= u; + + if (u == 1) { + error("`timescale units must be s, ms, us, ps, ot fs", NULL, NULL); + return 0; + } + while (strchr(" \t", c)) { + c = fin->fgetc(); + } + if (c != '/') { + error("`timescale precision spec is missing /", NULL, NULL); + } + c = fin->fgetc(); + while (strchr(" \t", c)) { + c = fin->fgetc(); + } + ptr = buffer; + while (isdigit(c) && ptr < buffer + sizeof(buffer) - 1) { + *ptr++ = c; + c = fin->fgetc(); + } + *ptr = 0; + magnitude = atoi(buffer); + prec = magnitude == 1 ? 0 : + magnitude == 10 ? -1 : magnitude == 100 ? -2 : 1; + + if (prec == 1) { + error("`timescale precision spec must be 1, 10 or 100", NULL, + NULL); + return 0; + } + while (strchr(" \t", c)) { + c = fin->fgetc(); + } + ptr = buffer; + while (isalpha(c) && ptr < buffer + sizeof(buffer) - 1) { + *ptr++ = c; + c = fin->fgetc(); + } + *ptr = 0; + u = timescaleunits(buffer); /* Convert units to number */ + prec -= u; + + if (u == 1) { + error("`timescale precision must be s, ms, us, ps, or fs", NULL, + NULL); + return 0; + } + if (isspace(c)) { + fin->fungetc(c); + } + timescale_global.unit = unit; + timescale_global.prec = prec; + + /* keep track of the smallest precision in the model. */ + + timescale_global.smallest_scale = + MAX(timescale_global.smallest_scale, prec); + timescale_global.any = T_YES; /* into timescales */ + return 1; +} + +/* This is called from build_module to set up timescales or the module */ + +void module_timescale(tree module) +{ + if (timescale_global.any == T_NONE || timescale_global.any == T_NO) { + MODULE_TIME_UNIT(module) = 0; + MODULE_TIME_PREC(module) = 0; + timescale_global.any = T_NO; /* no timescale; don't allow any now */ + } else { + MODULE_TIME_UNIT(module) = timescale_global.unit; + MODULE_TIME_PREC(module) = timescale_global.prec; + } +} + +/* Modify the tree structure for delay to compensate for timescales, + constant folding, and real conversion. This is called by pass3_delay + and pass3_delay_stmt. + */ + +tree *timescale_scale(tree delay) +{ + tree const_node; /* constant node for folding */ + Bit intdelay; + double multiplier; /* precision multiplier */ + double tmpfloat; + Group *val; + nbits_t nbits; + tree *expr; + + multiplier = timescale_precision(current_scope); + + /* Scale the delay using the units and the smallest precision of + each timescale directive in the model. If scaling isn't necessary, + just convert from real, if necessary, and return. If it is, multiply by + a power of 10. If the delay is a constant, do it here. If not, + insert a unary operator to the expression. + */ + + /* Note that hierarchical references will have the constant bit enabled. + Make sure that this isn't counted! */ + if (TREE_CONSTANT_ATTR(delay) && TREE_CODE(delay) != IDENTIFIER_NODE) { + val = get_const(delay, &nbits); + // ??? mdh - this needs to convert to 64 bits cleanly + if (TREE_REAL_ATTR(delay)) { + tmpfloat = REAL_(val) * multiplier + 0.5; + intdelay = (unsigned int) tmpfloat; + } else { + if (!BVAL(val)) + intdelay = AVAL(val) * (unsigned int) multiplier; + else + intdelay = 0; /* delay had X or Z */ + } + const_node = build_int_cst(intdelay); + // force all time to 64 bits + expr = pass3_expr(const_node); /* Use this for the delay expression */ + adjust_nbits(64, &const_node, expr); + return expr; + } + + /* Not a constant, and requires scaling. Add the scaling op (which will + work with both real and integral delays). + */ + + if (multiplier != 1) { + // ??? mdh - time needs to 64 bits + delay = + build_binary_op(MULT_EXPR, delay, build_int_cst(multiplier)); + } + + /* return the code for either scaled or unscaled delays */ + + expr = pass3_expr_convert(delay, eINT); + // force all time to 64 bits + adjust_nbits(64, &delay, expr); + return expr; +} + +/* This is for $timeformat */ + + +/* Execute $timeformat system call. Assumes pass3 checked everything out. */ +#if 0 +void time_format(int units, int prec, char *suffix, int width) +{ + timeformat.units = units; + timeformat.precision = prec; + timeformat.width = width; + + if (timeformat.suffix) + free(timeformat.suffix); + + timeformat.suffix = (char *) xmalloc(strlen(suffix) + 2); + if (!timeformat.suffix) { + error("Not enough memory to save timeformat suffix!", NULL, NULL); + return; + } + strcpy(timeformat.suffix, suffix); +} +#endif +int get_tick_precision() +{ + return (timescale_global.smallest_scale); +} + + +void init_timescale() +{ + timescale_global.smallest_scale = 0; + timescale_global.any = T_NONE; + + +} diff --git a/src/timescal.h b/src/timescal.h new file mode 100644 index 0000000..327f5d5 --- /dev/null +++ b/src/timescal.h @@ -0,0 +1,38 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* TIMESCALE.H - Prototypes for timecale.c */ + +#ifndef TIMESCALE_H +#define TIMESCALE_H + +int process_timescale(void); +void module_timescale(tree); +tree *timescale_scale(tree); +double timescale_divide(struct Time64 *, tree); +void init_timescale(void); +int get_tick_precision(void); +void timescale_get(tree, int *, int *); +void time_format(int, int, Group *, nbits_t, int); +double timescale_precision(tree scope); +char *timescale_string(int, char *); + +#ifdef TIMSCAL_C +#endif // TIMSCAL_C +#endif /* TIMESCALE_H */ diff --git a/src/trace.cc b/src/trace.cc new file mode 100644 index 0000000..7f5ae7b --- /dev/null +++ b/src/trace.cc @@ -0,0 +1,473 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* TRACE.C - Print statements as they are being executed */ + +#define TRACE_C + +#include +#include "vtypes.h" +#include "tree.h" +#include "runtime.h" +#include "schedule.h" +#include "io.h" +#include "print.h" +#include "trace.h" + +void +trace_result(Group * val, nbits_t print_nbits, nbits_t nbits, + int integer_attr) +{ + print_datum(val, print_nbits, nbits, HEX, 0, 0); + printf_V(", "); + print_bcd((handle_t) 1, val, nbits, integer_attr, 0); +// printf_V("\n"); + HEAPTEST("trace_result 2"); +} + +static void trace_lval(tree lval) +{ + enum tree_code code = TREE_CODE(lval); + Group g; + + switch (code) { + case PART_REF: + printf_V("%s", IDENTIFIER_POINTER(DECL_NAME(PART_DECL(lval)))); + printf_V("["); + g.bit.aval = PART_MSB(lval); + g.bit.bval = 0; + /* Since we don't keep around the code for the index epression, + we don't have the actual nbits if the expression is a since + hierarchical name. Use 32 bits in that case (the default size + for hierarchical names). */ + trace_result(&g, TREE_NBITS(PART_MSB_(lval)), + TREE_NBITS(PART_MSB_(lval)), + TREE_INTEGER_ATTR(PART_MSB_(lval))); + printf_V(": "); + g.bit.aval = PART_LSB(lval); + trace_result(&g, TREE_NBITS(PART_LSB_(lval)), + TREE_NBITS(PART_LSB_(lval)), + TREE_INTEGER_ATTR(PART_LSB_(lval))); + printf_V("]"); + break; + + default: + print_expr(lval); + } +} + +static void +trace_assign_result(tree lval, Group * val, nbits_t nbits, + int integer_attr) +{ + trace_lval(lval); + printf_V(" = "); +// trace_result (val, R_nbits, nbits, integer_attr); + if (TREE_REAL_ATTR(lval)) + printf_V("%lg", REAL_(val)); + else + trace_result(val, nbits, nbits, integer_attr); + printf_V(";\n"); +} + +void trace_net_type(enum tree_type type) +{ + switch (type) { + case NET_WIRE_TYPE: + printf_V("WIRE "); + break; + case NET_TRI_TYPE: + printf_V("TRI "); + break; + case NET_WAND_TYPE: + printf_V("WAND "); + break; + case NET_TRIAND_TYPE: + printf_V("TRIAND "); + break; + case NET_WOR_TYPE: + printf_V("WOR "); + break; + case NET_TRIOR_TYPE: + printf_V("TRIOR "); + break; + case NET_TRI0_TYPE: + printf_V("TRI0 "); + break; + case NET_TRI1_TYPE: + printf_V("TRI1 "); + break; + case (int) NULL: + printf_V("ASSIGN "); + break; + default: + printf_V("(NOT KNOWN) "); + break; + } +} + +static tree current_trace_scope = NULL_TREE; + +void trace_stmt(tree node, Group * g, int skip, int val) +{ + tree lval, tmp_tree; + extern int in_simulation; + enum tree_code code = TREE_CODE(node); + tree scope; + + if (!in_simulation) + return; + + if (code == FUNCTION_REF) { + printf_V("L%d ", FUNC_REF_LINE(node)); + printf_V("\"%s\" ", FUNC_REF_FILE(node)); + } else { + printf_V("L%d ", STMT_SOURCE_LINE(node)); + printf_V("\"%s\" ", STMT_SOURCE_FILE(node)); + } + + if (*tree_code_type[code] == 's') { + scope = STMT_SCOPE(node); + printf_V("("); + print_scope((handle_t) 1, scope); + printf_V(")"); + } else if (*tree_code_type[code] == 'g') { + scope = GATE_SCOPE(node); + printf_V("("); + print_scope((handle_t) 1, scope); + printf_V(")"); + } else { + printf_V("("); + if (*tree_code_type[code] == 'd') { + scope = DECL_CONTEXT(node); + print_scope((handle_t) 1, DECL_CONTEXT(node)); + } else if (code == FUNCTION_REF) { + scope = FUNC_REF_CONTEXT(node); + print_scope((handle_t) 1, FUNC_REF_CONTEXT(node)); + } else { /* scopying blocks get here (eg. task_block upon return from task) */ + + scope = node; + print_scope((handle_t) 1, node); + } + printf_V(")"); + } + +/* Work on this later... + if (scope != current_trace_scope) + { + printf_V ("*** New Scope: "); + print_scope ((handle_t) 1, scope); + printf_V ("\n"); + current_trace_scope = scope; + } +*/ +// if (BLOCK_UP (readylist -> current_scope)) { + printf_V(": "); + { + HEAPTEST("Heap Corrupted (Detected in Trace)"); + } + switch (code) { + case ALWAYS_BLOCK: + case INITIAL_BLOCK: + case BEGIN_STMT: + case END_STMT: + case BEGIN_NAMED_STMT: + case END_NAMED_STMT: + case FORK_STMT: + case JOIN_STMT: + case FOREVER_STMT: + case ARROW_STMT: + case TASK_STMT: + case SYSTASK_STMT: + case FUNCTION_REF: + case DISABLE_STMT: + case DEASSIGN_STMT: + case RELEASE_STMT: + case NULL_STMT: + print_node(node); + printf_V("\n"); + break; + + case WHILE_STMT: + print_node(node); + printf_V(" >> "); + if (skip) + printf_V("FALSE\n"); + else + printf_V("TRUE\n"); + break; + + case (IF_STMT): + print_node(node); + printf_V(" >>> "); + if (skip) + printf_V("skipping\n"); + else + printf_V("continue\n"); + break; + + case REPEAT_STMT: + case REPEAT_INIT_STMT: + print_node(node); + printf_V(" >>> "); + tmp_tree = + H_(*STMT_REPEAT_EXPR_CODE(node), STMT_REPEAT_EXPR(node)); + trace_result(g, TREE_NBITS(tmp_tree), TREE_NBITS(tmp_tree), + TREE_INTEGER_ATTR(tmp_tree)); + printf_V("\n"); + break; + + case CASE_STMT: + case CASEX_STMT: + case CASEZ_STMT: + print_node(node); + printf_V(" >>> case ("); + trace_result(g, R_nbits, R_nbits, + TREE_INTEGER_ATTR(STMT_CASE_EXPR(node))); + printf_V(")\n"); + break; + + case ASSIGN_STMT: + case ASSIGN_PROC_STMT: + case FORCE_STMT: + print_node(node); + if (!TREE_INTEGER_ATTR(STMT_ASSIGN_RVAL(node)) + || *tree_code_type[TREE_CODE(STMT_ASSIGN_RVAL(node))] != 'c') { + printf_V(" >>> "); + tmp_tree = + H_(*STMT_ASSIGN_RVAL_CODE(node), STMT_ASSIGN_RVAL(node)); + + trace_assign_result(STMT_ASSIGN_LVAL(node), g, + TREE_NBITS(tmp_tree), + TREE_INTEGER_ATTR(tmp_tree)); + } else + printf_V("\n"); + break; + + case ASSIGN_DELAY_STMT: + case ASSIGN_EVENT_STMT: + print_node(node); + printf_V(" >>> "); + + if (!val) { /* after the event is triggered */ + if (!TREE_INTEGER_ATTR(STMT_ASSIGN_RVAL(node)) + || *tree_code_type[TREE_CODE(STMT_ASSIGN_RVAL(node))] != + 'c') { + + + tmp_tree = + H_(*STMT_ASSIGN_RVAL_CODE(node), + STMT_ASSIGN_RVAL(node)); + trace_assign_result(STMT_ASSIGN_LVAL(node), g, + TREE_NBITS(tmp_tree), + TREE_INTEGER_ATTR(tmp_tree)); + } else + printf_V("\n"); + } else { + if (code == ASSIGN_DELAY_STMT) { + printf_V(" #("); + trace_result(g, R_nbits, R_nbits, + TREE_INTEGER_ATTR(STMT_DELAY_EXPR(node))); + printf_V(") "); + } else { + printf_V(" @() "); + } + tmp_tree = + H_(*STMT_ASSIGN_RVAL_CODE(node), STMT_ASSIGN_RVAL(node)); + trace_assign_result(STMT_ASSIGN_LVAL(node), + DECL_STORAGE(STMT_ASSIGN_TMP(node)), + TREE_NBITS(tmp_tree), + TREE_INTEGER_ATTR(tmp_tree)); + } + break; + + case ASSIGN_NONBLK_DELAY_STMT: + case ASSIGN_NONBLK_EVENT_STMT: + print_node(node); + + if (!val) { /* after the event is triggered */ + if (!TREE_INTEGER_ATTR(STMT_ASSIGN_RVAL(node)) + || *tree_code_type[TREE_CODE(STMT_ASSIGN_RVAL(node))] != + 'c') { + + printf_V(" >>> "); + + tmp_tree = + H_(*STMT_ASSIGN_RVAL_CODE(node), + STMT_ASSIGN_RVAL(node)); + trace_assign_result(STMT_ASSIGN_LVAL(node), g, + TREE_NBITS(tmp_tree), + TREE_INTEGER_ATTR(tmp_tree)); + } else + printf_V("\n"); + } else { + printf_V(" >>> "); + + tmp_tree = + H_(*STMT_ASSIGN_RVAL_CODE(node), STMT_ASSIGN_RVAL(node)); + if (code == ASSIGN_NONBLK_DELAY_STMT) { + printf_V(" #("); + trace_result(g, R_nbits, R_nbits, + TREE_INTEGER_ATTR(STMT_DELAY_EXPR + (STMT_ASSIGN_DELAY(node)))); + printf_V(") "); + trace_assign_result(STMT_ASSIGN_LVAL(node), + DECL_STORAGE(((SCB *) + STMT_ASSIGN_TMP(node))-> + here.decl), +// DECL_STORAGE ((tree) ((SCB *) STMT_ASSIGN_TMP (node))->fork), + TREE_NBITS(tmp_tree), + TREE_INTEGER_ATTR(tmp_tree)); + } else { + printf_V(" @() "); + trace_assign_result(STMT_ASSIGN_LVAL(node), + DECL_STORAGE(STMT_ASSIGN_TMP(node)), +// DECL_STORAGE ((tree) ((SCB *) STMT_ASSIGN_TMP (node))->fork), + TREE_NBITS(tmp_tree), + TREE_INTEGER_ATTR(tmp_tree)); + } + } + break; + + case NET_VECTOR_DECL: + case NET_SCALAR_DECL: + if (!val) { +// printf_V ("(port propagation (down))\n"); +// return; + } + + trace_net_type((enum tree_type) TREE_TYPE(node)); + print_expr(node); + printf_V(" >>> NET = "); + trace_result(g, TREE_NBITS(node), TREE_NBITS(node), 0); +// trace_result (g, TREE_NBITS (node), R_nbits, 0); +// trace_assign_result (lval, g, R_nbits, 0); + printf_V("\n"); + break; + + case GATE_INSTANCE: + printf_V("GATE >>> 1'b"); + switch (GATE_OUTPUT(node)) { + case ONE: + printf_V("1"); + break; + case ZERO: + printf_V("0"); + break; + case X: + printf_V("x"); + break; + case Z: + printf_V("z"); + break; + } + + printf_V("\n"); + break; + + case ASSIGN_CONT_STMT: + if (TREE_CHAIN(node) && + TREE_CODE(TREE_CHAIN(node)) == ASSIGN_CONT_STMT) + lval = STMT_ASSIGN_LVAL(TREE_CHAIN(node)); + else + lval = STMT_ASSIGN_LVAL(node); + /* first part of statement (with most info) is pointed to by TREE_CHAIN */ + + trace_net_type((enum tree_type) TREE_TYPE(lval)); + print_delay(STMT_ASSIGN_DELAY(node)); +// printf_V (" "); + print_expr(lval); +// printf_V (" = "); +// if (STMT_ASSIGN_RVAL (node)) +// trace_expr (STMT_ASSIGN_RVAL (node)); + printf_V(" >>> "); + trace_assign_result(lval, g, R_nbits, + TREE_INTEGER_ATTR(STMT_ASSIGN_RVAL(node))); + break; + + case (FOR_STMT): + print_node(node); + printf_V(") >>> "); + if (val) { + trace_assign_result(STMT_ASSIGN_LVAL(STMT_FOR_ASSIGN(node)), g, + R_nbits, + TREE_INTEGER_ATTR(STMT_ASSIGN_RVAL + (STMT_FOR_ASSIGN + (node)))); + } else if (skip) + printf_V("TRUE\n"); + else + printf_V("FALSE\n"); + break; + + case DELAY_STMT: + print_node(node); + if (val) { + if (!TREE_INTEGER_ATTR(STMT_DELAY_EXPR(node))) { + printf_V(" >>> #"); + trace_result(g, R_nbits, R_nbits, + TREE_INTEGER_ATTR(STMT_DELAY_EXPR(node))); + } + } else + printf_V(" >>> CONTINUE"); + printf_V("\n"); + break; + + case WAIT_STMT: + print_node(node); + printf_V(" >>> "); + if (skip) + printf_V("CONTINUE\n"); + else + printf_V("WAIT\n"); + break; + + case EVENT_STMT: + print_node(node); + if (skip) + printf_V(" >>> CONTINUE\n"); + else + printf_V("\n"); + break; + + case TASK_BLOCK: + case FUNCTION_BLOCK: +// print_node (node); + printf_V("%s; >>> RETURNING\n", IDENT(BLOCK_NAME(node))); + break; + + default: + printf_V("Statment not known to trace: %s\n", + tree_code_name[code]); + break; + } + return; +} + +/********************************************************************** + * + * init_trace + * - initializes global and static data for trace.c + * + ********************************************************************** + */ +void init_trace() +{ +// currently no globals to initialize +} diff --git a/src/trace.h b/src/trace.h new file mode 100644 index 0000000..1ad826a --- /dev/null +++ b/src/trace.h @@ -0,0 +1,43 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* TRACE.H - trace.c routine prototypes */ + +#ifndef TRACE_H +#define TRACE_H + +// public methods + +void trace_result(Group * val, nbits_t print_nbits, + nbits_t nbits, int integer_attr); +void trace_net_type(enum tree_type type); +void trace_stmt(tree node, Group * g, int skip, int val); +void init_trace(void); + +// private methods + +#ifdef TRACE_C + +static void trace_lval(tree lval); +static void trace_assign_result(tree lval, Group * val, nbits_t nbits, + int integer_attr); + +#endif // TRACE_C + +#endif // TRACE_H diff --git a/src/tree.cc b/src/tree.cc new file mode 100644 index 0000000..1698b99 --- /dev/null +++ b/src/tree.cc @@ -0,0 +1,1152 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +#define TREE_C + +#include +#include +//#if !defined(THINK_C) && !defined(__MWERKS__) +//#include +//#endif // THINK_C +#include +#include +#include "vtypes.h" +#include "tree.h" +//#ifndef __GNUC__ +#include "obstack.h" +//#else +//#include +//#endif +#include "decl.h" +#include "glue.h" +#include "scope.h" +#include "veriwell.h" +#include "timescal.h" +#if VDEBUG != 0 +#include "flags.h" +#endif + +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free + +tree resolve_hierarchical_name(tree); + +//extern void * xmalloc (); + +/* Tree nodes of permanent duration are allocated in this obstack. + They are the identifier nodes, declaration nodes, and + block nodes. */ + +struct obstack permanent_obstack; + +/* Each module has its own stack for its statements so that they + can be deallocated on a per-module basis after its code has been + generated. These are initialized dynamically. */ + +struct obstack *module_obstack; + +/* Scaffolding (information needed between phases) are put in the linkage + stack. */ + +struct obstack linkage_obstack; + +/* Low-level code that is generated from syntax trees is put on the + code stack. */ + +struct obstack code_obstack; + +/* Expressions are put on the temporary stack while they are being + processed. They are copied to the permanent stack after being + folded and converted, where necessary. */ + +struct obstack temporary_obstack; + +/* This usually points to permanent obstack. */ + +struct obstack *saveable_obstack; + +/* This points at either permanent_obstack or temporary_obstack. */ + +struct obstack *current_obstack; + +/* This points to either permanent, temporary, or momentary obstack. */ + +struct obstack *expression_obstack; + +/* Addresses of first objects in some obstacks. + This is for freeing their entire contents. */ +char *temporary_firstobj; + +/* Table indexed by tree code giving a string containing a character + classifying the tree code. Possibilities are + d, s, c, r and e. See tree.def for details. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, + +char *tree_code_type[] = { +#include "tree.def" +}; + +#undef DEFTREECODE + +/* Table indexed by tree code giving number of expression + operands beyond the fixed part of the node structure. + Not used for types or decls. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, + +int tree_code_length[] = { +#include "tree.def" +}; + +#undef DEFTREECODE + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) NAME, + +char *tree_code_name[] = { +#include "tree.def" +}; + +#undef DEFTREECODE + +/* Hash table for uniquizing IDENTIFIER_NODEs by name. */ + +#define MAX_HASH_TABLE 1009 +static tree hash_table[MAX_HASH_TABLE]; /* id hash buckets */ + +/* 0 while creating built-in identifiers. */ +static int do_identifier_warnings; + +/* Used to pass lsb and msb expression pointers during parsing. */ +tree range_handle; + +/* Points to the toplevel of the tree */ +tree top_level = NULL_TREE; + +/* List of continuous assignments */ +tree continuous_assignments = NULL_TREE; + +/* Init data for node creation, at the beginning of compilation. */ + +tree build_decl(enum tree_code code, tree name, enum tree_type type); + +void init_tree() +{ + obstack_init(&permanent_obstack); + obstack_init(&linkage_obstack); + + obstack_init(&temporary_obstack); + temporary_firstobj = (char *) obstack_alloc(&temporary_obstack, 0); + + current_obstack = &permanent_obstack; +// expression_obstack = &momentary_obstack; + expression_obstack = &permanent_obstack; + + range_handle = make_node(RANGE_HANDLE); + integer_zero_node = build_int_cst((unsigned_32_t) 0); + integer_one_node = build_int_cst((unsigned_32_t) 1); + error_mark_node = make_node(ERROR_MARK); + TREE_NBITS(error_mark_node) = 0; +} + +/* Allocate SIZE bytes in the current obstack + and return a pointer to them. + In practice the current obstack is always the temporary one. */ + +char *oballoc(long size) +{ + return (char *) obstack_alloc(current_obstack, size); +} + +/* Free the object PTR in the current obstack + as well as everything allocated since PTR. + In practice the current obstack is always the temporary one. */ + +void obfree(char *ptr) +{ + obstack_free(current_obstack, ptr); +} + +/* Allocate SIZE bytes in the permanent obstack + and return a pointer to them. */ + +char *permalloc(long size) +{ + char *tmp = (char *) obstack_alloc(&permanent_obstack, size); + return tmp; +} + +/* Allocate SIZE bytes in the linkage obstack + and return a pointer to them. */ + +char *linkalloc(long size) +{ + return (char *) obstack_alloc(&linkage_obstack, size); +} + +/* clear everything out of the temporary obstack */ + +void clear_temporary() +{ + obstack_free(&temporary_obstack, temporary_firstobj); +} + +tree build_int_cst(signed_32_t i) +{ + tree t = make_node(INTEGER_CST); + +// INT_CST_HIGH (t) = HIGH_INT (i); +// INT_CST_LOW (t) = LOW_INT (i); + INT_CST_DATA(t) = i; + TREE_CONSTANT_ATTR(t) = 1; + TREE_INTEGER_ATTR(t) = 1; + TREE_NBITS(t) = 32; + return t; +} + +tree build_real_cst(char *real_string) +{ + tree t = make_node(REAL_CST); + REAL_CST_DATA(t) = atof(real_string); + TREE_CONSTANT_ATTR(t) = 1; + TREE_REAL_ATTR(t) = 1; + TREE_NBITS(t) = 32; + return t; +} + +void switch_to_linkage_obstack() +{ + current_obstack = &linkage_obstack; +} + +void switch_to_permanent_obstack() +{ + current_obstack = &permanent_obstack; +} + + +/* Return a newly allocated node of code CODE. + Initialize the node's unique id and its TREE_PERMANENT flag. + For decl and type nodes, some other fields are initialized. + The rest of the node is initialized to zero. + + Achoo! I got a code in the node. */ + +int num_nodes = 0; +int num_nodes_g = 0; +int num_nodes_e = 0; +int num_nodes_b = 0; +int num_nodes_s = 0; +int num_nodes_r = 0; +int num_nodes_c = 0; +int num_nodes_d = 0; +int num_nodes_x = 0; + +tree make_node(enum tree_code code) +{ + register tree t; + register int type = *tree_code_type[(int) code]; + register int length; + register struct obstack *obstack = current_obstack; + + num_nodes++; +//HEAPTEST ("Heap corrupted (in make_node)"); + + switch (type) { + case 'b': /* A block node */ + num_nodes_b++; + length = sizeof(struct tree_block_common) + + tree_code_length[(int) code] * sizeof(char *); + obstack = &permanent_obstack; + break; + + case 'd': /* A decl node */ + num_nodes_d++; + length = sizeof(struct tree_decl_common) + + tree_code_length[(int) code] * sizeof(char *); + obstack = &permanent_obstack; + break; + + case 'g': /* a gate node */ + num_nodes_g++; + length = sizeof(struct tree_gate_instance) + + (tree_code_length[(int) code]) * sizeof(char *); + /* All gates are put where we can preserve them if nec. */ + if (obstack != &permanent_obstack) + obstack = module_obstack; + break; + + case 's': /* a stmt node */ + num_nodes_s++; + length = sizeof(struct tree_stmt) + + (tree_code_length[(int) code] - 1) * sizeof(char *); + /* All stmts are put where we can preserve them if nec. */ + if (obstack != &permanent_obstack) + obstack = module_obstack; + break; + + case 'r': /* a reference */ + num_nodes_r++; + goto e; + case 'e': /* an expression */ + num_nodes_e++; + e: + obstack = expression_obstack; + length = sizeof(struct tree_exp) + + (tree_code_length[(int) code] - 1) * sizeof(char *); + break; + + case 'c': /* a constant */ + num_nodes_c++; + obstack = expression_obstack; + goto x; + + case 'x': /* something random, like an identifier. */ + num_nodes_x++; + x:length = sizeof(struct tree_common) + + tree_code_length[(int) code] * sizeof(char *); + /* Identifier nodes are always permanent since they are + unique in a compiler run. */ + if (code == IDENTIFIER_NODE) + obstack = &permanent_obstack; + } + +//HEAPTEST ("In make_node, before alloc"); + t = (tree) obstack_alloc(obstack, length); + + memset(t, 0, length); + TREE_SET_TYPE(t, 0); + TREE_CHAIN(t) = 0; + + TREE_SET_CODE(t, code); + TREE_LABEL(t) = 0; + TREE_SUB_LABEL(t) = 0; + + if (type == 's' || type == 'd' || type == 'b') { + STMT_SOURCE_LINE(t) = (type == 's' + || type == 'b') ? stmt_lineno : lineno; +#if VDEBUG != 0 + if (vdebug) + printf_V("Line %d\n", STMT_SOURCE_LINE(t)); +#endif + STMT_SOURCE_FILE(t) = input_filename; + if (type == 'd') + DECL_EVENT_NOCAST(t) = NULL; + else if (type == 's') + STMT_SCOPE(t) = current_scope; + } + if (code == REAL_DECL) + TREE_REAL_ATTR(t) = 1; + +#if VDEBUG != 0 + if (vdebug) { + extern unsigned long mem; + unsigned long mem_left = mem_avail(); + + printf_V("Made node '%s', at %p, size %d\n", tree_code_name[code], + t, length); + printf_V("Memory used: %lu\n", mem - mem_left); + printf_V("Memory left: %lu\n", mem_left); + + } +#endif +//HEAPTEST ("Heap corrupted (make_node)"); + + return t; +} + +/* Return a new node with the same contents as NODE + except that its TREE_CHAIN is zero and it has a fresh uid. */ + +tree copy_node(tree node) +{ + register tree t; + register enum tree_code code = TREE_CODE(node); + register int length; + + HEAPTEST("In copy_node"); + switch (*tree_code_type[(int) code]) { + case 'b': /* A block node */ + length = sizeof(struct tree_block_common) + + tree_code_length[(int) code] * sizeof(char *); + break; + + case 'd': /* A decl node */ + length = sizeof(struct tree_decl_common) + + tree_code_length[(int) code] * sizeof(char *); + break; + + case 's': /* a stmt node */ + length = sizeof(struct tree_stmt) + + (tree_code_length[(int) code] - 1) * sizeof(char *); + break; + + + case 'g': /* a gate node */ + length = sizeof(struct tree_gate_instance) + + (tree_code_length[(int) code]) * sizeof(char *); + break; + + case 'r': /* a reference */ + case 'e': /* an expression */ + length = sizeof(struct tree_exp) + + (tree_code_length[(int) code] - 1) * sizeof(char *); + break; + + case 'c': /* a constant */ + case 'x': /* something random, like an identifier. */ + length = sizeof(struct tree_common) + + tree_code_length[(int) code] * sizeof(char *); + } + + HEAPTEST("In copy_node, before alloc"); +//printf ("next free = %p, limit = %p\n", current_obstack->next_free, current_obstack->chunk_limit); +//printf ("length is %d\n", length); +// t = (tree) obstack_alloc (current_obstack, length); + t = (tree) obstack_copy(current_obstack, node, length); + HEAPTEST("In copy_node, after alloc"); +//printf ("Allocated node %p, length %d\n", t, length); +//printf ("alignment %d, base %p, limit %p\n", +//current_obstack->alignment_mask, current_obstack->object_base, current_obstack->chunk_limit); + +// for (i = ((length + sizeof (int) - 1) / sizeof (int)) - 1; +// i >= 0; +// i--) +// ((int *) t)[i] = ((int *) node)[i]; + HEAPTEST("In copy_node, after alloc and init"); + + TREE_CHAIN(t) = 0; + + return t; +} + + +#define HASHBITS 30 + +/* Return an IDENTIFIER_NODE whose name is TEXT (a null-terminated string). + If an identifier with that name has previously been referred to, + the same node is returned this time. */ + +tree get_identifier(char *text) +{ + register unsigned hi; + register int i; + register tree idp; + register int len, hash_len; + + /* Compute length of text in len. */ + for (len = 0; text[len]; len++); + + /* Decide how much of that length to hash on */ + hash_len = len; +/* if (warn_id_clash && len > id_clash_len) + * hash_len = id_clash_len; + */ + + /* Compute hash code */ + hi = hash_len; + for (i = 0; i < hash_len; i++) + hi = ((hi * 613) + (unsigned) (text[i])); + + hi &= (1 << HASHBITS) - 1; + hi %= MAX_HASH_TABLE; + + /* Search table for identifier */ + for (idp = hash_table[hi]; idp; idp = TREE_CHAIN(idp)) + if (IDENTIFIER_LENGTH(idp) == len + && !strcmp(IDENTIFIER_POINTER(idp), text)) + return idp; /* <-- return if found */ + + /* Not found; optionally warn about a similar identifier */ +/* + if (warn_id_clash && do_identifier_warnings && len >= id_clash_len) + for (idp = hash_table[hi]; idp; idp = TREE_CHAIN (idp)) + if (!strncmp (IDENTIFIER_POINTER (idp), text, id_clash_len)) + { + warning ("`%s' and `%s' identical in first n characters", + IDENTIFIER_POINTER (idp), text); + break; + } +*/ + /* Not found, create one, add to chain */ + idp = make_node(IDENTIFIER_NODE); + IDENTIFIER_LENGTH(idp) = len; + IDENTIFIER_POINTER(idp) = + (char *) obstack_copy0(&permanent_obstack, text, len); + TREE_CHAIN(idp) = hash_table[hi]; + hash_table[hi] = idp; + TREE_NBITS(idp) = 32; /* A default number for hierarchical names */ + return idp; /* <-- return if created */ +} + +/* Enable warnings on similar identifiers (if requested). + Done after the built-in identifiers are created. */ + +void start_identifier_warnings() +{ + do_identifier_warnings = 1; +} + + +/* Return a node that points to a bit constant. */ + +tree build_bit_cst(nbits_t length, enum radii radix) +{ + register tree t = make_node(BIT_CST); + Group *g = + (Group *) permalloc((bits_to_groups(length) + 1) * sizeof(Group)); + + + BIT_CST_GROUP(t) = g; + BIT_CST_NBITS(t) = length; + BIT_CST_SET_RADIX(t, radix); + TREE_TYPE(t) = REG_TYPE; + TREE_CONSTANT_ATTR(t) = 1; + TREE_NBITS(t) = length; /* default to this; this may be changed at pass 2 */ + + return t; +} + +/* Return a newly constructed STRING_CST node whose value is + the LEN characters at STR. + The TREE_TYPE is not initialized. */ + +tree build_string(int len, char *str) +{ + register tree s = make_node(STRING_CST); + TREE_STRING_LENGTH(s) = len; + TREE_STRING_POINTER(s) = + (char *) obstack_copy0(current_obstack, str, len); + return s; +} + + + +/* Return the length of a chain of nodes chained through TREE_CHAIN. + We expect a null pointer to mark the end of the chain. + This is the Lisp primitive `length'. */ + +int list_length(tree t) +{ + register tree tail; + register int len = 0; + + for (tail = t; tail; tail = TREE_CHAIN(tail)) + len++; + + return len; +} + +/* Concatenate two chains of nodes (chained through TREE_CHAIN) + by modifying the last node in chain 1 to point to chain 2. + This is the Lisp primitive `nconc'. */ + +tree chainon(tree op1, tree op2) +{ + tree t; + + if (op1) { + for (t = op1; TREE_CHAIN(t); t = TREE_CHAIN(t)) + if (t == op2) { + printf("Fatal: Circularity during compilation\n"); +// printf ("%lu\n", coreleft ()); + shell_abort(); /* Circularity being created */ + } + TREE_CHAIN(t) = op2; + return op1; + } else + return op2; +} + +/* Return a newly created TREE_LIST node whose + purpose and value fields are PARM and VALUE. */ + +tree build_tree_list(tree parm, tree value) +{ + register tree t = make_node(TREE_LIST); + TREE_PURPOSE(t) = parm; + TREE_VALUE(t) = value; + TREE_3RD(t) = NULL_TREE; + return t; +} + +/* Return a newly created TREE_LIST node whose + purpose and value fields are PARM and VALUE + and whose TREE_CHAIN is CHAIN. */ + +tree tree_cons(tree purpose, tree value, tree chain) +{ + register tree node = make_node(TREE_LIST); + TREE_CHAIN(node) = chain; + TREE_PURPOSE(node) = purpose; + TREE_VALUE(node) = value; + TREE_3RD(node) = NULL_TREE; + return node; +} + +/* Same as `tree_cons' but make a permanent object. */ + +tree perm_tree_cons(tree purpose, tree value, tree chain) +{ + register tree node; + register struct obstack *ambient_obstack = current_obstack; + current_obstack = &permanent_obstack; + + node = make_node(TREE_LIST); + TREE_CHAIN(node) = chain; + TREE_PURPOSE(node) = purpose; + TREE_VALUE(node) = value; + TREE_3RD(node) = NULL_TREE; + + current_obstack = ambient_obstack; + return node; +} + +tree free_link = NULL_TREE; + +/* Same as `tree_cons' but make a linkage object. */ + +tree link_tree_cons(tree purpose, tree value, tree chain) +{ + register tree node; + register struct obstack *ambient_obstack = current_obstack; + current_obstack = &permanent_obstack; + + if (!free_link) + node = make_node(TREE_LIST); + else { + node = free_link; + free_link = TREE_CHAIN(free_link); + } + TREE_CHAIN(node) = chain; + TREE_PURPOSE(node) = purpose; + TREE_VALUE(node) = value; + TREE_3RD(node) = NULL_TREE; + + current_obstack = ambient_obstack; + return node; +} + +void free_link_list(tree node) +{ + TREE_CHAIN(node) = free_link; + free_link = node; +} + +/* Reverse the order of elements in the chain T, + and return the new head of the chain (old last element). */ + +tree nreverse(tree t) +{ + register tree prev = 0, decl, next; + for (decl = t; decl; decl = next) { + next = TREE_CHAIN(decl); + TREE_CHAIN(decl) = prev; + prev = decl; + } + return prev; +} + +void set_all_list_values(tree list, tree value) +{ + tree t; + + for (t = list; t; t = TREE_CHAIN(t)) + TREE_VALUE(t) = value; +} + +/* Return non-zero if node is a vector net or scalar net */ + +int is_net_code(enum tree_code code) +{ + +/* Return nonzero if node is a net or a reference to a net or any entry + of a concat is a net. */ + + if (code == NET_VECTOR_DECL || code == NET_SCALAR_DECL) + return 1; + else + return 0; +} + +int is_all_net(tree node) +{ + enum tree_code code = TREE_CODE(node); + tree t; + + if (code == BIT_REF) + code = TREE_CODE(BIT_REF_DECL(node)); + else if (code == PART_REF) + code = TREE_CODE(PART_DECL(node)); + + if (is_net_code(code)) + return 1; + if (code == CONCAT_REF) { + for (t = CONCAT_LIST(node); t; t = TREE_CHAIN(t)) + if (!is_all_net(TREE_EXPR(t))) + return 0; + return 1; + } + + return 0; +} + +/* Return nonzero if REF is a reference to an array */ + +int is_array(tree ref) +{ + if (ref) + return (TREE_CODE(ref) == ARRAY_REF); + else + return 0; +} + +/* Return nonzero if REF is a string */ + +int is_string(tree ref) +{ + if (ref) + if (TREE_CODE(ref) == BIT_CST) + return (BIT_CST_RADIX(ref) == STRING_); + return 0; +} + +/* Return non-zero if pure decl (used for $dumpvar, currently) as well + as the actual decl node. */ + +int is_var(tree node, tree * decl) +{ + enum tree_code code = TREE_CODE(node); + + /* Hierarchical name; get decl node then check again */ + if (code == IDENTIFIER_NODE && HIERARCHICAL_ATTR(node)) { + *decl = resolve_hierarchical_name(node); + return is_var(*decl, decl); + } + + /* Must be a DECL and not array nor parameter (for dumpvars) */ + if (*tree_code_type[code] == 'd') + if (code != ARRAY_DECL && code != PARAM_DECL && code != BLOCK_DECL) { + *decl = node; + return 1; + } + + return 0; +} + +/* Return nonzero if var or hierarchical ref is a block as well as actual + BLOCK node. */ + +int is_block(tree node, tree * scope) +{ + enum tree_code code = TREE_CODE(node); + + /* Hierarchical scope, get actual BLOCK node */ + if (code == IDENTIFIER_NODE && HIERARCHICAL_ATTR(node)) { + *scope = search_scope(IDENT(node), 0); + return is_block(*scope, scope); + } + + /* This could be either a pointer to a block (if called recursively)... */ + if (*tree_code_type[code] == 'b') { + *scope = node; + return 1; + } + /* ...or a pointer to a BLOCK_DECL */ + else if (code == BLOCK_DECL) { + *scope = DECL_CONTEXT(node); + return 1; + } + + return 0; +} + +/* return non-zero if node is a legal procedural lvalue. */ + +int is_proc_lval(tree node) +{ + enum tree_code code = TREE_CODE(node); + + if (*tree_code_type[code] == 'c' || *tree_code_type[code] == 'e') + return 0; + if (is_all_net(node)) + return 0; + if (code == FUNCTION_REF) + return 0; + return 1; +} + +/* Return name of identifier, be it hierarchical or otherwise */ + +char *ident_name(tree node) +{ + enum tree_code code = TREE_CODE(node); + + if (code == IDENTIFIER_NODE) + return IDENT(node); + else + return IDENT(DECL_NAME(node)); +} + +/* Given an lval, check if it is a "SHADOW_LVAL_REF". If so, return the + lval that it is shadowing (a hierarchical reference). */ + +tree the_lval(tree lval_arg) +{ + tree lval; + + if (TREE_CODE(lval_arg) != SHADOW_LVAL_REF) + return lval_arg; + lval = TREE_CHAIN(lval_arg); /* This points to the actual decl */ + return lval; +} + +/* Return the string of the type, suitable for printing */ + +char *decl_type(tree node) +{ + enum tree_code code = TREE_CODE(node); + + switch (code) { + case EVENT_DECL: + return "event"; + case INTEGER_DECL: + return "integer"; + case REG_SCALAR_DECL: + return "reg"; + case REG_VECTOR_DECL: + return "reg"; + case TIME_DECL: + return "time"; + case REAL_DECL: + return "real"; + case NET_SCALAR_DECL: + case NET_VECTOR_DECL: + switch (TREE_TYPE(node)) { + case NET_WIRE_TYPE: + return "wire"; + case NET_TRI_TYPE: + return "tri"; + case NET_WAND_TYPE: + return "wand"; + case NET_TRIAND_TYPE: + return "triand"; + case NET_WOR_TYPE: + return "wor"; + case NET_TRIOR_TYPE: + return "trior"; + case NET_TRI0_TYPE: + return "tri0"; + case NET_TRI1_TYPE: + return "tri1"; + case NET_SUPPLY0_TYPE: + return "supply0"; + case NET_SUPPLY1_TYPE: + return "supply1"; + } + } + return ""; +} + + +/* Low-level constructors for expressions. */ + +/* Build an expression of code CODE, data type TYPE, + and operands as specified by the arguments ARG1 and following arguments. + Expressions and reference nodes can be created this way. + Constants, decls, types and misc nodes cannot be. */ + +tree build(enum tree_code code, enum tree_type type, ...) +{ + /*register */ va_list p; + register tree t; + register int length; + register int i; + + va_start(p, type); + +// code = va_arg (p, enum tree_code); + t = make_node(code); + length = tree_code_length[(int) code]; + TREE_TYPE(t) = type; +// TREE_TYPE (t) = va_arg (p, enum tree_type); + + if (length == 2) { + /* This is equivalent to the loop below, but faster. */ + register tree arg0 = va_arg(p, tree); + register tree arg1 = va_arg(p, tree); + TREE_OPERAND(t, 0) = arg0; + TREE_OPERAND(t, 1) = arg1; + } else { + for (i = 0; i < length; i++) { + register tree operand = va_arg(p, tree); + TREE_OPERAND(t, i) = operand; + } + } + va_end(p); + return t; +} + +/* Similar except don't specify the TREE_TYPE + and leave the TREE_VOLATILE as 0. + It is permissible for arguments to be null, + or even garbage if their values do not matter. */ + +tree build_nt(enum tree_code code, ...) +{ + /*register */ va_list p; + register tree t; + register int length; + register int i; + + va_start(p, code); + + t = make_node(code); + length = tree_code_length[(int) code]; + + for (i = 0; i < length; i++) + TREE_OPERAND(t, i) = va_arg(p, tree); + + va_end(p); + return t; +} + +/* Create a DECL_... node of code CODE, name NAME and data type TYPE. + We do NOT enter this node in any sort of symbol table. + + layout_decl is used to set up the decl's storage layout. + Other slots are initialized to 0 or null pointers. */ + +tree build_decl(enum tree_code code, tree name, enum tree_type type) +{ + register tree t; + + t = make_node(code); + +/* if (type == error_mark_node) + type = integer_type_node; */ +/* That is not done, deliberately, so that having error_mark_node + as the type can suppress useless errors in the use of this variable. */ + + DECL_NAME(t) = name; + TREE_TYPE(t) = type; + + return t; +} + +/* Build an array node */ +tree build_array(tree ident, tree decl, tree lobounds, tree hibounds) +{ + tree node = make_node(ARRAY_DECL); + +// ARRAY_DECL (node) = decl; + ARRAY_CODE(node) = TREE_CODE(decl); + ARRAY_HI_EXPR(node) = hibounds; + ARRAY_LO_EXPR(node) = lobounds; + DECL_NAME(node) = ident; + DECL_MSB(node) = DECL_MSB(decl); + DECL_LSB(node) = DECL_LSB(decl); + if (TREE_CODE(decl) == INTEGER_DECL) + TREE_INTEGER_ATTR(node) = 1; + if (TREE_CODE(decl) == REAL_DECL) + TREE_REAL_ATTR(node) = 1; + return node; +} + +/* Build a module block */ +tree build_module(tree ident) +{ + tree tmp = make_node(MODULE_BLOCK); +#if VDEBUG != 0 + if (vdebug) + printf_error_V("Building module %s\n", IDENTIFIER_POINTER(ident)); +#endif + BLOCK_NAME(tmp) = ident; + MODULE_NAME(tmp) = IDENTIFIER_POINTER(ident); + BLOCK_UP(tmp) = BLOCK_DECL(tmp) = BLOCK_PORTS(tmp) = NULL_TREE; + BLOCK_DOWN(tmp) = BLOCK_ARGS(tmp) = NULL_TREE; + MODULE_DEFPARAMS(tmp) = NULL_TREE; + MODULE_SPECDEFS(tmp) = NULL_TREE; + MODULE_SPECINST(tmp) = NULL_TREE; + /* Module names have their own namespace, so the following remains comment out */ + /* IDENT_CURRENT_DECL (ident) = tmp; *//* make ident point to mod */ + set_decl(ident, tmp); + module_timescale(tmp); + return tmp; +} + +/* Clean up at end of module parse */ + +void end_module(tree node) +{ + tree t, t1, t2; + char *name; + + for (t = MODULE_PORT_LIST(node); t; t = TREE_CHAIN(t)) { + t1 = TREE_PURPOSE(t); + t2 = root_port_decl(t1); + if (!t2 || TREE_CODE(t2) == IDENTIFIER_NODE) + error("Port '%s' not declared", IDENT(t1), NULL_CHAR); + else if (!PORT_INPUT_ATTR(t1) && !PORT_OUTPUT_ATTR(t1)) { + if (TREE_CODE(t1) == IDENTIFIER_NODE) + name = IDENT(t1); + else + name = IDENT(DECL_NAME(t1)); + error("Port '%s' not declared as INPUT, OUTPUT, or INOUT", + name, NULL_CHAR); + } + } +} + +extern tree current_scope; + +/* Build a task block */ +tree build_task(tree ident) +{ + tree tmp = make_node(TASK_BLOCK); + + BLOCK_NAME(tmp) = ident; + BLOCK_UP(tmp) = current_scope; +// make_decl (ident, current_scope); + return tmp; +} + +/* Build a function block */ +tree build_function(tree ident) +{ + tree tmp = make_node(FUNCTION_BLOCK); + + BLOCK_NAME(tmp) = ident; + BLOCK_UP(tmp) = current_scope; +// make_decl (ident, current_scope); + return tmp; +} + +tree build_stmt(enum tree_code code, ...) +{ + /*register */ va_list p; +// register enum tree_code code; + register tree t; + register int length; + register int i; + + va_start(p, code); + +// code = va_arg (p, enum tree_code); + t = make_node(code); + if (*tree_code_type[(int) code] == 's') + STMT_SOURCE_LINE(t) = va_arg(p, lineno_t); + length = tree_code_length[(int) code]; + + for (i = 0; i < length; i++) + STMT_OPERAND(t, i) = va_arg(p, tree); + + va_end(p); + return t; +} + +/* add a node to the list of continuous assignments + (used during intialization) */ + +void add_cont_assign_list(tree node) +{ + continuous_assignments = + tree_cons(node, NULL_TREE, continuous_assignments); +} + +/* Low-level constructors for statements. + These constructors all expect source file name and line number + as arguments, as well as enough arguments to fill in the data + in the statement node. */ + +tree +build_cont_assign(tree lval, tree rval, lineno_t lineno, tree delay, + int split) +{ + tree stmt, tmp_var; + + if (split) { + /* Make two assignments */ + + if (TREE_CODE(lval) == NET_SCALAR_DECL) + tmp_var = make_node(TMP_DECL); + else + tmp_var = make_node(TMP_DECL); + TREE_CHAIN(tmp_var) = lval; /* point to NET for pass3 */ + + /* pass3 fills on the rest */ + stmt = build_stmt(ASSIGN_CONT_STMT, lineno, tmp_var, rval, + NULL_TREE, NULL_TREE, delay); + TREE_CHAIN(stmt) = build_stmt(ASSIGN_CONT_STMT, lineno, + lval, NULL_TREE, NULL_TREE, + NULL_TREE, NULL_TREE); + + if (TREE_CODE(lval) == NET_SCALAR_DECL) { + NET_ASSIGNMENT(lval) = tmp_var; + } + + } else + stmt = build_stmt(ASSIGN_CONT_STMT, lineno, lval, rval, + NULL_TREE, NULL_TREE, delay); + + if (TREE_CODE(lval) == NET_SCALAR_DECL) { + NET_ASSIGNMENT(lval) = stmt; + } + + add_cont_assign_list(stmt); + return stmt; +} + + + +/************************************************************************ + * + * init_tree_1 + * - initializes global and static variables for tree.c + * + ************************************************************************ + */ + +void init_tree_1() +{ + top_level = NULL_TREE; + continuous_assignments = NULL_TREE; + num_nodes = 0; + num_nodes_g = 0; + num_nodes_e = 0; + num_nodes_b = 0; + num_nodes_s = 0; + num_nodes_r = 0; + num_nodes_c = 0; + num_nodes_d = 0; + num_nodes_x = 0; + free_link = NULL_TREE; + memset(&permanent_obstack, 0, sizeof(permanent_obstack)); + memset(&module_obstack, 0, sizeof(module_obstack)); + memset(&linkage_obstack, 0, sizeof(linkage_obstack)); + memset(&code_obstack, 0, sizeof(code_obstack)); + memset(&temporary_obstack, 0, sizeof(temporary_obstack)); + memset(&saveable_obstack, 0, sizeof(saveable_obstack)); + memset(¤t_obstack, 0, sizeof(current_obstack)); + memset(&expression_obstack, 0, sizeof(expression_obstack)); + memset(&temporary_firstobj, 0, sizeof(temporary_firstobj)); + memset(&hash_table, 0, sizeof(hash_table)); + do_identifier_warnings = 0; + range_handle = NULL_TREE; +} diff --git a/src/tree.def b/src/tree.def new file mode 100644 index 0000000..84ed345 --- /dev/null +++ b/src/tree.def @@ -0,0 +1,608 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* The third argument can be: + "b" for a scoping block (tasks, functions, named begins, and modules) + "x" for an exceptional code (fits no category). + "s" for a statement code. + "g" for a gate primitive. + + "c" for codes for constants. + "d" for codes for declarations (also serving as variable refs). + "r" for codes for references to storage. + "e" for codes for other kinds of expressions. */ + +/* Expression nodes are further broken down: + "e3" for conditional (?:) + "ex" for arithmetic and bit-wise (context-dependent lengths) (+ - * / %) + "eu" for arithmetic unary (-) + "es" for shift (<< >>) + "e1" for conditionals (length = 1) + "er" for reduction (unary conditional) + "ec" for unary type conversion +*/ + +/* For `r', `e' and `x' nodes, + the 4th element is the number of argument slots to allocate. + This determines the size of the tree node object. */ + +/* Any erroneous construct is parsed into a node of this type. + This type of node is accepted without complaint in all contexts + by later parsing activities, to avoid multiple error messages + for one error. + No fields in these nodes are used except the TREE_CODE. + Must also alias for decls so extend by 3*/ +DEFTREECODE (ERROR_MARK, "error_mark", "x", 3) + +/* Used to represent a name (such as, in the DECL_NAME of a decl node). + Internally it looks like a STRING_CST node. + There is only one IDENTIFIER_NODE ever made for any particular name. + Use `get_identifier' to get it (or create it, the first time). */ +DEFTREECODE (IDENTIFIER_NODE, "identifier_node", "x", 7) + +/* Has the TREE_VALUE and TREE_PURPOSE fields. */ +/* These nodes are made into lists by chaining through the + TREE_CHAIN field. The elements of the list live in the + TREE_VALUE fields, while TREE_PURPOSE fields are occasionally + used as well to get the effect of Lisp association lists. */ +DEFTREECODE (TREE_LIST, "tree_list", "x", 3) + +DEFTREECODE (PATH_OUTPUT, "path_output", "x", 6 ) +DEFTREECODE (PATH_INSTANCE, "path_instance", "x", 2 ) + +/* Has the PATH_DELAYS, PATH_INPUTS, PATH_OUTPUTS, PATH_PARALLEL fields. */ +/* These nodes are made into lists by chaining through the + TREE_CHAIN field. PATH_DELAYS points to a list of delay expressions. + PATH_INPUTS points to a list of input/inout ports. PATH_OUTPUTS points + to a list of output/inout ports. PATH_PARALLEL is a flag indication + if the path is a parallel specification. PATH_SOURCE is the source + expression for edge triggered paths. PATH_CONDITION is the expression + for the if clause. PATH_EDGE is the transition for edge triggered paths. + PATH_POLARITY is the polarity for level and edge sensitive paths. +*/ +DEFTREECODE (PATH_NODE, "path_node", "x", 10) + +/* Has CHECK_SPEC_EVENT1, CHECK_SPEC_EVENT2, CHECK_SPEC_PARAM1, + CHECK_SPEC_PARAM2, CHECK_SPEC_CHECKTYPE, CHECK_SPEC_NOTIFIER fields. + All check specs are chained anchored to its MODULE. + EVENT1 and EVENT2 are trees to scalar,part or bit selects of in, or inout. + PARAM1 and PARAM2 are trees to constants. + CHECKTYPE identifies the type of check. + NOTIFIER is a tree to the notifier or NULL. +*/ +DEFTREECODE (CHECK_SPEC, "check_spec", "x", 8) + +/* Has: + PLI_DELAY_NEXT - next delay for pli task/function + PLI_DELAY_NODE - task/function node for this delay + PLI_DELAY_TIME - time for this delay to fire + PLI_DELAY_STORAGE - group structure for assigns + PLI_DELAY_LVAL - lval tree for assigns +*/ +DEFTREECODE (PLI_DELAY, "pli_delay", "x", 5 ) + +/* Has TIMING_EVENT_EDGESPEC, TIMING_EVENT_EXPRESSION, TIMING_EVENT_CONDITION + fields. + EDGESPEC is a long with one bit per edge type. + EXPRESSION is a tree to the expression to be evaluated. + CONDITION is a tree to the condition expression. +*/ +DEFTREECODE (TIMING_EVENT, "timing_event", "x", 3 ) + +DEFTREECODE (TIMING_CHECK, "timing_check", "x", 21 ) +DEFTREECODE (NOTIFIER_NODE, "notifier", "x", 2 ) +DEFTREECODE (UDP_STRING_NODE, "udp_string", "x", 9 ) +DEFTREECODE (UDP_TABLE_NODE, "udp_table", "x", 10 ) + +/* Scoping blocks. These represent a push to a new scoping (context) level + for hierarchical references, where each level can define new variables or + redeclare previously-used names. These are modules, tasks, fuctions, + named begin/end, and named fork/join. These are also used to resolve + forward references for calls and the DISABLE statement. + TREE_CHAIN points to another block at the same level. + TREE_TYPE is the return type for functions. + BLOCK_NAME points to the INDENTIFIER_NODE with the name of the block. + BLOCK_DOWN points to a chain of subblocks. + BLOCK_UP points to the next higher level. + BLOCK_DECL points to a chain of ..._DECL nodes that represent the + declarations within this block. + BLOCK_PARAM points to a TREE_LIST of parameter expressions; TREE_PURPOSE + is the name of the parameter. + BLOCK_PARAM_ASSIGN points to a chain of parameter expressions. + BLOCK_PORTS is a TREE_LIST of ..._DECL nodes representing the ports + or task/function arguments; TREE_PURPOSE points to the identifier + node of the name of the port. + BLOCK_BODY point to either a tree list of INITIAL/ALWAYS blcoks (modules) + or to the code (tasks, functions, begin/fork). */ + +/* Module. This is sort of a root node. + MODULE_INSTANCES point to a chain of module and gate instances. */ +DEFTREECODE (MODULE_BLOCK, "module_block", "b", 8) + +/* Tasks and functions. + FUNCT_DECL points to a declaration node representing the return type */ +DEFTREECODE (TASK_BLOCK, "task_block", "b", 2) +DEFTREECODE (FUNCTION_BLOCK, "function_block", "b", 5) + +/* Named begin/end and named fork/join */ +DEFTREECODE (NAMED_BLOCK, "named_block", "b", 0) + +/* Mother of all blocks */ +DEFTREECODE (SUPER_BLOCK, "super_block", "b", 0) + + +/* All statement types have fields STMT_SOURCE_FILE and STMT_SOURCE_LINE. */ +/* Consecutive statements within a compound statement are chained together + through the TREE_CHAIN field. */ + +/* INITIAL and ALWAYS blocks. These are sort of a cross between statement + nodes and blcok nodes. TREE_CHAIN links all INITIAL and ALWAYS block + in a module. BLOCK_BODY points to a chain of statements. */ +DEFTREECODE (INITIAL_BLOCK, "initial_block", "s", 1) +DEFTREECODE (ALWAYS_BLOCK, "always_block", "s", 1) + +/* A null statement for use with stamtement_or_null. Although + exec will execute it, it is needed only for aesthetic purposes during + trace. */ +DEFTREECODE (NULL_STMT, "null_stmt", "s", 0) + +/* This is a fast way to return from exec() during disable stmt processing */ +DEFTREECODE (DUMMY_RETURN_STMT, "dummy_return_stmt", "s", 0) + +/* Removes process from system. Used by INITIAL and interactive stmts */ +DEFTREECODE (DUMP_STMT, "dump_stmt", "s", 0) + +/* Finishes a Verilog session */ +DEFTREECODE (FINISH_STMT, "finish_stmt", "s", 0) + +/* A label definition, encapsulated as a statement. + STMT_BODY is the LABEL_DECL node for the label that appears here. */ +DEFTREECODE (LABEL_STMT, "label_stmt", "s", 1) + +/* Assignment statements: + ASSIGN_STMT is a simple procedural assignment. + ASSIGN_DELAY_STMT is an intra assignment delay. + ASSIGN_EVENT_STMT is an intra assignment event. + ASSIGN_NONBLK_DELAY_STMT is a non-blocking assignment w/delay. + ASSIGN_NONBLK_EVENT_STMT is a non-blocking assignment w/event. + ASSIGN_CONT_STMT is a simple continuous assignment. + + STMT_ASSIGN_LVAL is the lvalue of the assignment + STMT_ASSIGN_RVAL is the rvalue expression + STMT_ASSIGN_RVAL_CODE is the rvalue expression instructions + + STMT_ASSIGN_EVENT_LIST is a list of markers that will trigger this + assignment. + STMT_ASSIGN_DELAY is an event or delay expression or NULL. + STMT_ASSIGN_NEXT points to another continuous assignment of the same net. + */ +DEFTREECODE (ASSIGN_STMT, "assign_stmt", "s", 3) +DEFTREECODE (ASSIGN_DELAY_STMT, "assign_delay_stmt", "s", 7) +DEFTREECODE (ASSIGN_EVENT_STMT, "assign_delay_stmt", "s", 7) +DEFTREECODE (ASSIGN_NONBLK_DELAY_STMT, "assign_delay_stmt", "s", 7) +DEFTREECODE (ASSIGN_NONBLK_EVENT_STMT, "assign_delay_stmt", "s", 9) +DEFTREECODE (ASSIGN_CONT_STMT, "assign_cont_stmt", "s", 5) + +/* Procedural continuous assignment and force assignment. Uses + same structures as ASSIGN statements */ + +DEFTREECODE (ASSIGN_PROC_STMT, "assign_proc_stmt", "s", 5) +DEFTREECODE (FORCE_STMT, "force_stmt", "s", 7) + + +//DEFTREECODE (ASSIGN2_STMT, "assign2_stmt", "s", 4) +//DEFTREECODE (ASSIGN_NOBLOCK_STMT, "assign_noblock_stmt", "s", 4) + +/* if-then-else statement. + STMT_COND is the condition (an expression). + STMT_THEN is the then-branch (a statement or chain of statements). + STMT_ELSE is the else-branch (a statement or chain of statements). */ +DEFTREECODE (IF_STMT, "if_stmt", "s", 4) + +/* case, casez, casex. + STMT_CASE_INDEX is an expression for the value to dispatch on. + STMT_CASE_LIST is a list (a chain of TREE_LIST nodes) + of the branches of the dispatch. + Each such TREE_LIST node has the case it is for (a constant expression) + as the TREE_PURPOSE (if there is a comma-delimited list of constant + expressions, then these are expanded to multiple TREE_LIST nodes) + and statement to execute as the TREE_VALUE. A null value for + TREE_PURPOSE indicates the default item. + STMT_CASE_DEFAULT_ATTR is set once a default is found and tested to + prevent and flag multiple defaults. */ +DEFTREECODE (CASE_STMT, "case_stmt", "s", 4) +DEFTREECODE (CASEZ_STMT, "casez_stmt", "s", 4) +DEFTREECODE (CASEX_STMT, "casex_stmt", "s", 4) + +/* forever statement. + STMT_BODY is the list of statements with the loop. */ +DEFTREECODE (FOREVER_STMT, "forever_stmt", "s", 1) + +/* repeat statement. + STMT_REPEAT_COUNT is the repeat count expression. + STMT_BODY is the list of statements within the loop. */ +DEFTREECODE (REPEAT_INIT_STMT, "repeat_init_stmt", "s", 4) +DEFTREECODE (REPEAT_STMT, "repeat_init_stmt", "s", 4) + +/* while statement. + STMT_COND is the while condition. + STMT_BODY is the list of statements within the loop. */ +DEFTREECODE (WHILE_STMT, "while_stmt", "s", 3) + +/* for statement. + STMT_FOR_INIT is the initial assignment. + STMT_FOR_COND is the condition. + STMT_FOR_ITER is the iteartion assignment. + STMT_BODY is the list of statements within the loop. */ +DEFTREECODE (FOR_STMT, "for_stmt", "s", 4) + +/* wait statement. + STMT_WAIT_EXPR is the expression on which to wait. + STMT_WAIT_EXPR_CODE is the instructions of the expression + STMT_WAIT_MARKER is the list of markers that can trigger the event */ +DEFTREECODE (WAIT_STMT, "wait_stmt", "s", 4) + +/* phantom jump for the end of loops. */ +DEFTREECODE (LOOPBACK_STMT, "loopback_stmt", "s", 1) + +/* delay control (e.g. #5) + STMT_BODY + STMT_DELAY_EXPR is the delay expression. + STMT_DELAY_EXPR_CODE is the list of expression to evaluate */ +DEFTREECODE (DELAY_STMT, "delay_stmt", "s", 3) + +/* event control (e.g. @foo; @(posedge foo) ) + STMT_BODY is the next stmt to execute after the event is triggered. + STMT_EVENT_MARKER is a list of event markers. */ +DEFTREECODE (EVENT_STMT, "event_stmt", "s", 3) + +/* trigger named event + STMT_ARROW_NAME is the name of the event. + STMT_ARROW_EVENT is actual event if NAME is hierarchical. */ +DEFTREECODE (ARROW_STMT, "arrow_stmt", "s", 2) + +/* begin/end block (possibly named) + STMT_NAME is the name of the block. If it is null, then it is not + named and no scoping occurs. If there is a name, then the scope is + pushed and new declarations may occur. + STMT_BLOCK points to scoping block, + STMT_BEGIN_NAMED_END points to stmt after end for disable stmt. */ +DEFTREECODE (BEGIN_STMT, "begin_stmt", "s", 1) +DEFTREECODE (BEGIN_NAMED_STMT, "begin_named_stmt", "s", 3) +DEFTREECODE (END_STMT, "end_stmt", "s", 0) +DEFTREECODE (END_NAMED_STMT, "end_named_stmt", "s", 2) + +/* fork/join block (possibly named) + STMT_BLOCK_NAME is the name of the block. If it is null, then it is not + named and no scoping occurs. If there is a name, then the scope is + pushed and new declarations may occur. + STMT_BODY is the chain of substatements. + STMT_FORK_SCB points to te sub-SCBs (for disabling) */ +DEFTREECODE (FORK_STMT, "fork_stmt", "s", 3) +DEFTREECODE (FORK_NAMED_STMT, "fork_named_stmt", "s", 4) +DEFTREECODE (JOIN_STMT, "join_stmt", "s", 1) +DEFTREECODE (JOIN_NAMED_STMT, "join_named_stmt", "s", 2) + +/* Task and system task enable. + Function and system function reference. + STMT_TASK_NAME is the task name. + STMT_TASK_ARGS is the argument list, a list of expressions made out + of a chain of TREE_LIST nodes. */ +DEFTREECODE (TASK_STMT, "task_stmt", "s", 5) +DEFTREECODE (SYSTASK_STMT, "sys_task_stmt", "s", 10) +DEFTREECODE (FUNCTION_REF, "function_ref", "r", 7) +DEFTREECODE (SYSFUNCTION_REF, "sysfunction_ref", "r", 12) + +DEFTREECODE (GATE_INSTANCE, "gate_instance", "g", 0) + +/* These next two may be combined, since it probably is not known + at first pass if the name refers to a task or a block. */ +/* disable task and disable block. + STMT_DISABLE_NAME is the name of the task. */ +DEFTREECODE (DISABLE_STMT, "disable_stmt", "s", 2) +DEFTREECODE (DISABLE_TASK_STMT, "disable_task_stmt", "s", 1) +DEFTREECODE (DISABLE_BLOCK_STMT, "disable_block_stmt", "s", 1) + +/* Deassign psuedo continuous assignment and release. + STMT_LVAL is the lvalue to be deassigned. */ +DEFTREECODE (DEASSIGN_STMT, "deassign_stmt", "s", 1) +DEFTREECODE (RELEASE_STMT, "release_stmt", "s", 1) + +/* Continuous assignments, in two parts */ +//DEFTREECODE (CONT_ASSIGN, "cont_assign", "s", 9) +//DEFTREECODE (CONT_ASSIGN2, "cont_assign2", "s", 0) + +/* Instance placeholders. When a module instantiates another module, + this structure hold all the information until the hierarchy is created + in phase 2. ex. foo foobar #(1, 2) (a, b, c); + INSTANCE_NAME is the name of the instance (foobar), + INSTANCE_MODULE_NAME is the name of the referenced module (foo), + INSTANCE_PORTS is a TREE_LIST of arguments (a, b, c), + INSTANCE_PARAMS is a TREE_LIST of parameter overrides (1, 2), + INSTANCE_BLOCK is set to the actual module block during pass2. +*/ +DEFTREECODE (INSTANCE_NODE, "instance_node", "s", 5) + + +/* Expressions */ + +/* First, the constants. */ + +/* Contents are in TREE_INT_CST; 32 bits, signed. */ +DEFTREECODE (INTEGER_CST, "integer_cst", "c", 2) + +/* Contents are in TREE_REAL_CST; double. */ +DEFTREECODE (REAL_CST, "real_cst", "c", 2) + +/* Contents are in TREE_BIT_DATUM */ +DEFTREECODE (BIT_CST, "bit_cst", "c", 3) + +/* Contents are TREE_STRING_LENGTH and TREE_STRING_POINTER fields. */ +DEFTREECODE (STRING_CST, "string_cst", "c", 3) + +/* Declarations. All references to names are represented as ..._DECL nodes. + The decls in one binding context are chained through the TREE_CHAIN field. + Each DECL has a DECL_NAME field which contains an IDENTIFIER_NODE. + (Some decls, most often labels, may have zero as the DECL_NAME). + DECL_SCOPE points to the node representing the context in which + this declaration has its scope. This is either a MODULE, FUNCTION, + TASK, NAMED_BEGIN or NAMED_FORK scoping node. + The TREE_TYPE field holds the data type of the object, when relevant. + LABEL_DECLs have no data type. For TYPE_DECL, the TREE_TYPE field + contents are the type whose name is being declared. + DECL_SIZE hold the size in bytes required to store the value. + If parameters were used in the definition, then this is not known + at first pass time. + DECL_ADDR points to the address in memory where the value is held. + DECL_ACTIVE points to the activation list, that is, the list of event + markers that this declaration could trigger*/ +/* Integer declaration. */ +DEFTREECODE (INTEGER_DECL, "integer_decl", "d", 0) + +/* Real declaration */ +DEFTREECODE (REAL_DECL, "real_decl", "d", 0) + +/* Register scalar (single-bit) declaration. */ +DEFTREECODE (REG_SCALAR_DECL, "reg_scalar_decl", "d", 0) + +/* Time declaration */ +DEFTREECODE (TIME_DECL, "time_decl", "d", 0) + +/* Register vector declaration. */ +DEFTREECODE (REG_VECTOR_DECL, "reg_vector_decl", "d", 0) + +/* temp used for intermediate storage of delayed assignments */ +DEFTREECODE (TMP_DECL, "tmp_decl", "d", 0) + +/* Specify path constraint */ +DEFTREECODE (PATH_CONSTRAINT,"path_constraint", "x", 19 ) + +/* Net declarations. TREE_TYPE indicates the subtype. + NET_LIST is a pointer to other sources to this net + NET_DELAY is a pointer to the delay expression (must be constant) */ +DEFTREECODE (NET_SCALAR_DECL, "net_scalar_decl", "d", 3) +DEFTREECODE (NET_VECTOR_DECL, "net_vector_decl", "d", 3) + +/* Array declarations. DECL_NOUN points to another declaration node + that describes the type of array. Currently, only integers and registers + are arrayable (or is that arrayible). Also: + DECL_LOW_BOUNDS Low bounds of array. + DECL_HIGH_BOUNDS High bounds of array. */ +DEFTREECODE (ARRAY_DECL, "array_decl", "d", 5) + +/* Port and argument declarations. DECL_NOUN points to another + declaration node if this port is redefined as a register, or other + type. If null, then its type is the default net type. For vector ports: + DECL_PORT_MSB is the most significant bit. + DECL_PORT_LSB is the least significant bit. + PORT_INPUT_ATTR is set if the port/arg is an input. + PORT_OUTPUT_ATTR is set if the port/arg is an output. + if both are set, the port/arg is an INOUT. */ +DEFTREECODE (PORT_SCALAR_DECL, "port_scalar_decl", "d", 1) +DEFTREECODE (PORT_VECTOR_DECL, "port_vector_decl", "d", 3) +DEFTREECODE (ARG_SCALAR_DECL, "arg_scalar_decl", "d", 1) +DEFTREECODE (ARG_VECTOR_DECL, "arg_vector_decl", "d", 3) + +/* Parameter Declarations. These may be modified by a parent module, + so their current value cannot be used. Treat and a variable during + first pass, resolve and collapse during second pass. + DECL_PARAM_SEQ is the sequence number of the parameter (the order is which + it appeared in the declarations). + DECL_PARAM_EXPR is the default expression for the parameter. + DECL_PARAM_WHERE os a TREE_LIST of the heads of expressions that use + this parameter. */ +DEFTREECODE (PARAM_DECL, "param_decl", "d", 3) +/* Spec parameters have same layout as Parameter Declarations only different code */ +DEFTREECODE (SPECPARAM_DECL, "specparam_decl", "d", 3) + + +/* Named event declaration. This type does not store a value; it is used + only to trigger an event. */ +DEFTREECODE (EVENT_DECL, "event_decl", "d", 0) + +/* Result represents the return value of a function. DECL_NOUN points + to the subtype. */ +DEFTREECODE (RESULT_DECL, "result_decl", "d", 1) + +/* Represents a placeholder for block names: named begin, named fork, task + or function names are represented. */ +DEFTREECODE (BLOCK_DECL, "block_decl", "d", 0) + +/* References to storage. */ + +/* A placeholder for hierarchical names */ +DEFTREECODE (HIERARCHICAL_REF, "hierarchical_ref", "r", 1) + +/* Array indexing. + Operand 0 is the array; operand 1 is the index. */ +DEFTREECODE (ARRAY_REF, "array_ref", "r", 4) + +/* Bit-select. Operand 0 is the register or net, operand 1 is the index. */ +DEFTREECODE (BIT_REF, "bit_ref", "r", 4) + +/* Part-select. Operand 0 is the register or net. + PART_DECL is the pointer to the referenced decl node. + PART_MSB_ is the most significant bit (expression on the left side of + the colon). + PART_LSB_ is the least significant bit (expression on the right side + of the colon). + PART_MSB and PART_LSB are the actual constants, evaluated in pass 3.*/ +DEFTREECODE (PART_REF, "part_ref", "r", 9) + +DEFTREECODE (CONCAT_REF, "concat_ref", "r", 2) +DEFTREECODE (CONCAT_REP_REF, "concat_rep_ref", "r", 4) + +/* Shadow references are used when the size of a var must be adjusted + to something other than the native size. */ +DEFTREECODE (SHADOW_REF, "shadow_ref", "r", 0) + +/* Shadow lval references are for resolving direct (not indexed) references + to hierarchical names in the lval */ +DEFTREECODE (SHADOW_LVAL_REF, "shadow_lval_ref", "r", 1) + +/* The expression types are mostly straightforward, + with the fourth argument of DEFTREECODE saying + how many operands there are. + Unless otherwise specified, the operands are expressions. */ + +/* This is used to pass msb and lsb expression pointers during + parsing. Only one of these are needed. */ +DEFTREECODE (RANGE_HANDLE, "range_handle", "e", 2) + +/* Contains two expressions to compute, one followed by the other. + the first value is ignored. The second one's value is used. */ +DEFTREECODE (COMPOUND_EXPR, "compound_expr", "e", 2) + +/* Initialization expression. Operand 0 is the variable to initialize; + Operand 1 is the initializer. */ +DEFTREECODE (INIT_EXPR, "init_expr", "e", 2) + +/* Conditional expression ( ... ? ... : ... ). + Operand 0, 1 is the condition. + Operand 2, 3 is the then-value. + Operand 4, 5 is the else-value. */ +DEFTREECODE (COND_EXPR, "cond_expr", "e3", 6) + +/* Edge detection. Expression node contains the previous state for + edge comparison. */ +DEFTREECODE (ANYEDGE_EXPR, "anyedge_expr", "er", 2) +DEFTREECODE (POSEDGE_EXPR, "POSEDGE ", "er", 2) +DEFTREECODE (NEGEDGE_EXPR, "NEGEDGE ", "er", 2) + +/* Simple arithmetic. Operands must have the same machine mode + and the value shares that mode. */ +DEFTREECODE (PLUS_EXPR, "+", "ex", 2) +DEFTREECODE (MINUS_EXPR, "-", "ex", 2) +DEFTREECODE (MULT_EXPR, "*", "ex", 2) + +/* Division for integer result that rounds the quotient toward zero. */ +/* Operands must have the same machine mode. + In principle they may be real, but that is not currently supported. + The result is always fixed point, and it has the same type as the + operands if they are fixed point. */ +DEFTREECODE (DIV_EXPR, "/", "ex", 2) + +/* Four kinds of remainder that go with the four kinds of division. */ +DEFTREECODE (MOD_EXPR, "%", "ex", 2) + +/* Unary negation. Value has same type as operand. */ +DEFTREECODE (NEGATE_EXPR, "-", "eu", 1) + +/* Shift operations for shift and rotate. + Shift is supposed to mean logical shift if done on an + unsigned type, arithmetic shift on a signed type. + The second operand is the number of bits to + shift by, and must always have mode SImode. + The result has the same mode as the first operand. */ +DEFTREECODE (LSHIFT_EXPR, "<<", "es", 3) +DEFTREECODE (RSHIFT_EXPR, ">>", "es", 3) +/* DEFTREECODE (LROTATE_EXPR, "lrotate_expr", "e", 2) + DEFTREECODE (RROTATE_EXPR, "rrotate_expr", "e", 2) */ + +/* Bitwise operations. Operands have same mode as result. */ +DEFTREECODE (BIT_OR_EXPR, "|", "ex", 2) +DEFTREECODE (BIT_NOR_EXPR, "~|", "ex", 2) +DEFTREECODE (BIT_XOR_EXPR, "^", "ex", 2) +DEFTREECODE (BIT_XNOR_EXPR, "~^", "ex", 2) +DEFTREECODE (BIT_AND_EXPR, "&", "ex", 2) +DEFTREECODE (BIT_NAND_EXPR, "~&", "ex", 2) + /* DEFTREECODE (BIT_ANDTC_EXPR, "bit_andtc_expr", "ex", 2) */ +DEFTREECODE (BIT_NOT_EXPR, "~", "eu", 1) + +/* Combination of boolean values or of integers considered only + as zero or nonzero. ANDIF and ORIF allow the second operand + not to be computed if the value of the expression is determined + from the first operand. AND and OR always compute the second + operand whether its value is needed or not (for side effects). */ +DEFTREECODE (TRUTH_ANDIF_EXPR, "&&", "e1", 3) +DEFTREECODE (TRUTH_ORIF_EXPR, "||", "e1", 3) +DEFTREECODE (TRUTH_AND_EXPR, "&&", "e1", 2) +DEFTREECODE (TRUTH_OR_EXPR, "||", "e1", 2) +DEFTREECODE (TRUTH_NOT_EXPR, "!", "er", 1) + +/* Relational operators. + `EQ_EXPR' and `NE_EXPR' are allowed for any types. + The others are allowed only for integer (or pointer or enumeral) + or real types. + In all cases the operands will have the same type, + and the value is always the type used by the language for booleans. */ +DEFTREECODE (LT_EXPR, "<", "e1", 2) +DEFTREECODE (LE_EXPR, "<=", "e1", 2) +DEFTREECODE (GT_EXPR, ">", "e1", 2) +DEFTREECODE (GE_EXPR, ">=", "e1", 2) +DEFTREECODE (EQ_EXPR, "==", "e1", 2) +DEFTREECODE (NE_EXPR, "!=", "e1", 2) +DEFTREECODE (EQ_CASE_EXPR, "===", "e1", 2) +DEFTREECODE (NE_CASE_EXPR, "!==", "e1", 2) + +/* Unary reduction operators */ +DEFTREECODE (AND_REDUCE_EXPR, "&", "er", 1) +DEFTREECODE (NAND_REDUCE_EXPR, "~&", "er", 1) +DEFTREECODE (OR_REDUCE_EXPR, "|", "er", 1) +DEFTREECODE (NOR_REDUCE_EXPR, "~|", "er", 1) +DEFTREECODE (XOR_REDUCE_EXPR, "^", "er", 1) +DEFTREECODE (XNOR_REDUCE_EXPR, "~^", "er", 1) + +/* Expressions that represent simulation activity: delay and event */ + +/* Delay points to rise, fall, and Z delay expressions. The transition + to Z may be null. The next 3 entries are for the respective + expression instructions */ +DEFTREECODE (DELAY_EXPR, "delay_expr", "e", 6) + +/* Event expression points to a tree list of ORed event expressions. + TREE_PURPOSE pointe to the exent expression; + TREE_VALUE contains either ANY_EDGE, POS_EDGE, or NEG_EDGE */ +/* DEFTREECODE (EVENT_EXPR, "event_expr", "e", 1) */ + +/* Represents a conversion of type of a value. + All conversions, including implicit ones, must be + represented by CONVERT_EXPR nodes. */ +DEFTREECODE (CONVERT_EXPR, "convert_expr", "e", 1) + +/* Represents conversion to REAL from any other type */ +DEFTREECODE (REAL_CONV_EXPR, "$itor ", "ec", 1) + +/* Represents conversion to INTEGER from REAL */ +DEFTREECODE (INT_CONV_EXPR, "$rtoi ", "ec", 1) + +/* Represents a conversion expected to require no code to be generated. */ +DEFTREECODE (NOP_EXPR, "nop_expr", "ec", 1) + + diff --git a/src/tree.h b/src/tree.h new file mode 100644 index 0000000..94421a1 --- /dev/null +++ b/src/tree.h @@ -0,0 +1,1481 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* TREE.H - Tree structures and routine prototypes + +/* This is here as a placeholder since not all modules that include + tree.h will also include decl.h +*/ + +#ifndef TREE_H +#define TREE_H + +#include "veriuser.h" + +/* codes of tree nodes */ + +#define DEFTREECODE(SYM, STRING, TYPE, NARGS) SYM, + +enum tree_code { +#include "tree.def" + + LAST_AND_UNUSED_TREE_CODE /* A convienent way to get a value for + NUM_TREE_CODE. */ +}; + +#undef DEFTREECODE + +/* Number of tree codes. */ +#define NUM_TREE_CODES ((int)LAST_AND_UNUSED_TREE_CODE) + +/* Indexed by enum tree_code, contains a character which is + `e' for an expression, `r' for a reference, `c' for a constant, + `d' for a decl, `s' for a statement, `b' for a block, + and `x' for anything else (TREE_LIST, IDENTIFIER, etc). */ + +extern char *tree_code_type[]; + +/* Number of argument-words in each kind of tree-node. */ + +extern int tree_code_length[]; + +/* Name of tree node */ + +extern char *tree_code_name[]; + +enum tree_type { + NO_TYPE, + MODULE_TYPE, + FUNCTION_TYPE, + TASK_TYPE, + REG_TYPE, + INTEGER_TYPE, + EVENT_TYPE, + TIME_TYPE, + REAL_TYPE, + NET_TRI_TYPE, + NET_WIRE_TYPE, + NET_TRIOR_TYPE, + NET_WOR_TYPE, + NET_TRIAND_TYPE, + NET_WAND_TYPE, + NET_TRIREG_TYPE, + NET_TRI0_TYPE, + NET_TRI1_TYPE, + NET_SUPPLY0_TYPE, + NET_SUPPLY1_TYPE, + NAMED_BLOCK_TYPE, + GATE_AND_TYPE, + GATE_NAND_TYPE, + GATE_OR_TYPE, + GATE_NOR_TYPE, + GATE_XOR_TYPE, + GATE_XNOR_TYPE, + GATE_BUF_TYPE, + GATE_NOT_TYPE, + GATE_BUFIF0_TYPE, + GATE_BUFIF1_TYPE, + GATE_NOTIF0_TYPE, + GATE_NOTIF1_TYPE, + GATE_NMOS_TYPE, + GATE_PMOS_TYPE, + GATE_RNMOS_TYPE, + GATE_RPMOS_TYPE, + GATE_CMOS_TYPE, + GATE_RCMOS_TYPE, + GATE_PULLUP_TYPE, + GATE_PULLDN_TYPE, + GATE_TRAN_TYPE, + GATE_RTRAN_TYPE, + GATE_TRANIF0_TYPE, + GATE_TRANIF1_TYPE, + GATE_RTRANIF0_TYPE, + GATE_RTRANIF1_TYPE, + GATE_UDP_TYPE, + STRENGTH_SUPPLY0_TYPE, + STRENGTH_SUPPLY1_TYPE, + STRENGTH_STRONG0_TYPE, + STRENGTH_STRONG1_TYPE, + STRENGTH_PULL0_TYPE, + STRENGTH_PULL1_TYPE, + STRENGTH_HIGHZ0_TYPE, + STRENGTH_HIGHZ1_TYPE, + STRENGTH_WEAK0_TYPE, + STRENGTH_WEAK1_TYPE +}; + +enum delay_type { + MIN_DELAY, + TYP_DELAY, + MAX_DELAY +}; + +enum lval_type { + LVAL_REG, + LVAL_NEW_NET, + LVAL_NET, + LVAL_REG_NET, + LVAL_GATE +}; + +/* Codes that identify the various built in functions + so that expand_call can identify them quickly. */ + +/* May use this later for $display, etc. */ +//enum built_in_function +//{ +// DISPLAY, +// DISPLAYH, +// DISPLAYO, +// DISPLAYB +//}; + +/* The definition of tree nodes fills the next several pages. */ + +/* A tree node can represent a variable, an expression + or a statement. Each node has a TREE_CODE which says what kind of + thing it represents. Some common codes are: + INTEGER_TYPE -- represents a type of integers. + VAR_DECL -- represents a declared variable. + INTEGER_CST -- represents a constant integer value. + PLUS_EXPR -- represents a sum (an expression). + + As for the contents of a tree node: there are some fields + that all nodes share. Each TREE_CODE has various special-purpose + fields as well. The fields of a node are never accessed directly, + always through accessor macros. */ + +/* This type is used everywhere to refer to a tree node. */ + +typedef union tree_node *tree; + +#define NULL_TREE (tree) NULL + +/* forward defines for Metrowerks */ +struct Marker; +struct timeq_tag; + +/* Every kind of tree node starts with this structure, + so all nodes have these fields. + + See the accessor macros, defined below, for documentation of the fields. */ + +struct tree_common { + union tree_node *chain; + nbits_t nbits; + unsigned char type:8; + unsigned char code:8; + unsigned int label:8; + unsigned int sub_label:8; + + unsigned constant:1; + unsigned integer:1; +// unsigned signed_attr : 1; +// unsigned self_determined : 1; + unsigned port_input:1; + unsigned port_output:1; + unsigned port_redefined:1; + unsigned port_collapsed:1; + unsigned case_default:1; + /*unsigned parameter_override : 1; *//* uses case_default */ + /*unsigned lib_module : 1; *//* uses case_default */ + /*unsigned net_assign : 1; *//* uses case_default */ + unsigned net_scalared:1; + unsigned net_vectored:1; + unsigned stmt_surrogate:1; + unsigned vector_direction:1; + unsigned named_port:1; + /* unsigned port_immediate : 1; *//* uses named_port */ + unsigned interrupt_flag:1; /* Used only by CASE */ + /* unsigned real : 1; *//* uses interrupt_flag */ + unsigned hierarchical:1; + unsigned initialized:1; + unsigned referenced:1; +/* There is room for 0 more attributes. */ +/* -------------------- */ + unsigned unknown_type:1; + unsigned udp:1; + unsigned pli_asynch:1; + unsigned pad:13; +/* There is room for 14 more attributes. */ + +//#ifdef ALIGN_32 +// short pad; /* align to 32 bits */ +//#endif +}; + +/* Define accessors for the fields that all tree nodes have + (though some fields are not used for all kinds of nodes). */ + +/* The tree-code says what kind of node it is. + Codes are defined in tree.def. */ +#define TREE_CODE(NODE) ((enum tree_code) (NODE)->common.code) +#define TREE_SET_CODE(NODE, VALUE) ((NODE)->common.code = (int) (VALUE)) + +/* In all nodes that are expressions, this is the data type of the expression. + In declarations, this is the declaration data type. + In NET declarations, this is the NET subtype (WIRE, TRI0, etc.) */ +#define TREE_TYPE(NODE) ((NODE)->common.type) +#define TREE_SET_TYPE(NODE, VALUE) ((NODE)->common.type = (int) (VALUE)) + +/* In all nodes that are expressions, assign a "label" that will determine + the order of execution and the required depth of the stack for that + expression (From Aho 1986) */ +#define TREE_LABEL(NODE) ((NODE)->common.label) + +/* In all nodes that are expressions, assign a "sub-label" that is used + to determin the depth of the stack for a subexpression using the same + expression length (reduction, conditional, etc. operations may change + the expression length and will thus reset this value within an + expression. */ +#define TREE_SUB_LABEL(NODE) ((NODE)->common.sub_label) + +/* In all nodes that are expressions, "nbits" is the number of bits + in the result taking into account context dependent-ness. */ +#define TREE_NBITS(NODE) ((NODE)->common.nbits) + +/* Nodes are chained together for many purposes. + Decls in the same scope are chained together to record the contents + of the scope. + Statement nodes for successive statements used to be chained together. + Often lists of things are represented by TREE_LIST nodes that + are chained together. */ + +#define TREE_CHAIN(NODE) ((NODE)->common.chain) + +/* Define many boolean fields that all tree nodes have. */ + +/* For expression nodes, this determines if the expression tree represents + a constant expression. */ +#define TREE_CONSTANT_ATTR(NODE) ((NODE)->common.constant) + +/* For expression nodes, this determines if the expression tree represents + an integer expression. */ +#define TREE_INTEGER_ATTR(NODE) ((NODE)->common.integer) + +/* Also, determine if expression/constant/ref is signed or unsigned */ +#define TREE_SIGNED_ATTR(NODE) ((NODE)->common.signed_attr) + +/* Certain operators are defined as have self-determined or context-determined + lengths as a result. */ +#define TREE_SELF_DETERMINED_ATTR(NODE) ((NODE)->common.self_determined) + + +/* For ports and function/task arguments, define it as being an input, + output or inout. */ +#define PORT_INPUT_ATTR(NODE) ((NODE)->common.port_input) +#define PORT_OUTPUT_ATTR(NODE) ((NODE)->common.port_output) +#define PORT_REDEFINED_ATTR(NODE) ((NODE)->common.port_redefined) + +/* For NETs (applied to all DECLs, but should always be 0), mark if a + source to a net is a collapsed port. If so, it will be scheduled + immediately. */ +#define PORT_COLLAPSED_ATTR(NODE) ((NODE)->common.port_collapsed) + +/* For NETS that are collapsed, indicate this fact in the port argument + in the instance statement. It cannot be labeled as PORT_COLLAPSE + because do_net_eval uses that to ignore it for calculating the value + to be propigated to the output port. */ +#define PORT_IMMEDIATE_ATTR(NODE) ((NODE)->common.named_port) + +/* For case statements, mark the statement as having seen a default case + to flag multiple default cases. */ +#define CASE_DEFAULT_ATTR(NODE) ((NODE)->common.case_default) + +/* For parameter assignments, indicates that this assignment has + been overridden. Use the override rval. */ +#define PARAMETER_OVERRIDE_ATTR(NODE) ((NODE)->common.case_default) + +/* Modules that have been found in the library are tagged as such since + the same module name might be used for several library modules, each + a different number of arguments */ +#define LIB_MODULE_ATTR(NODE) ((NODE)->common.case_default) + +/* Net assignments get evaluated immediately, as opposed to continuous + assignements which are scheduled. Use this attribute to distinguish + the difference. */ +#define NET_ASSIGN_ATTR(NODE) ((NODE)->common.case_default) + +/* For nets, indicate if declaration is forcing expansion or forcing + no expansion. */ +#define NET_SCALARED_ATTR(NODE) ((NODE)->common.net_scalared) +#define NET_VECTORED_ATTR(NODE) ((NODE)->common.net_vectored) + +/* In a FOR statement, there are two nodes generated, on for the initial + expression/condition, and one for the iteration expression/condition. + Mark the interation node so that it can be fixed up in pass 3. */ +/* In certain statements, entering it for the first time has a different + effect that re-entering after a loop or returning after an event. + Such statements include FOR. */ +#define STMT_SURROGATE_ATTR(NODE) ((NODE)->common.stmt_surrogate) + +/* In a repeat statement, this it toggled at runtime to determine of the + expression should be evaluated (first time through), or if the top + of the stack should be decremented. */ +//#define REPEAT_1ST_ATTR(NODE) ((NODE)->common.repeat_1st) + +/* In a vectored data type, this is set if the msb is greater than the + lsb (usual case) */ +#define VECTOR_DIRECTION_ATTR(NODE) ((NODE)->common.vector_direction) + +/* In module instances and module declarations, NAMED_PORT_ATTR indicates + that named ports are being used and in the port list, TREE_VALUE + points to an IDENTIFIER_NODE that is the name of the port. */ +#define NAMED_PORT_ATTR(NODE) ((NODE) -> common.named_port) + +/* Determines if this decl is a REAL number */ +#define TREE_REAL_ATTR(NODE) ((NODE) -> common.interrupt_flag) + +/* For case statements (and maybe others in the future), the statement could + be interrupted in the middle of processing by control C or single step. + This is intself is OK, but if another statment is executed, then the state + needs to be staved. INTERRUPT_FLAG tells exec to redo the command without + tracing. */ +#define INTERRUPT_FLAG_ATTR(NODE) ((NODE) -> common.interrupt_flag) + +/* If an IDENTIFIER_NODE (as well as TASK and FUNCTION nodes) + contains a hierarchical reference (xx.xxx.xxx...) + then it will be tagged as such in parse.y. */ +#define HIERARCHICAL_ATTR(NODE) ((NODE) -> common.hierarchical) + +/* When a block node or decl node has been initialized in pass2 (or pass3), + set INITIALIZED_ATTR for debugging and sanity check and, in the case of + module blocks, to avoid being initialized twice. */ +#define INITIALIZED_ATTR(NODE) ((NODE) -> common.initialized) + +/* When a decl node is referenced, mark it as such. For now, if a port + is declared, then referenced, then redeclared, we can't handle this, + so flag it. */ +#define REFERENCED_ATTR(NODE) ((NODE) -> common.referenced) + +/* If there is a hierarchical name or a function in an expression, then + compile-time type conversion won't work. Do some extra work in pass3.c */ +#define UNKNOWN_TYPE_ATTR(NODE) ((NODE) -> common.unknown_type) + +/* If module definition is really for a udp flag, set this flag */ +#define UDP_ATTR(NODE) ((NODE) -> common.udp) + +/* If pli async is enabled set this flag */ +#define ASYNCH_ATTR(NODE) ((NODE) -> common.pli_asynch) + + +/* Define additional fields and accessors for nodes representing constants. */ + +/* In an INTEGER_CST node. This represents a signed 32-bit constant. */ +#define INT_CST_HIGH(node) ((node)->int_cst.high) +#define INT_CST_LOW(node) ((node)->int_cst.low) +#define INT_CST_DATA(NODE) ((NODE)->int_cst.data) + +struct tree_int_cst { + char common[sizeof(struct tree_common)]; + signed_32_t data; +}; + +#define REAL_CST_DATA(NODE) ((NODE)->real_cst.data) + +struct tree_real_cst { + char common[sizeof(struct tree_common)]; + double data; +}; + +/* Bit constants are unsigned, of any length. TREE_BIT_LENGTH is the + size of the constant in bits; TREE_BITVAL_POINTER points to a bitval + structure that stores the value. */ + +enum radii { BIN, HEX, OCT, DEC, STRING_, CHAR_, EXP_, FLOAT_, EXPFLOAT_, + TIME_ }; + +#define BIT_CST_GROUP(NODE) ((NODE)->bit_cst.group) +#define BIT_CST_RADIX(NODE) ((NODE)->bit_cst.radix) +#define BIT_CST_SET_RADIX(NODE, VALUE) ((NODE)->bit_cst.radix = (enum radii) (VALUE)) +#define BIT_CST_NBITS(NODE) ((NODE)->bit_cst.nbits) +//#define BIT_CST_NGROUPS(NODE) (((NODE)->bit_cst.nbits) >> GROUP_SHIFT_BITS) + +struct tree_bit_cst { + char common[sizeof(struct tree_common)]; + enum radii radix; + nbits_t nbits; + union group *group; +}; + +/* In a STRING_CST */ +#define TREE_STRING_LENGTH(NODE) ((NODE)->string.length) +#define TREE_STRING_POINTER(NODE) ((NODE)->string.pointer) + +struct tree_string { + char common[sizeof(struct tree_common)]; + int length; + char *pointer; +}; + +/* Define fields and accessors for some special-purpose tree nodes. */ + +#define IDENTIFIER_LENGTH(NODE) ((NODE)->identifier.length) +#define IDENTIFIER_POINTER(NODE) ((NODE)->identifier.pointer) +#define IDENT(NODE) ((NODE)->identifier.pointer) +#define IDENT_CURRENT_DECL(NODE) ((NODE)->identifier.current_decl) + +struct tree_identifier { + char common[sizeof(struct tree_common)]; + int length; + char *pointer; + union tree_node *current_decl; +}; + +/* In a TREE_LIST node. */ +#define TREE_PURPOSE(NODE) ((NODE)->list.purpose) +#define TREE_VALUE(NODE) ((NODE)->list.value) +#define TREE_3RD(NODE) ((NODE)->list.third.exp) + +/* Alternate reference method */ +#define TREE_EXPR(NODE) ((NODE)->list.purpose) +#define TREE_STMT(NODE) ((NODE)->list.value) +#define TREE_EXPR_CODE(NODE) ((NODE)->list.third.exp_code) + +/* Another reference for tmp vars for PLI arguments */ +#define TREE_PLIINFO(NODE) ((NODE)->list.value) + +struct tree_list { + char common[sizeof(struct tree_common)]; + union tree_node *purpose; + union tree_node *value; + union { + union tree_node *exp; + union tree_node **exp_code; + } third; +}; + + +/* Define fields and accessors for some nodes that represent expressions. */ + +/* In expression and reference nodes. */ +#define TREE_OPERAND(NODE, I) ((NODE)->exp.operands[I].exp) +#define REF_NAME(NODE) ((NODE)->exp.operands[0].exp) + +#define TRUTH_EXPR_CODE(NODE) ((NODE)->exp.operands[2].exp_code) + +#define BIT_REF_DECL(NODE) ((NODE)->exp.operands[0].exp) +#define BIT_EXPR(NODE) ((NODE)->exp.operands[1].exp) +#define BIT_EXPR_CODE(NODE) ((NODE)->exp.operands[2].exp_code) +#define BIT_REF_NAME(NODE) ((NODE)->exp.operands[3].exp) + +#define ARRAY_REF_DECL(NODE) ((NODE)->exp.operands[0].exp) +#define ARRAY_EXPR(NODE) ((NODE)->exp.operands[1].exp) +#define ARRAY_EXPR_CODE(NODE) ((NODE)->exp.operands[2].exp_code) +#define ARRAY_REF_NAME(NODE) ((NODE)->exp.operands[3].exp) + +#define FUNC_REF_NAME(NODE) ((NODE)->func.name) +#define FUNC_REF_ARGS(NODE) ((NODE)->func.args) +#define FUNC_REF_FUNC(NODE) ((NODE)->func.type.func) +#define FUNC_REF_INASSIGN(NODE) ((NODE)->func.inassign) +#define FUNC_REF_LINE(NODE) ((lineno_t)(NODE)->func.line) +#define FUNC_REF_FILE(NODE) ((NODE)->func.file) +#define FUNC_REF_CONTEXT(NODE) ((NODE)->func.context) +#define FUNC_REF_SYSTYPE(NODE) ((enum sysfunction_type)(NODE)->func.type.systype) +#define SET_FUNC_REF_SYSTYPE(NODE, VALUE) ((NODE)->func.type.systype = \ + (int)(VALUE)) +#define FUNC_REF_USERTF(NODE) ((NODE)->func.usertf) +#define FUNC_REF_WORKAREA(NODE) ((NODE)->func.workArea) +#define FUNC_REF_DELAYSCB(NODE) ((NODE)->func.delaySCB) +#define FUNC_REF_RETURNDECL(NODE) ((NODE)->func.returndecl) +#define FUNC_REF_NEXT(NODE) ((NODE)->func.nextinstance) + +struct tree_func { + char common[sizeof(struct tree_common)]; + char *name; + union tree_node *args; + union { + union tree_node *func; + int systype; +// enum sysfunction_type systype; + } type; + union tree_node *inassign; + lineno_t line; + char *file; + union tree_node *context; + p_tfcell usertf; /* PLI user_tf pointer (0 if not PLI) */ + char *workArea; /* used by pli routines */ + struct SCB *delaySCB; /* used for tf_setdelay */ + union tree_node *returndecl; /* decl holding return value */ + union tree_node *nextinstance; /* linked list of all pli instances */ +}; + +#define HIERARCHICAL_REF_IDENT(NODE) ((NODE)->exp.operands[0].exp) + +#define SHIFT_OPERAND(NODE) ((NODE)->shift.operand) +#define SHIFT_COUNT(NODE) ((NODE)->shift.count) +#define SHIFT_NBITS(NODE) ((NODE)->shift.nbits) + +struct tree_shift { + char common[sizeof(struct tree_common)]; + union tree_node *operand; + union tree_node *count; + nbits_t nbits; +}; + +/* This is used for part-selects and conatenations */ +#define PART_RMASK(NODE) ((NODE)->rmask) +#define PART_LMASK1(NODE) ((NODE)->lmask1) +#define PART_LMASK2(NODE) ((NODE)->lmask2) +#define PART_NGROUPS(NODE) ((NODE)->ngroups) +#define PART_SHIFT(NODE) ((NODE)->shift) +#define PART_NEXT(NODE) ((NODE)->next) +#define PART_ALIGNED(NODE) ((NODE)->aligned) +struct part_info { + Bit rmask; + Bit lmask1; + Bit lmask2; + ngroups_t ngroups; + int shift; + ngroups_t next; + unsigned aligned:1; +}; + +#define COND_EXPR(NODE) ((NODE)->exp.operands[0].exp) +#define COND_EXPR_CODE(NODE) ((NODE)->exp.operands[1].exp_code) +#define COND_TRUE(NODE) ((NODE)->exp.operands[2].exp) +#define COND_TRUE_CODE(NODE) ((NODE)->exp.operands[3].exp_code) +#define COND_FALSE(NODE) ((NODE)->exp.operands[4].exp) +#define COND_FALSE_CODE(NODE) ((NODE)->exp.operands[5].exp_code) + +#define PART_INFO(NODE) ((NODE)->part.info) +#define PART_DECL(NODE) ((NODE)->part.decl) +#define PART_MSB_(NODE) ((NODE)->part.msb_) +#define PART_LSB_(NODE) ((NODE)->part.lsb_) +#define PART_MSB(NODE) ((NODE)->part.msb) +#define PART_LSB(NODE) ((NODE)->part.lsb) +#define PART_STORAGE(NODE) ((NODE)->part.storage) +#define PART_NAME(NODE) ((NODE)->part.name) + +struct tree_part { + char common[sizeof(struct tree_common)]; + struct part_info *info; + union tree_node *decl; + union tree_node *msb_; + union tree_node *lsb_; + nbits_t msb; + nbits_t lsb; + Group *storage; + union tree_node *name; +}; + +#define CONCAT_LIST(NODE) ((NODE)->concat.list) +#define CONCAT_NBITS(NODE) ((NODE)->concat.nbits) +#define CONCAT_EXPR(NODE) ((NODE)->concat.expr) +#define CONCAT_COUNT(NODE) ((NODE)->concat.count) + +struct tree_concat { + char common[sizeof(struct tree_common)]; + union tree_node *list; + nbits_t nbits; + union tree_node *expr; /* for repeat counts */ + unsigned_32_t count; /* ditto */ +}; + +struct tree_exp { + char common[sizeof(struct tree_common)]; + union { + int value; + union tree_node *exp; + union tree_node **exp_code; + } operands[1]; +}; + +/* Define fields and accessors for nodes representing declared names. */ + +#define DECL_NAME(NODE) ((NODE)->decl_common.name) +#define DECL_CONTEXT(NODE) ((NODE)->decl_common.context) +#define DECL_RESULT(NODE) ((NODE)->decl_common.result) +#define DECL_INITIAL(NODE) ((NODE)->decl_common.initial) +#define DECL_SOURCE_FILE(NODE) ((NODE)->decl_common.filename) +#define DECL_SOURCE_LINE(NODE) ((NODE)->decl_common.linenum) +#define DECL_SIZE(NODE) ((NODE)->decl_common.size) +//#define DECL_ACTIVE(NODE) ((NODE)->decl_common.active) +#define DECL_UNUSED_FLAG(NODE) ((NODE)->common.parameter1_attr) +#define DECL_STORAGE(NODE) ((NODE)->decl_common.storage) +//#define DECL_ARRAY(NODE) ((NODE)->common.flag2) +#define DECL_MSB(NODE) ((NODE)->decl_common.msb_) +#define DECL_LSB(NODE) ((NODE)->decl_common.lsb_) +//#define DECL_NBITS(NODE) ((NODE)->decl_common.nbits) +#define DECL_STORAGE(NODE) ((NODE)->decl_common.storage) +#define DECL_EVENT_CHAIN(NODE) ((NODE)->decl_common.event_chain) +#define DECL_EVENT_NOCAST(NODE) ((NODE)->decl_common.event_chain) +#define DECL_STATE(NODE) ((enum logical_value) (NODE)->decl_common.state) +#define SET_DECL_STATE(NODE, VALUE) ((NODE)->decl_common.state = (enum logical_value)(VALUE)) +#define DECL_THREAD(NODE) ((NODE)->decl_common.thread) +#define DECL_UPDATE_FILE(NODE) ((NODE)->decl_common.update_file) +#define DECL_UPDATE_LINE(NODE) ((NODE)->decl_common.update_line) +#define DECL_UPDATE_TIME(NODE) ((NODE)->decl_common.update_time) + +#define MSB(NODE) ((NODE)->decl_common.msb) +#define LSB(NODE) ((NODE)->decl_common.lsb) + +struct tree_decl_common { + char common[sizeof(struct tree_common)]; + char *filename; + lineno_t linenum; + int size; + union tree_node *name; + union tree_node *context; + union tree_node *msb_; + union tree_node *lsb_; + nbits_t msb; + nbits_t lsb; +// nbits_t nbits; + union group *storage; + struct Marker *event_chain; +// void *event_chain; + int state; +// enum logical_value state; + union tree_node *thread; + char *update_file; + lineno_t update_line; + time64 update_time; +}; + +/* In a PLI_DELAY node */ +#define PLI_DELAY_NEXT(NODE) ((NODE)->pli_delay.next) +#define PLI_DELAY_NODE(NODE) ((NODE)->pli_delay.node) +#define PLI_DELAY_TIME(NODE) ((NODE)->pli_delay.time) +#define PLI_DELAY_STORAGE(NODE) ((NODE)->pli_delay.storage) +#define PLI_DELAY_LVAL(NODE) ((NODE)->pli_delay.lval) + +struct tree_pli_delay { + char common[sizeof(struct tree_common)]; + union tree_node *next; + union tree_node *node; + time64 time; + union group *storage; + union tree_node *lval; +}; + + + + +/* In a PATH_INPUT_TERMINAL (TREE_LIST) */ +#define MODPATH_INPUT_TERMINAL_PARENT(NODE) TREE_STMT(NODE) + +/* In a PATH_NODE node. */ +#define PATH_SOURCE_FILE(NODE) ((NODE)->path.filename) +#define PATH_SOURCE_LINE(NODE) ((NODE)->path.linenum) +#define PATH_DELAYS(NODE) ((NODE)->path.delays) +#define PATH_INPUTS(NODE) ((NODE)->path.inputs) +#define PATH_OUTPUTS(NODE) ((NODE)->path.outputs) +#define PATH_PARALLEL(NODE) ((NODE)->path.parallel) +#define PATH_SOURCE(NODE) ((NODE)->path.source) +#define PATH_CONDITION(NODE) ((NODE)->path.condition) +#define PATH_EDGE(NODE) ((NODE)->path.edge) +#define PATH_POLARITY(NODE) ((NODE)->path.polarity) + +struct tree_path { + char common[sizeof(struct tree_common)]; + char *filename; + lineno_t linenum; + union tree_node *delays; + union tree_node *inputs; + union tree_node *outputs; + union tree_node *source; + union tree_node *condition; + int parallel; + int edge; + int polarity; +}; + + + +/* in PATH_INSTANCE */ +#define PATH_INSTANCE_MODULE(NODE) ((NODE)->path_instance.module) +#define PATH_INSTANCE_PATHDESC(NODE) ((NODE)->path_instance.pathdesc) + +struct tree_path_instance { + char common[sizeof(struct tree_common)]; + union tree_node *module; /* points to containing module */ + union tree_node *pathdesc; /* path description */ +}; + + + +/* in PATH_OUTPUT */ +#define PATH_OUTPUT_GATE(NODE) ((NODE)->path_output.gate) +#define PATH_OUTPUT_VALUE(NODE) ((NODE)->path_output.value) +#define PATH_OUTPUT_PATHDESC(NODE) ((NODE)->path_output.pathdesc) +#define PATH_OUTPUT_CONSTRAINTS(NODE) ((NODE)->path_output.constraints) +#define PATH_OUTPUT_SCB(NODE) ((NODE)->path_output.scb) +#define PATH_OUTPUT_CURRENT_VALUE(NODE) ((NODE)->path_output.current_value) + +struct tree_path_output { + char common[sizeof(struct tree_common)]; + union tree_node *gate; /* points to associated gate */ + enum logical_value value; /* keeps track of value to be propagated */ + union tree_node *pathdesc; /* list of path descriptions */ + union tree_node *constraints; /* list of path constraints */ + struct SCB *scb; /* scb for specify path */ + enum logical_value current_value; /* keeps track of current value */ +}; + + + +#define PATH_CONSTRAINT_DELAY(NODE,FROM,TO) ((NODE)->path_constraint.delays[((FROM)<<2)|(TO)]) +#define PATH_CONSTRAINT_DEPENDENCIES(NODE) ((NODE)->path_constraint.dependencies) +#define PATH_CONSTRAINT_PATHDESC(NODE) ((NODE)->path_constraint.pathdesc) +#define PATH_CONSTRAINT_INSTANCE(NODE) ((NODE)->path_constraint.instance) +#define PATH_CONSTRAINT_OUTPUT_NUMBER(NODE) ((NODE)->common.sub_label) + +struct tree_path_constraint { + char common[sizeof(struct tree_common)]; + union tree_node *dependencies; + union tree_node *pathdesc; + union tree_node *instance; + unsigned delays[16]; +}; + +/* timing check specification */ + +#define CHECK_SPEC_EVENT1(NODE) ((NODE)->check_spec.event1) +#define CHECK_SPEC_EVENT2(NODE) ((NODE)->check_spec.event2) +#define CHECK_SPEC_PARAM1(NODE) ((NODE)->check_spec.param1) +#define CHECK_SPEC_PARAM2(NODE) ((NODE)->check_spec.param2) +#define CHECK_SPEC_NOTIFIER(NODE) ((NODE)->check_spec.notifier) +#define CHECK_SPEC_CHECKTYPE(NODE) ((NODE)->check_spec.checkType) + +struct tree_check_spec { + char common[sizeof(struct tree_common)]; + char *filename; + lineno_t linenum; + union tree_node *event1; + union tree_node *event2; + union tree_node *param1; + union tree_node *param2; + union tree_node *notifier; + unsigned checkType; +}; + +/* specify timing event specification */ + +#define TIMING_EVENT_EXPRESSION(NODE) ((NODE)->timing_event.expression) +#define TIMING_EVENT_CONDITION(NODE) ((NODE)->timing_event.condition) +#define TIMING_EVENT_EDGESPEC(NODE) ((NODE)->timing_event.edgeSpec) +struct tree_timing_event { + char common[sizeof(struct tree_common)]; + union tree_node *expression; + union tree_node *condition; + unsigned edgeSpec; +}; + +/* timing check terminal */ + +#define TIMING_TERMINAL_CHECK(NODE) (TREE_STMT(NODE)) + +/* timing check node */ + +#define TIMING_CHECK_PARAM1(NODE) ((NODE)->timing_check.param1) +#define TIMING_CHECK_PARAM2(NODE) ((NODE)->timing_check.param2) +#define TIMING_CHECK_EXPRESSIONCODE(NODE,I) ((NODE)->timing_check.expressionCode[I]) +#define TIMING_CHECK_EXPRESSION(NODE,I) ((NODE)->timing_check.expression[I]) +#define TIMING_CHECK_NOTIFIER(NODE) ((NODE)->timing_check.notifier) +#define TIMING_CHECK_CURRENTVALUE(NODE,I) ((NODE)->timing_check.currentValue[I]) +#define TIMING_CHECK_CHANGETIME(NODE,I) ((NODE)->timing_check.changeTime[I]) +#define TIMING_CHECK_CONDITION(NODE,I) ((NODE)->timing_check.condition[I]) +#define TIMING_CHECK_CONDITIONCODE(NODE,I) ((NODE)->timing_check.conditionCode[I]) +#define TIMING_CHECK_EDGESPEC(NODE,I) ((NODE)->timing_check.edgeSpec[I]) +#define TIMING_CHECK_CHECKSPEC(NODE) ((NODE)->timing_check.checkSpec) +#define TIMING_CHECK_MODULE(NODE) ((NODE)->timing_check.module) + +struct tree_timing_check { + char common[sizeof(struct tree_common)]; + int param1; + int param2; + union tree_node *expression[2]; + union tree_node **expressionCode[2]; + union tree_node *notifier; + int currentValue[2]; + time64 changeTime[2]; + union tree_node *condition[2]; + union tree_node **conditionCode[2]; + unsigned int edgeSpec[2]; + union tree_node *checkSpec; + union tree_node *module; +}; + +#define NOTIFIER_DECL(NODE) ((NODE)->common.chain) +#define NOTIFIER_TIMESTAMP(NODE) ((NODE)->notifier.timeStamp) + +struct tree_notifier { + char common[sizeof(struct tree_common)]; + time64 timeStamp; +}; + +#define UDP_STRING_STRING(NODE) ((NODE)->udp_string.string) +#define UDP_STRING_FILE(NODE) ((NODE)->udp_string.filename) +#define UDP_STRING_LINE(NODE) ((NODE)->udp_string.linenum) + +struct tree_udp_string { + char common[sizeof(struct tree_common)]; + char *filename; + lineno_t linenum; + char string[28]; +}; + +#define UDP_TABLE_ARRAY(NODE,I) ((NODE)->udp_table.array[I]) + +struct tree_udp_table { + char common[sizeof(struct tree_common)]; + char *array[10]; +}; + +/* Array is used as a modifier; noun points to decl node. Array is used + for regs (scalar and vector), int, time and real (eventually) */ +//#define ARRAY_DECL(NODE) ((NODE)->decl_array.decl) +#define ARRAY_CODE(NODE) ((NODE)->decl_array.code) +#define ARRAY_HI_EXPR(NODE) ((NODE)->decl_array.hi_expr) +#define ARRAY_LO_EXPR(NODE) ((NODE)->decl_array.lo_expr) +#define ARRAY_HI(NODE) ((NODE)->decl_array.hi) +#define ARRAY_LO(NODE) ((NODE)->decl_array.lo) +/* Recast storage to be array of pointers */ +//#define ARRAY_STORAGE(NODE) ((Group **)(NODE)->decl_common.storage) + +struct tree_decl_array { + char decl_common[sizeof(struct tree_decl_common)]; +// union tree_node *decl; + enum tree_code code; + union tree_node *lo_expr; + union tree_node *hi_expr; + nbits_t lo; + nbits_t hi; +}; + +/* For net declarations. STMT_SURROGATE_ATTR indicates that the net is one + of many sources to the net and holds the value for that source. */ + +#define NET_DELAY(NODE) ((NODE)->decl_net.delay) +#define NET_SOURCE(NODE) ((NODE)->decl_net.source) +#define NET_ASSIGNMENT(NODE) ((NODE)->decl_net.assignment) + +struct tree_decl_net { + char decl_common[sizeof(struct tree_decl_common)]; + union tree_node *delay; /* points to delay expression for the net */ + union tree_node *source; /* points to other sources to this net */ + union tree_node *assignment; /* points to con't ass't for this net */ +}; + +/* This is used for port terminal connections */ + +#define PORT_TERMINAL_HICONN(NODE) (TREE_VALUE(NODE)) + +/* This is used for module ports and function/task arguments */ + +#define DECL_PORT_NOUN(NODE) ((NODE)->tree_decl_port.noun) +#define DECL_TASK_NOUN(NODE) ((NODE)->tree_decl_port.noun) +#define DECL_PORT_MSB(NODE) ((NODE)->tree_decl_port_vector.msb) +#define DECL_PORT_LSB(NODE) ((NODE)->tree_decl_port_vector.lsb) +struct tree_decl_port { + char decl_common[sizeof(struct tree_decl_common)]; + union tree_node *noun; +}; + +struct tree_decl_port_vector { + char decl_port[sizeof(struct tree_decl_port)]; + union tree_node *msb; + union tree_node *lsb; +}; + +/* Parameter declaration. Points to constant expression that represents + default value. */ + +//#define DECL_PARAM_INIT(NODE) ((NODE)->decl_parameter.initial) +#define DECL_PARAM_RVAL(NODE) ((NODE)->decl_parameter.rval) +#define DECL_PARAM_RVAL_CODE(NODE) ((NODE)->decl_parameter.rval_code) +#define DECL_PARAM_REDIRECT(NODE) ((NODE)->decl_parameter.redirect) + +struct tree_decl_parameter { + char decl_common[sizeof(struct tree_decl_common)]; + union tree_node *rval; + union tree_node **rval_code; + union tree_node *redirect; +}; + + + +/* This is used at runtime to keep track of which SCB is in which scope. + It is needed for disable and for future $list */ + +struct context_member { + struct context_member *next; + struct context_member **prev; + struct context_member *shadow; /* context_member of previous context */ + struct SCB *scb; /* Owner */ + union tree_node *pc; /* PC to which to return upon leaving */ + union tree_node *scope; /* Pointer to scoping block */ +}; + +/* Define scoping block nodes */ + +#define BLOCK_SOURCE_LINE(NODE) ((NODE)->block_common.linenum) +#define BLOCK_SOURCE_FILE(NODE) ((NODE)->block_common.filename) +#define BLOCK_NAME(NODE) ((NODE)->block_common.name) +#define BLOCK_DECL(NODE) ((NODE)->block_common.decl) +#define BLOCK_PORTS(NODE) ((NODE)->block_common.ports) +#define BLOCK_ARGS(NODE) ((NODE)->block_common.ports) +#define BLOCK_PARAM(NODE) ((NODE)->block_common.param) +#define BLOCK_DOWN(NODE) ((NODE)->block_common.down) +#define BLOCK_UP(NODE) ((NODE)->block_common.up) +#define BLOCK_BODY(NODE) ((NODE)->block_common.body) +#define BLOCK_CONTEXT_LIST(NODE) ((NODE)->block_common.context_list) +#define BLOCK_LCB_LIST(NODE) ((NODE)->block_common.lcb) + +struct tree_block_common { + char common[sizeof(struct tree_common)]; + char *filename; + lineno_t linenum; + union tree_node *name; + union tree_node *decl; + union tree_node *param; + union tree_node *ports; // Maybe merge w/decl later? + union tree_node *down; + union tree_node *up; + union tree_node *body; + struct context_member *context_list; + union tree_node *lcb; // line execution call back list +// union tree_node *scb_list; +}; + +#define MODULE_PORT_LIST(NODE) ((NODE)->block_module.port_list) +//#define MODULE_INSTANCES(NODE) ((NODE)->block_module.common.module.instances) +#define MODULE_INSTANCES(NODE) ((NODE)->block_common.body) +#define MODULE_ASSIGNMENTS(NODE) ((NODE)->block_module.common.module.assignments) +#define MODULE_NAME(NODE) ((NODE)->block_module.name) +#define MODULE_DEFPARAMS(NODE) ((NODE)->block_module.common.module.defparams) +#define MODULE_SPECDEFS(NODE) ((NODE)->block_module.common.module.specdefs) +#define MODULE_SPECINST(NODE) ((NODE)->block_module.common.module.specinst) + +#define MODULE_TIME_UNIT(NODE) ((NODE)->block_module.time_unit) +#define MODULE_TIME_PREC(NODE) ((NODE)->block_module.time_prec) + +/* UDP definitions overlay the same structure and type as modules + UDP will have the UDP_ATTR flag set */ + +#define UDP_PORT_LIST(NODE) ((NODE)->block_module.port_list) +#define UDP_NAME(NODE) ((NODE)->block_module.name) +#define UDP_REG_NAME(NODE) ((NODE)->block_module.common.udp.reg_name) +#define UDP_INITIAL_VALUE(NODE) ((NODE)->block_module.common.udp.initial_value) +#define UDP_STRING_LIST(NODE) ((NODE)->block_module.common.udp.string_list) +#define UDP_TABLE(NODE) ((NODE)->block_module.common.udp.udp_table) + +enum module_code { INITIAL_CODE, ALWAYS_CODE }; + +struct tree_block_module { + char block_common[sizeof(struct tree_block_common)]; + char *name; + union tree_node *port_list; + union tree_node *instances; + union { + struct { + union tree_node *assignments; + union tree_node *defparams; + union tree_node *specinst; + union tree_node *specdefs; + } module; + struct { + union tree_node *reg_name; + union tree_node *initial_value; + union tree_node *string_list; + union tree_node *udp_table; + } udp; + } common; + unsigned char time_unit:8; + unsigned char time_prec:8; +}; + +/* Block structure for functions (and tasks). decl is the decl node for + the return var */ + +#define FUNCT_INPUT(NODE) ((NODE)->block_funct.input) +#define FUNCT_OUTPUT(NODE) ((NODE)->block_funct.output) +#define FUNCT_DECL(NODE) ((NODE)->block_funct.decl) +//#define FUNCT_DECL_CODE(NODE) ((NODE)->block_funct.code) +#define FUNCT_AREA(NODE) ((NODE)->block_funct.area) + +#define TASK_INPUT(NODE) ((NODE)->block_funct.input) +#define TASK_OUTPUT(NODE) ((NODE)->block_funct.output) + +struct tree_block_funct { + char block_common[sizeof(struct tree_block_common)]; + union tree_node *input; + union tree_node *output; + union tree_node *decl; +// union tree_node **code; + ngroups_t area; +}; + +#define GATE(NODE) (&((NODE)->gate_instance)) +#define GATE_FILE(NODE) ((NODE)->gate_instance.filename) +#define GATE_LINE(NODE) ((NODE)->gate_instance.linenum) +#define GATE_SCOPE(NODE) ((NODE)->gate_instance.scope) +#define GATE_NAME(NODE) ((NODE)->gate_instance.name) +#define GATE_ROUTINE(NODE) ((NODE)->gate_instance.routine) +#define GATE_PROPAGATE_ROUTINE(NODE) ((NODE)->gate_instance.propagate_routine) +#define GATE_DELAY(NODE) ((NODE)->gate_instance.delay) +#define GATE_MARKERS(NODE) ((NODE)->gate_instance.markers) +#define GATE_TIME(NODE) ((NODE)->gate_instance.time) +#define GATE_OUTPUT(NODE) ((NODE)->gate_instance.output) +#define GATE_STATE(NODE) ((NODE)->gate_instance.state) +#define GATE_INPUTS(NODE) ((NODE)->gate_instance.total_inputs) +#define GATE_INPUT_LIST(NODE) ((NODE)->gate_instance.input_ports) +#define GATE_OUTPUT_LIST(NODE) ((NODE)->gate_instance.output_ports) +#define GATE_FIRED_INPUTS(NODE) ((NODE)->gate_instance.shared.gate.fired_inputs) +#define GATE_CONTROL(NODE) ((NODE)->gate_instance.shared.gate.fired_inputs) +#define GATE_ZEROS(NODE) ((NODE)->gate_instance.shared.gate.fired_inputs) +#define GATE_ONES(NODE) ((NODE)->gate_instance.shared.gate.fired_inputs) +#define GATE_X(NODE) ((NODE)->gate_instance.shared.gate.any_Xs) +#define GATE_NEXT(NODE) ((NODE)->gate_instance.next) +#define GATE_PREV(NODE) ((NODE)->gate_instance.prev) +#define GATE_INPUT_NUMBER(NODE) ((NODE)->common.sub_label) +#define GATE_TIMEQ(NODE) ((NODE)->gate_instance.timeq) + +/* Holds/sets the current value of the gate input */ +#define GATE_IN(LIST) ((enum logical_value)(LIST)->common.nbits) +#define SET_GATE_IN(LIST, NEW) ((LIST)->common.nbits=(NEW)) +#define GATE_PATH_OUTPUT(NODE) ((NODE)->gate_instance.path_output) +#define GATE_TERMINAL_GATE(NODE) (TREE_STMT(NODE)) +#define GATE_TERMINAL_NUMBER(NODE) ((NODE)->common.label) + +/* special members for udp gates */ +#define GATE_UDP_DEF(NODE) ((NODE)->gate_instance.shared.udp.udp_def) + + +struct tree_gate_instance { + char common[sizeof(struct tree_common)]; + char *filename; + lineno_t linenum; + union tree_node *scope; + char *name; /* name of the instance */ + void (*routine) (struct Marker *); /* routine to call to process gate */ + void (*propagate_routine) (union tree_node *); /* routine to call to propage gate output */ + union tree_node *input_ports; /* TREE_LIST of inputs */ + union tree_node *output_ports; /* TREE_LIST of outputs */ + union tree_node *delay; /* delay structure */ + struct Marker *markers; /* Pointer to markers */ +// void *markers; +// time64 time; /* time to trigger if delayed */ + enum logical_value output; /* scheduled output */ + int state; /* State of gate */ + int total_inputs; /* total number of inputs */ +// struct tree_gate_instance *next; /* For threading on the wait list */ +// struct tree_gate_instance **prev; /* (ok to use ADD_LIST, etc.) */ + tree next; /* next gate for given time */ + tree prev; /* prev gate for given time */ + struct timeq_tag *timeq; /* pointer to index node */ + union tree_node *path_output; /* pointer to specify path */ + union { + struct { + union tree_node *udp_def; /* points to udp_def node */ + int dummy; /* not used */ + } udp; + struct { + int fired_inputs; /* number of inputs at 1 (or 0) */ + int any_Xs; /* Are any inputs X (or Z)? */ + } gate; + } shared; + + +// union tree_node *next; /* For threading on the wait list */ +// union tree_node **prev; /* (ok to use ADD_LIST, etc.) */ +}; + + +/* Define fields and accessors for nodes representing statements. */ + +/* Common for most statements */ +#define STMT_SOURCE_LINE(NODE) ((NODE)->stmt.linenum) +#define STMT_SOURCE_FILE(NODE) ((NODE)->stmt.filename) +#define STMT_SCOPE(NODE) ((NODE)->stmt.scope) +#define STMT_BODY(NODE) ((NODE)->stmt.operand[0].exp) +#define STMT_OPERAND(NODE,I) ((NODE)->stmt.operand[I].exp) + +/* For IF_STMT. */ +#define STMT_COND(NODE) ((NODE)->stmt.operand[0].exp) +#define STMT_THEN(NODE) ((NODE)->stmt.operand[1].exp) +#define STMT_ELSE(NODE) ((NODE)->stmt.operand[2].exp) +#define STMT_COND_CODE(NODE) ((NODE)->stmt.operand[3].exp_code) + +/* For CASE_STMT. */ +#define STMT_CASE_EXPR(NODE) ((NODE)->stmt.operand[0].exp) +#define STMT_CASE_LIST(NODE) ((NODE)->stmt.operand[1].exp) +#define STMT_CASE_DEFAULT(NODE) ((NODE)->stmt.operand[2].exp) +#define STMT_CASE_EXPR_CODE(NODE) ((NODE)->stmt.operand[3].exp_code) +//#define STMT_CASE_DEFAULT_ATTR(NODE) ((NODE)->common.general1_attr) + +/* For REPEAT_STMT */ +#define STMT_REPEAT_EXPR(NODE) ((NODE)->stmt.operand[1].exp) +#define STMT_REPEAT_EXPR_CODE(NODE) ((NODE)->stmt.operand[2].exp_code) +#define STMT_REPEAT_VAR(NODE) ((NODE)->stmt.operand[3].group) + +/* For WHILE_STMT */ +#define STMT_WHILE_COND(NODE) ((NODE)->stmt.operand[1].exp) +#define STMT_WHILE_COND_CODE(NODE) ((NODE)->stmt.operand[2].exp_code) + +/* For FOR_STMT */ +#define STMT_FOR_ASSIGN(NODE) ((NODE)->stmt.operand[1].exp) +#define STMT_FOR_COND(NODE) ((NODE)->stmt.operand[2].exp) +#define STMT_FOR_COND_CODE(NODE) ((NODE)->stmt.operand[3].exp_code) + +/* Delay control */ +#define STMT_DELAY_EXPR(NODE) ((NODE)->stmt.operand[1].exp) +#define STMT_DELAY_EXPR_CODE(NODE) ((NODE)->stmt.operand[2].exp_code) + +/* Named BEGIN or FORK */ +#define STMT_BLOCK(NODE) ((NODE)->stmt.operand[1].exp) +/* points to stmt after end (points to end at parse; fixed up in pass 3) */ +//#define STMT_BEGIN_NAMED_END(NODE) ((NODE)->stmt.operand[2].exp) + +/* Fork stmts */ +#define STMT_FORK_SCB(NODE) ((NODE)->stmt.operand[2].scb) +/* Join stmt */ +//#define STMT_JOIN_FORK(NODE) ((void *)(NODE)->stmt.operand[0].exp) +#define STMT_JOIN_FORK(NODE) ((NODE)->stmt.operand[0].exp) + +/* Tasks and system tasks */ +#define STMT_TASK_NAME(NODE) ((NODE)->stmt.operand[0].name) +#define STMT_TASK_ARGS(NODE) ((NODE)->stmt.operand[1].exp) +#define STMT_TASK_TASK(NODE) ((NODE)->stmt.operand[2].exp) +#define STMT_TASK_INASSIGN(NODE) ((NODE)->stmt.operand[3].exp) +#define STMT_TASK_OUTASSIGN(NODE) ((NODE)->stmt.operand[4].exp) + +#define STMT_SYSTASK_TYPE(NODE) ((NODE)->stmt.operand[2].systask) +#define SET_STMT_SYSTASK_TYPE(NODE, VALUE) ((NODE)->stmt.operand[2].systask = \ + (int)(VALUE)) +#define STMT_SYSTASK_USERTF(NODE) ((NODE)->stmt.operand[5].p_tf) +#define STMT_SYSTASK_WORKAREA(NODE) ((NODE)->stmt.operand[6].workArea) +#define STMT_SYSTASK_DELAYSCB(NODE) ((NODE)->stmt.operand[7].delaySCB) +#define STMT_SYSTASK_NEXT(NODE) ((NODE)->stmt.operand[8].nextInstance) + +/* DISABLE_STMT */ +#define STMT_DISABLE_NAME(NODE) ((NODE)->stmt.operand[0].exp) +#define STMT_DISABLE_EXPR(NODE) ((NODE)->stmt.operand[0].exp) +#define STMT_DISABLE_SCOPE(NODE) ((NODE)->stmt.operand[1].exp) + + +/* WAIT_STMT */ +#define STMT_WAIT_EXPR(NODE) ((NODE)->stmt.operand[1].exp) +#define STMT_WAIT_EXPR_CODE(NODE) ((NODE)->stmt.operand[2].exp_code) +#define STMT_WAIT_MARKER(NODE) ((NODE)->stmt.operand[3].marker) + +/* For event triggereing */ +#define STMT_EVENT_EXPR_LIST(NODE) ((NODE)->stmt.operand[1].exp) +#define STMT_EVENT_MARKER(NODE) ((NODE)->stmt.operand[2].marker) + +/* -> foo: NAME is used for trace, EVENT is used for exec; both are same + unless NAME is hierachical. */ +#define STMT_ARROW_NAME(NODE) ((NODE)->stmt.operand[0].exp) +#define STMT_ARROW_EVENT(NODE) ((NODE)->stmt.operand[1].exp) + +/* Undo ASSIGN and FORCE */ +#define STMT_DEASSIGN_LVAL(NODE) ((NODE)->stmt.operand[0].exp) + +/* Note: any changes here must also be reflected in assign and instance */ +struct tree_stmt { + char common[sizeof(struct tree_common)]; + char *filename; + lineno_t linenum; + union tree_node *scope; + union { + union tree_node *exp; + union tree_node **exp_code; + char *name; + struct Marker *marker; +// void *marker; + struct SCB *scb; +// void *scb; + Group *group; + int systask; + char *workArea; + struct SCB *delaySCB; +/* enum systask_type systask; /* system task type, if internal */ + p_tfcell p_tf; /* points to tf structure for pli tasks */ + union tree_node *nextInstance; + } operand[1]; +}; + +/* All assignments use all or part of this structure. Simple procedural + assignments use lval, rval, and rval code. Continuous assignments use + the whole structure. See tree.def for a full listing. */ + +#define STMT_ASSIGN_LVAL(NODE) ((NODE)->assign.lval) +#define STMT_ASSIGN_RVAL(NODE) ((NODE)->assign.rval) +#define STMT_ASSIGN_RVAL_CODE(NODE) ((NODE)->assign.rval_code) + +#define STMT_ASSIGN_EVENT_LIST(NODE) ((NODE)->assign.event_list) +#define STMT_ASSIGN_DELAY(NODE) ((NODE)->assign.delay) +#define STMT_ASSIGN_EVENT(NODE) ((NODE)->assign.delay) + +#define STMT_ASSIGN_TMP(NODE) ((NODE)->assign.tmp) +#define STMT_ASSIGN_TMPCODE(NODE) ((NODE)->assign.tmp_code) + +#define STMT_ASSIGN_SCB(NODE) ((NODE)->assign.scb) +/* If the following changes, change all calls to build_stmt(ASSIGN...) */ + +struct tree_assign { + char common[sizeof(struct tree_common)]; + char *filename; + lineno_t linenum; + union tree_node *scope; + union tree_node *lval; + union tree_node *rval; + union tree_node **rval_code; + struct Marker *event_list; +// void *event_list; + union tree_node *delay; /* used for cont assign and intra-asgn timing */ + union tree_node *tmp; /* saved rval for intra-asgn and non blk */ + union tree_node **tmp_code; + union tree_node *repeat_count; + struct SCB *scb; /* list of scbs in non blk event assigns */ +// void *scb; +}; + +/* This is a placeholder for module instantiations within a module. If + NAMED_PORT_ATTR is set, then TREE_VALUE of the port list points to + and IDENTIFIER_NODE that is the name of the port. */ + +#define INSTANCE_FILE(NODE) ((NODE)->instance.filename) +#define INSTANCE_LINE(NODE) ((NODE)->instance.linenum) +#define INSTANCE_NAME(NODE) ((NODE)->instance.name) +#define INSTANCE_MODULE_NAME(NODE) ((NODE)->instance.module_name) +#define INSTANCE_PORTS(NODE) ((NODE)->instance.ports) +#define INSTANCE_PARAMS(NODE) ((NODE)->instance.params) +#define INSTANCE_BLOCK(NODE) ((NODE)->instance.block) + +struct tree_instance { + char common[sizeof(struct tree_common)]; + char *filename; + lineno_t linenum; + union tree_node *scope; + union tree_node *name; /* name of the instance */ + union tree_node *module_name; /* name of the referenced module */ + union tree_node *ports; /* TREE_LIST of arguments */ + union tree_node *params; /* TREE_LIST or param overrides */ + union tree_node *block; /* Points to block after pass2 */ +}; + +/* Define the overall contents of a tree node. + It may be any of the structures declared above + for various types of node. */ + +union tree_node { + struct tree_common common; + struct tree_int_cst int_cst; + struct tree_real_cst real_cst; + struct tree_string string; + struct tree_identifier identifier; + struct tree_bit_cst bit_cst; + struct tree_list list; + struct tree_part part; + struct tree_concat concat; + struct tree_exp exp; + struct tree_func func; + struct tree_shift shift; + struct tree_stmt stmt; + struct tree_decl_common decl_common; + struct tree_decl_net decl_net; + struct tree_decl_array decl_array; + struct tree_decl_parameter decl_parameter; + struct tree_block_common block_common; + struct tree_block_module block_module; + struct tree_block_funct block_funct; + struct tree_instance instance; + struct tree_assign assign; + struct tree_path path; + struct tree_path_constraint path_constraint; + struct tree_timing_event timing_event; + struct tree_check_spec check_spec; + struct tree_timing_check timing_check; + struct tree_notifier notifier; + struct tree_gate_instance gate_instance; + struct tree_path_output path_output; + struct tree_udp_string udp_string; + struct tree_udp_table udp_table; + struct tree_path_instance path_instance; + struct tree_pli_delay pli_delay; +}; +char *linkalloc (long); + +/* Lowest level primitive for allocating a node. + The TREE_CODE is the only argument. Contents are initialized + to zero except for a few of the common fields. */ + +tree make_node(enum tree_code); + +/* Make a copy of a node, with all the same contents except + for TREE_UID and TREE_PERMANENT. (The copy is permanent + iff nodes being made now are permanent.) */ + +tree copy_node(tree); + +/* Return the (unique) IDENTIFIER_NODE node for a given name. + The name is supplied as a char *. */ + +tree get_identifier(char *); + +/* Construct various types of nodes. */ + +tree build(enum tree_code, enum tree_type, ...); +tree build_nt(enum tree_code, ...); +tree build_tree_list(tree, tree); +tree build_decl(enum tree_code, tree, enum tree_type); +tree build_string(int, char *); +tree build_array(tree, tree, tree, tree); +tree build_module(tree); +void end_module(tree); +tree build_task(tree); +tree build_function(tree); +tree build_stmt(enum tree_code, ...); +void add_cont_assign_list(tree); +tree build_cont_assign(tree, tree, lineno_t, tree, int); + +/* Construct expressions, performing type checking. */ + +tree build_binary_op(enum tree_code, tree, tree); +tree build_unary_op(enum tree_code, tree); +tree build_cond_expr(tree, tree, tree); + +tree build_int_cst(signed_32_t); +tree build_real_cst(char *); +tree build_bit_cst(nbits_t, enum radii); + +/* Concatenate two lists (chains of TREE_LIST nodes) X and Y + by making the last node in X point to Y. + Returns X, except if X is 0 returns Y. */ + +tree chainon(tree, tree); + +/* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN. */ + +tree tree_cons(tree, tree, tree); +tree perm_tree_cons(tree, tree, tree); +tree link_tree_cons(tree, tree, tree); +void free_link_list(tree); + +/* Reverse the order of elements in a chain, and return the new head. */ + +tree nreverse(tree); + + +/* Returns the length of a chain of nodes + (number of chain pointers to follow before reaching a null pointer). */ + +int list_length(tree); +int lvalue_or_else(); +int is_proc_lval(tree); +tree the_lval(tree); + +/* Declare commonly used variables for tree structure. */ + +/* Node to pass lsb/msb expressions during parse */ +extern tree range_handle; + +/* Points to a TREE_LIST of parsed modules (defined in parse.y) */ +extern tree module_list; + +/* Points to a chain of top level modules */ +extern tree top_level; + +/* List of all port connections */ +extern tree port_connections; + +/* List of all continuous assignments for initializing */ +extern tree continuous_assignments; + +/* An integer constant with value 0 */ +//extern tree integer_zero_node; + +/* An integer constant with value 1 */ +//extern tree integer_one_node; + +/* A single-bit constant 0 (1'b0) */ +//extern tree bit_zero_node; + +/* a single-bit constant 1 (1'b1) */ +//extern tree bit_one_node; + +/* A node of type ERROR_MARK. */ +extern tree error_mark_node; + +/* Points to the name of the input file from which the current input + being parsed originally came (before it went into cpp). */ +extern char *input_filename; + +/* Current source line number in that file. */ +extern lineno_t lineno; +extern lineno_t stmt_lineno; + +/* Points to the FUNCTION_DECL of the function whose body we are reading. */ + +extern tree current_function_decl; + + +void clear_temporary(); + +void concat_labels(tree); + +tree check_lval(tree, enum lval_type, tree); +tree check_lval_nocheck(tree, enum lval_type, tree); +tree check_lval_port(tree); +tree check_rval(tree); +tree check_rval_nocheck(tree); +tree check_block(tree); +tree check_task(tree); +tree check_function(tree); +tree check_reg(tree); +tree check_non_reg(tree); +tree check_net(tree); +tree check_port(tree); +tree check_named_event(tree); +tree build_bit_ref(tree, tree); +tree build_part_ref(tree, tree, tree); +tree build_function_call(tree, tree); +tree make_net_source(tree); + +tree implicit_conversion(tree, tree); + +tree double_check_block(tree); +tree double_check_named_event(tree); + +int is_net_code(enum tree_code); +int is_all_net(tree); +int is_array(tree); +int is_string(tree); +int is_var(tree, tree *); +int is_block(tree, tree *); +char *decl_type(tree); +char *ident_name(tree); +void init_tree(void); + +void switch_to_linkage_obstack(void); +void switch_to_permanent_obstack(void); +void start_identifier_warnings(void); +/* Set all of the values of a list of TREE_LIST nodes to the same value. */ + +void set_all_list_values(tree, tree); +void init_tree_1(void); + +// private methods + +#ifdef TREE_C +#endif // TREE_C + +#endif // TREE_H diff --git a/src/udp.cc b/src/udp.cc new file mode 100644 index 0000000..f8a3072 --- /dev/null +++ b/src/udp.cc @@ -0,0 +1,876 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + + +/******************************************************************* + * + * upd.c + * - procedures for parsing and executing upd's + * + ******************************************************************* + */ + +#define UDP_C + +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "runtime.h" +#include "udp.h" +#include "gates.h" +#include "schedule.h" +#include "eval.h" +#include "glue.h" +#include "copy.h" +#include "veriwell.h" +#include "nsched.h" + +extern lineno_t lineno; +extern char *input_filename; +extern tree current_module; + +int deltaTable[10][4][4]; +static int udp_inited = FALSE; + +/******************************************************************* + * + * build_udp + * - creates a udp tree structure + * + ******************************************************************* + */ +tree build_udp(tree identifier) +{ + tree t; + + ASSERT(udp_inited == TRUE); + t = build_module(identifier); + UDP_ATTR(t) = TRUE; + UDP_TABLE(t) = make_node(UDP_TABLE_NODE); + return (t); +} + + +/******************************************************************* + * + * build_udp_string + * - creates a udp string structure + * + ******************************************************************* + */ +tree build_udp_string(void) +{ + tree t; + + t = make_node(UDP_STRING_NODE); + UDP_STRING_STRING(t)[0] = 0; + UDP_STRING_LINE(t) = lineno; + UDP_STRING_FILE(t) = input_filename; + return (t); +} + +/******************************************************************* + * + * end_primitive + * - post process udp definition + * + ******************************************************************* + */ +void end_primitive(tree node) +{ + tree t; + tree t1; + char *name; + int numberOfTables; + int tableSize; + int i; + char *table; + tree udp_table; + int numberOfEntries; + + ASSERT(node != NULL_TREE); + ASSERT(TREE_CODE(node) == MODULE_BLOCK); + ASSERT(UDP_ATTR(node)); + ASSERT(UDP_STRING_LIST(node) != NULL_TREE); + + for (t = UDP_PORT_LIST(node); t; t = TREE_CHAIN(t)) { + ASSERT(TREE_CODE(t) == TREE_LIST); + t1 = TREE_PURPOSE(t); + ASSERT(t1 != NULL_TREE); + /* port must be defined and an identifier node */ + /* first port must be an output, rest inputs */ + + name = IDENT(DECL_NAME(t1)); + if (TREE_CODE(t1) != NET_SCALAR_DECL) { + error("Port '%s' is not defined as a scalar net", name, + NULL_CHAR); + return; + } else if (t == MODULE_PORT_LIST(node) && + (!PORT_OUTPUT_ATTR(t1) || PORT_INPUT_ATTR(t1))) { + error("Port '%s' not declared as OUTPUT", name, NULL_CHAR); + return; + } else if (t != MODULE_PORT_LIST(node) && + (PORT_OUTPUT_ATTR(t1) || !PORT_INPUT_ATTR(t1))) { + error("Port '%s' not declared as INPUT", name, NULL_CHAR); + return; + } + } + if ((UDP_REG_NAME(node) == NULL_TREE && + list_length(UDP_PORT_LIST(node)) > 11) || + (UDP_REG_NAME(node) != NULL_TREE && + list_length(UDP_PORT_LIST(node)) > 10)) { + error("too many ports for udp primitive '%s'", + UDP_NAME(node), NULL_CHAR); + return; + } + + /* build state tables */ + + if (UDP_REG_NAME(node) == NULL_TREE) { + numberOfTables = list_length(UDP_PORT_LIST(node)) - 1; + numberOfEntries = numberOfTables; + } else { + numberOfTables = list_length(UDP_PORT_LIST(node)) - 1; + numberOfEntries = numberOfTables + 1; + } + + + ASSERT(numberOfTables <= 10); + ASSERT(numberOfEntries <= 10); + + tableSize = int_power(3, numberOfEntries); + udp_table = UDP_TABLE(node); + ASSERT(udp_table != NULL_TREE); + ASSERT(TREE_CODE(udp_table) == UDP_TABLE_NODE); + + for (i = 0; i < numberOfTables; i++) { + table = xmalloc(tableSize); + + UDP_TABLE_ARRAY(udp_table, i) = table; + memset(table, 0xff, tableSize); + fill_udp_table(table, i, numberOfEntries, UDP_STRING_LIST(node), + UDP_REG_NAME(node) != NULL_TREE); + } +} + + +/******************************************************************* + * + * instantiate_udp + * - creates an instance of a udp gate + * + ******************************************************************* + */ +void instantiate_udp(tree module, tree caller, tree udp_def) +{ + tree gate; + tree t; + tree delay; + tree delay1; + tree delay2; + tree delay3; + int label; + + + ASSERT(caller != NULL_TREE); + ASSERT(TREE_CODE(caller) == INSTANCE_NODE); + ASSERT(udp_def != NULL_TREE); + ASSERT(TREE_CODE(udp_def) == MODULE_BLOCK); + ASSERT(UDP_ATTR(udp_def)); + + t = INSTANCE_PARAMS(caller); + if (t != NULL_TREE) { + ASSERT(TREE_CODE(t) == TREE_LIST); + delay1 = TREE_PURPOSE(t); + delay2 = delay1; + delay3 = NULL_TREE; + t = TREE_CHAIN(t); + label = 1; + if (t) { + ASSERT(TREE_CODE(t) == TREE_LIST); + delay2 = TREE_PURPOSE(t); + t = TREE_CHAIN(t); + label = 2; + } + if (t) { + ASSERT(TREE_CODE(t) == TREE_LIST); + delay3 = TREE_PURPOSE(t); + t = TREE_CHAIN(t); + label = 3; + } + delay = build_nt(DELAY_EXPR, delay1, delay2, delay3); + TREE_LABEL(delay) = label; + } else { + delay = NULL_TREE; + } + + gate = build_gate_instance(GATE_UDP_TYPE, INSTANCE_FILE(caller), + INSTANCE_LINE(caller), + INSTANCE_NAME(caller), + copy_tree_with_stuff(INSTANCE_PORTS(caller), + NULL_TREE), delay, + udp_def); + + BLOCK_BODY(module) = chainon(gate, BLOCK_BODY(module)); +// MODULE_INSTANCES(module) = chainon( gate, +// MODULE_INSTANCES(module) ); +} + +/******************************************************************* + * + * append_udp_digits + * - append 2 digits to udp string. allocate new node if needed + * + ******************************************************************* + */ +void append_udp_digits(tree * ptr, char c1, char c2) +{ + tree t; + int length; + + if (*ptr == NULL_TREE) { + *ptr = build_udp_string(); + } + t = *ptr; + /* note the size of the string must be at least one position + greater than the maximum allowable size. This fact will be + used to do later error checking */ + + length = strlen(UDP_STRING_STRING(t)); + if (length >= sizeof(UDP_STRING_STRING(t)) + 2) { + return; + } + + UDP_STRING_STRING(t)[length++] = c1; + UDP_STRING_STRING(t)[length++] = c2; +} + +/******************************************************************* + * + * validate_udp_string + * - validate the contents of the udp string. + * prune out colons. + * + ******************************************************************* + */ +void validate_udp_string(tree udp, tree udp_string) +{ + int combFlag; + int numberOfPorts; + int length; + int i; + int edgeCount; + char *ptr; + + ASSERT(udp != NULL_TREE); + ASSERT(TREE_CODE(udp) == MODULE_BLOCK); + ASSERT(UDP_ATTR(udp)); + ASSERT(udp_string != NULL_TREE); + ASSERT(TREE_CODE(udp_string) == UDP_STRING_NODE); + + ptr = UDP_STRING_STRING(udp_string); + combFlag = (UDP_REG_NAME(udp) == NULL_TREE); + numberOfPorts = list_length(UDP_PORT_LIST(udp)); + length = strlen(ptr); + + if ((combFlag && (numberOfPorts + 1) * 2 != length) || + (!combFlag && (numberOfPorts + 3) * 2 != length)) { + error("Bad table entry", NULL_CHAR, NULL_CHAR); + return; + } + if (combFlag) { + if (ptr[(numberOfPorts - 1) * 2] != ':' || + ptr[(numberOfPorts - 1) * 2 + 1] != ':') { + error("Missing ':' in table entry", NULL_CHAR, NULL_CHAR); + return; + } + memmove(&ptr[(numberOfPorts - 1) * 2], &ptr[numberOfPorts * 2], 3); + } else { + if (ptr[(numberOfPorts - 1) * 2] != ':' || + ptr[(numberOfPorts - 1) * 2 + 1] != ':' || + ptr[(numberOfPorts + 1) * 2] != ':' || + ptr[(numberOfPorts + 1) * 2 + 1] != ':') { + error("Missing ':' in table entry", NULL_CHAR, NULL_CHAR); + return; + } + memmove(&ptr[(numberOfPorts - 1) * 2], &ptr[(numberOfPorts) * 2], + 2); + memmove(&ptr[(numberOfPorts) * 2], &ptr[(numberOfPorts + 2) * 2], + 3); + } + + /* validate number of edges */ + + edgeCount = 0; + length = strlen(ptr); + for (i = 0; i < length; i += 2) { + if (is_edge(&ptr[i])) { + edgeCount++; + } + } + if (combFlag && edgeCount != 0) { + error("Edge specifications are not allowed in sequential upd's", + NULL_CHAR, NULL_CHAR); + return; + } else if (!combFlag && edgeCount > 1) { + error("Only one edge specification is allowed per table entry", + NULL_CHAR, NULL_CHAR); + return; + } + + /* validate inputs */ + for (i = 0; i < (numberOfPorts - 1) * 2; i += 2) { + if (!is_valid_input(&ptr[i], combFlag)) { + error("illegal character in input portion of table", + NULL_CHAR, NULL_CHAR); + return; + } + } + + /* validate previous output for seq. udp */ + + if (!combFlag && !is_valid_input(&ptr[length - 4], TRUE)) { + error("illegal character in current value portion of table", + NULL_CHAR, NULL_CHAR); + return; + } + + /* validate output */ + + if (!is_valid_output(&ptr[length - 2], combFlag)) { + error("illegal character in output portion of table", + NULL_CHAR, NULL_CHAR); + return; + } + + +} + +/******************************************************************* + * + * is_edge + * - returns TRUE if two bytes represent and edge + * + ******************************************************************* + */ +int is_edge(char *ptr) +{ + if (ptr[0] != ptr[1]) { + return (TRUE); + } + switch (*ptr) { + case '*': + case 'r': + case 'f': + case 'p': + case 'n': + return (TRUE); + } + return (FALSE); +} + +/******************************************************************* + * + * is_valid_input + * - returns TRUE if two bytes represent valid input + * + ******************************************************************* + */ +int is_valid_input(char *ptr, int combFlag) +{ + if (combFlag && is_edge(ptr)) { + return (FALSE); + } + if (*ptr == '-') { + return (FALSE); + } + return (TRUE); +} + +/******************************************************************* + * + * is_valid_output + * - returns TRUE if two bytes represent valid output + * + ******************************************************************* + */ +int is_valid_output(char *ptr, int combFlag) +{ + if (is_edge(ptr)) { + return (FALSE); + } + if (combFlag && *ptr == '-') { + return (FALSE); + } + return (TRUE); +} + +/******************************************************************* + * + * fill_udp_table + * - converts string list to execution table for input i + * + ******************************************************************* + */ +void +fill_udp_table(char *table, int inputNumber, int inputCount, + tree string_list, int seqFlag) +{ + tree t; + int position; + int i; + int tableSize; + char *save_input_filename; + int save_lineno; + int report_error; + char *string; + + + ASSERT(table != NULL); + ASSERT(inputCount < 11 && inputCount > 0); + ASSERT(inputNumber < inputCount && inputNumber >= 0); + ASSERT(string_list != NULL); + + + /* do level pass first */ + + for (t = string_list; t; t = TREE_CHAIN(t)) { + ASSERT(TREE_CODE(t) == UDP_STRING_NODE); + string = UDP_STRING_STRING(t); + if (!is_edge_string(t, &position)) { + save_input_filename = input_filename; + save_lineno = lineno; + runtime_error(t); + report_error = (inputNumber == 0); + set_udp_table_entry(table, int_power(3, inputCount - 1), 0, + NULL, string, &string[2], 0xff, + &report_error); + input_filename = save_input_filename; + lineno = save_lineno; + } + } + + /* do edge pass next */ + + for (t = string_list; t; t = TREE_CHAIN(t)) { + ASSERT(TREE_CODE(t) == UDP_STRING_NODE); + string = UDP_STRING_STRING(t); + if (is_edge_string(t, &position) && position == inputNumber) { + save_input_filename = input_filename; + save_lineno = lineno; + runtime_error(t); + report_error = TRUE; + switch (string[inputNumber * 2]) { + case '0': + set_udp_table_entry(table, int_power(3, inputCount - 1), 0, + NULL, string, &string[2], 0x03, + &report_error); + break; + case '1': + set_udp_table_entry(table, int_power(3, inputCount - 1), 0, + NULL, string, &string[2], 0x0c, + &report_error); + break; + case 'x': + set_udp_table_entry(table, int_power(3, inputCount - 1), 0, + NULL, string, &string[2], 0x30, + &report_error); + break; + case '!': + case '?': + case '*': + set_udp_table_entry(table, int_power(3, inputCount - 1), 0, + NULL, string, &string[2], 0x3f, + &report_error); + break; + case '%': + case 'b': + set_udp_table_entry(table, int_power(3, inputCount - 1), 0, + NULL, string, &string[2], 0x0f, + &report_error); + break; + case 'r': + set_udp_table_entry(table, int_power(3, inputCount - 1), 0, + NULL, string, &string[2], 0x03, + &report_error); + break; + case 'f': + set_udp_table_entry(table, int_power(3, inputCount - 1), 0, + NULL, string, &string[2], 0x0c, + &report_error); + break; + case 'p': + set_udp_table_entry(table, int_power(3, inputCount - 1), 0, + NULL, string, &string[2], 0x33, + &report_error); + break; + case 'n': + set_udp_table_entry(table, int_power(3, inputCount - 1), 0, + NULL, string, &string[2], 0x3c, + &report_error); + break; + default: + ASSERT(FALSE); + } + input_filename = save_input_filename; + lineno = save_lineno; + + } + } + + /* x out uninitialized areas */ + + tableSize = int_power(3, inputCount); + for (i = 0; i < tableSize; i++) { + int temp; + + temp = table[i]; + temp = 0x15 & (~temp) & (temp >> 1); + table[i] ^= temp; + } + + +} + +/******************************************************************* + * + * set_udp_table_entry + * - recursive function to set a udp table entry + * + ******************************************************************* + */ +void +set_udp_table_entry(char *table, int position, int state, char *last, + char *next, char *rest, int from_mask, int *reportFlag) +{ + char c; + int from; + int temp; + + + /* check for termination condition */ + + if (rest[0] == 0) { + if (next[0] == '-') { + c = last[0]; + } else { + c = next[0]; + } + switch (c) { + case '0': + from = 0x00; + break; + case '1': + from = 0x15; + break; + case 'x': + from = 0x2a; + break; + default: + ASSERT(FALSE); + } + if ((from_mask & table[state]) != from_mask) { + temp = table[state] & from_mask; + temp = temp & (temp << 1); + temp = temp | (temp >> 1); + temp = temp ^ from_mask; + if (*reportFlag && ((table[state] ^ from) & temp) == 0) { +// warning( "table entry overlap previous entry", NULL_CHAR, NULL_CHAR ); + } else if (*reportFlag) { + if (from_mask == 0xff) { // level<->level conflict + error("level vs level table entry conflict", NULL_CHAR, + NULL_CHAR); + *reportFlag = FALSE; + } else { // edge sensitive entry + if ((table[state] & 0xc0) == 0) { // edge<->level conflict +// I commented this out because I believe this is a common occurance +// warning( "level vs edge table entry conflict", NULL_CHAR, NULL_CHAR ); + } else { // edge<->edge conflict + error("edge vs edge table entry conflict", + NULL_CHAR, NULL_CHAR); + *reportFlag = FALSE; + } + } + } + } else { + table[state] = + (table[state] & ~from_mask) | (from & from_mask); + } + return; + } + + + switch (next[1]) { + case '0': + case 'f': + state = state / 3; + set_udp_table_entry(table, position, state, next, rest, rest + 2, + from_mask, reportFlag); + break; + case '1': + case 'r': + state = state / 3 + position; + set_udp_table_entry(table, position, state, next, rest, rest + 2, + from_mask, reportFlag); + break; + case 'x': + state = state / 3 + 2 * position; + set_udp_table_entry(table, position, state, next, rest, rest + 2, + from_mask, reportFlag); + break; + case 'b': + set_udp_table_entry(table, position, state, last, "00", rest, + from_mask, reportFlag); + set_udp_table_entry(table, position, state, last, "11", rest, + from_mask, reportFlag); + break; + case '?': + case '*': + set_udp_table_entry(table, position, state, last, "00", rest, + from_mask, reportFlag); + set_udp_table_entry(table, position, state, last, "11", rest, + from_mask, reportFlag); + set_udp_table_entry(table, position, state, last, "xx", rest, + from_mask, reportFlag); + break; + case 'p': + set_udp_table_entry(table, position, state, last, "xx", rest, + from_mask, reportFlag); + set_udp_table_entry(table, position, state, last, "11", rest, + from_mask, reportFlag); + break; + case 'n': + set_udp_table_entry(table, position, state, last, "xx", rest, + from_mask, reportFlag); + set_udp_table_entry(table, position, state, last, "00", rest, + from_mask, reportFlag); + break; + case '-': // only an error case can take us here - just return + return; + default: + ASSERT(FALSE); + } +} + + +/******************************************************************* + * + * is_edge_string + * - returns TRUE if UDP_STRING is an edge specification + * + ******************************************************************* + */ + +int is_edge_string(tree t, int *inputNumber) +{ + char *ptr; + int count; + + ASSERT(t != NULL_TREE); + ASSERT(TREE_CODE(t) == UDP_STRING_NODE); + count = 0; + for (ptr = UDP_STRING_STRING(t); *ptr; ptr += 2) { + if (is_edge(ptr)) { + *inputNumber = count; + return (TRUE); + } + count++; + } + + return (FALSE); +} + +/******************************************************************* + * + * int_power + * - returns 'b' raised to the 'p' power + * + ******************************************************************* + */ +int int_power(int b, int p) +{ + int i; + int result; + + result = 1; + for (i = 0; i < p; i++) { + result *= b; + } + return (result); +} + +/******************************************************************* + * + * udp_exec + * - execute a udp gate + * + ******************************************************************* + */ +void udp_exec(struct Marker *marker) +{ + tree gate = (tree) marker->scb; + tree arg; + enum logical_value in_new, in_old, out_new, out_old; + char *table; + tree udp_def; + tree udp_table; + int arg_number; + int state; + nbits_t nbit; + + ASSERT(marker != NULL); + ASSERT(gate != NULL); + udp_def = GATE_UDP_DEF(gate); + ASSERT(udp_def); + ASSERT(TREE_CODE(udp_def) == MODULE_BLOCK); + ASSERT(UDP_ATTR(udp_def)); + udp_table = UDP_TABLE(udp_def); + ASSERT(udp_table != NULL_TREE); + ASSERT(TREE_CODE(udp_table) == UDP_TABLE_NODE); + + + +/* This is the arg expression, code, and last value */ + + arg = marker->expr.arg; + ASSERT(arg != NULL_TREE); + +/* save old input and output values */ + + in_old = GATE_IN(arg); + out_old = GATE_OUTPUT(gate); + arg_number = GATE_INPUT_NUMBER(arg); + ASSERT(arg_number >= 0); + ASSERT(UDP_REG_NAME(udp_def) != NULL_TREE + || arg_number < GATE_INPUTS(gate)); + ASSERT(UDP_REG_NAME(udp_def) == NULL_TREE + || arg_number < GATE_INPUTS(gate) + 1); + table = UDP_TABLE_ARRAY(udp_table, arg_number); + ASSERT(table != NULL); + +/* First, evaluate the active input, if necessary. If the following is + true, then decl is the only argument and no need + reevaluate arg expression. If is isn't true, then decl is only + one component of the argument expression, so arg needs to be + evaluated. +*/ + + if (marker->flags & M_PRIM_FAST) { + in_new = DECL_STATE(marker->decl); /* Value is xfer'd in marker */ + } else { + Group *g = eval_(TREE_EXPR_CODE(arg), &nbit); /* need to re-eval */ + in_new = VAL_TO_STATE(g); + } + if (in_new == Z) { // Z should always be treated as X + in_new = X; + } + + if (in_old == in_new) /* if input didn't change, */ + return; /* ...return. */ + + SET_GATE_IN(arg, in_new); /* Input changed; remember */ + + /* calculate new state value */ + + state = GATE_STATE(gate); + state += deltaTable[arg_number][in_old][in_new]; + GATE_STATE(gate) = state; + + /* calculate new output value */ + + switch (in_old) { + case ZERO: + out_new = (enum logical_value) (table[state] & 0x3); + break; + case ONE: + out_new = (enum logical_value) ((table[state] >> 2) & 0x3); + break; + case X: + out_new = (enum logical_value) ((table[state] >> 4) & 0x3); + break; + case Z: + default: + ASSERT(FALSE); + } + + /* seq. udps require the output value to be written into the state vector */ + + if (out_new != out_old) { + delay_t delay; + + /* seq. udps require the output value to be written into the state vector */ + + if (UDP_REG_NAME(udp_def) != NULL_TREE) { + state += deltaTable[GATE_INPUTS(gate)][out_old][out_new]; + GATE_STATE(gate) = state; + } + + GATE_OUTPUT(gate) = out_new; + if (GATE_DELAY(gate) && !in_initial) { + delay = eval_delay(GATE_DELAY(gate), GATE_OUTPUT(gate)); + } else { + delay = 0; + } + + ScheduleGate(gate, delay); + } +} + +/******************************************************************* + * + * init_udp + * - initialize udp structures + * + ******************************************************************* + */ +void init_udp(void) +{ + + int i; + int new_t; + int old; + int arg_new; + int arg_old; + + udp_inited = TRUE; + +/* load delta table */ + + for (i = 0; i < 10; i++) { + for (new_t = 0; new_t < 4; new_t++) { + if (new_t == 3) { + arg_new = 2; + } else { + arg_new = new_t; + } + for (old = 0; old < 4; old++) { + if (old == 3) { + arg_old = 2; + } else { + arg_old = old; + } + deltaTable[i][old][new_t] = + (arg_new * int_power(3, i)) - + (arg_old * int_power(3, i)); + } + } + } + +} diff --git a/src/udp.h b/src/udp.h new file mode 100644 index 0000000..ff03a3b --- /dev/null +++ b/src/udp.h @@ -0,0 +1,58 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/******************************************************************* + * + * udp.h + * - header file for udp.c + * + ******************************************************************* + */ + + +#ifndef UDP_H +#define UDP_H + +extern int deltaTable[10][4][4]; + +tree build_udp(tree identifier); +tree build_udp_string(void); +void end_primitive(tree node); +void append_udp_digits(tree * node, char c1, char c2); +void validate_udp_string(tree udp, tree udp_string); +int is_edge(char *ptr); +int is_valid_output(char *ptr, int combFlag); +int is_valid_input(char *ptr, int combFlag); +void set_udp_table_entry(char *table, int positin, int state, char *last, + char *next, char *rest, int from_mask, + int *reportFlag); +void fill_udp_table(char *table, int inputNumber, int inputCount, + tree string_list, int seqFlag); +int is_edge_string(tree t, int *position); +int int_power(int b, int p); +void instantiate_udp(tree module, tree caller, tree udp_def); +void udp_exec(struct Marker *marker); +void init_udp(void); + +// private methods + +#ifdef UDP_C +#endif // UDP_C + +#endif // UDP_H diff --git a/src/usertask.cc b/src/usertask.cc new file mode 100644 index 0000000..df861ff --- /dev/null +++ b/src/usertask.cc @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/********************************************************** + * + * usertask.c + * manage user tasks + * + ********************************************************** + */ + +#include +#include "usertask.h" +#include "vtypes.h" + +/* + * existing compiled in list of user tasks + */ +extern s_tfcell veriusertfs[]; + +/********************************************** + Usertask_Init + - initialize usertask module. pass in + command line arguments to be parsed. + **********************************************/ +void Usertask_Init(int argc, char *argv[]) +{ +} + +/********************************************** + Usertask_Lookup + - Lookup user task/function name. Return + task data structure. Return 0 if task/function + is not found. + **********************************************/ +p_tfcell Usertask_Lookup(char *name) +{ + int i; + + for (i = 0; veriusertfs[i].type; i++) { + if (!strcmp(name, veriusertfs[i].tfname)) { + return &veriusertfs[i]; + } + } + return 0; +} diff --git a/src/usertask.h b/src/usertask.h new file mode 100644 index 0000000..ef6a167 --- /dev/null +++ b/src/usertask.h @@ -0,0 +1,36 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/********************************************************** + * + * usertask.h + * manage user tasks + * + ********************************************************** + */ + +#ifndef USERTASK_H +#define USERTASK_H + +#include "veriuser.h" + +void Usertask_Init(int argc, char *argv[]); +p_tfcell Usertask_Lookup(char *name); + +#endif /* USERTASK_H */ diff --git a/src/v.gpe b/src/v.gpe new file mode 100644 index 0000000..e8addbc --- /dev/null +++ b/src/v.gpe @@ -0,0 +1,137 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ +struct keywords { char *name; short kval; short type;}; + +%% +# Statements +module, MODULE, NO_TYPE +macromodule, MACROMODULE, NO_TYPE +endmodule, ENDMODULE, NO_TYPE +specify, SPECIFY, NO_TYPE +endspecify, ENDSPECIFY, NO_TYPE +primitive, PRIMITIVE, NO_TYPE +endprimitive, ENDPRIMITIVE, NO_TYPE +assign, ASSIGN, NO_TYPE +table, TABLE, NO_TYPE +endtable, ENDTABLE, NO_TYPE +task, TASK, NO_TYPE +endtask, ENDTASK, NO_TYPE +function, FUNCTION, NO_TYPE +endfunction, ENDFUNCTION, NO_TYPE +parameter, PARAMETER, NO_TYPE +input, INPUT, NO_TYPE +output, OUTPUT, NO_TYPE +inout, INOUT, NO_TYPE +scalared, SCALARED, NO_TYPE +vectored, VECTORED, NO_TYPE +reg, REG, NO_TYPE +time, TIME, NO_TYPE +integer, INTEGER, NO_TYPE +real, REAL, NO_TYPE +event, EVENT, NO_TYPE +defparam, DEFPARAM, NO_TYPE +initial, INITIAL, NO_TYPE +always, ALWAYS, NO_TYPE +if, IF, NO_TYPE +else, ELSE, NO_TYPE +case, CASE, NO_TYPE +casez, CASEZ, NO_TYPE +casex, CASEX, NO_TYPE +endcase, ENDCASE, NO_TYPE +forever, FOREVER, NO_TYPE +repeat, REPEAT, NO_TYPE +while, WHILE, NO_TYPE +for, FOR, NO_TYPE +wait, WAIT_, NO_TYPE +disable, DISABLE, NO_TYPE +deassign, DEASSIGN, NO_TYPE +force, FORCE, NO_TYPE +release, RELEASE, NO_TYPE +default, DEFAULT, NO_TYPE +begin, BEGIN, NO_TYPE +end, END, NO_TYPE +fork, FORK, NO_TYPE +join, JOIN, NO_TYPE +posedge, POSEDGE, NO_TYPE +negedge, NEGEDGE, NO_TYPE +or, OR, NO_TYPE +small, SMALL, NO_TYPE +medium, MEDIUM, NO_TYPE +# Gate Types +and, LOGIC, GATE_AND_TYPE +nand, LOGIC, GATE_NAND_TYPE +nor, LOGIC, GATE_NOR_TYPE +#or, LOGIC, GATE_OR_TYPE +xor, LOGIC, GATE_XOR_TYPE +xnor, LOGIC, GATE_XNOR_TYPE +buf, BUFFER, GATE_BUF_TYPE +not, BUFFER, GATE_NOT_TYPE +bufif0, BUFIF, GATE_BUFIF0_TYPE +bufif1, BUFIF, GATE_BUFIF1_TYPE +notif0, BUFIF, GATE_NOTIF0_TYPE +notif1, BUFIF, GATE_NOTIF1_TYPE +nmos, BUFIF, GATE_NMOS_TYPE +pmos, BUFIF, GATE_PMOS_TYPE +rnmos, BUFIF, GATE_RNMOS_TYPE +rpmos, BUFIF, GATE_RPMOS_TYPE +cmos, CMOS, GATE_CMOS_TYPE +rcmos, CMOS, GATE_RCMOS_TYPE +pullup, PULL, GATE_PULLUP_TYPE +pulldown, PULL, GATE_PULLDN_TYPE +tran, TRAN, GATE_TRAN_TYPE +tranif0, BUFIF, GATE_TRANIF0_TYPE +tranif1, BUFIF, GATE_TRANIF1_TYPE +rtran, TRAN, GATE_RTRAN_TYPE +rtranif0, BUFIF, GATE_RTRANIF0_TYPE +rtranif1, BUFIF, GATE_RTRANIF1_TYPE +# +# Net Types +wire, NETTYPE, NET_WIRE_TYPE +tri, NETTYPE, NET_TRI_TYPE +wand, NETTYPE, NET_WAND_TYPE +triand, NETTYPE, NET_TRIAND_TYPE +wor, NETTYPE, NET_WOR_TYPE +trior, NETTYPE, NET_TRIOR_TYPE +tri1, NETTYPE, NET_TRI1_TYPE +tri0, NETTYPE, NET_TRI0_TYPE +supply1, SUPPLY1, NET_SUPPLY1_TYPE +supply0, SUPPLY0, NET_SUPPLY0_TYPE +trireg, TRIREG, NET_TRIREG_TYPE +# +# signal strengths +#supply0, STRENGTH0, STRENGTH_SUPPLY0_TYPE +strong0, STRENGTH0, STRENGTH_STRONG0_TYPE +pull0, STRENGTH0, STRENGTH_PULL0_TYPE +weak0, STRENGTH0, STRENGTH_WEAK0_TYPE +highz0, STRENGTH0, STRENGTH_HIGHZ0_TYPE +#supply1, STRENGTH1, STRENGTH_SUPPLY1_TYPE +strong1, STRENGTH1, STRENGTH_STRONG1_TYPE +pull1, STRENGTH1, STRENGTH_PULL1_TYPE +weak1, STRENGTH1, STRENGTH_WEAK1_TYPE +highz1, STRENGTH1, STRENGTH_HIGHZ1_TYPE +specparam, SPECPARAM, NO_TYPE +edge, EDGE, NO_TYPE +$setup, SETUP, NO_TYPE +$hold, HOLD, NO_TYPE +$period, PERIOD, NO_TYPE +$width, WIDTH, NO_TYPE +$skew, SKEW, NO_TYPE +$recovery, RECOVERY, NO_TYPE +$setuphold, SETUPHOLD, NO_TYPE +$nochange, NOCHANGE, NO_TYPE diff --git a/src/v.h b/src/v.h new file mode 100644 index 0000000..abdc953 --- /dev/null +++ b/src/v.h @@ -0,0 +1,356 @@ +/* C++ code produced by gperf version 3.0.1 */ +/* Command-line: gperf -L C++ -a -p -j1 -i 1 -g -o -t -N is_reserved_word v.gpe */ +/* Computed positions: -k'1-3,$' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to ." +#endif + +#line 19 "v.gpe" +struct keywords { + char *name; + short kval; + short type; +}; + +#define TOTAL_KEYWORDS 107 +#define MIN_WORD_LENGTH 2 +#define MAX_WORD_LENGTH 12 +#define MIN_HASH_VALUE 7 +#define MAX_HASH_VALUE 170 +/* maximum key range = 164, duplicates = 0 */ + +class Perfect_Hash { + private: + static inline unsigned int hash(const char *str, unsigned int len); + public: + static struct keywords *is_reserved_word(const char *str, + unsigned int len); +}; + +inline unsigned int + Perfect_Hash::hash(register const char *str, register unsigned int len) +{ + static unsigned char asso_values[] = { + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 82, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 65, 57, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 37, 9, 44, + 1, 1, 36, 77, 14, 8, 5, 21, 47, 9, + 1, 17, 20, 171, 1, 11, 2, 5, 11, 45, + 18, 24, 2, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171 + }; + register int hval = len; + + switch (hval) { + default: + hval += asso_values[(unsigned char) str[2]]; + /*FALLTHROUGH*/ case 2: + hval += asso_values[(unsigned char) str[1]]; + /*FALLTHROUGH*/ case 1: + hval += asso_values[(unsigned char) str[0]]; + break; + } + return hval + asso_values[(unsigned char) str[len - 1]]; +} + +struct keywords *Perfect_Hash::is_reserved_word(register const char *str, + register unsigned int len) +{ + static struct keywords wordlist[] = { + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 68 "v.gpe" + {"end", END, NO_TYPE}, + {""}, {""}, +#line 100 "v.gpe" + {"rtran", TRAN, GATE_RTRAN_TYPE}, +#line 56 "v.gpe" + {"endcase", ENDCASE, NO_TYPE}, +#line 32 "v.gpe" + {"endtable", ENDTABLE, NO_TYPE}, +#line 25 "v.gpe" + {"endmodule", ENDMODULE, NO_TYPE}, + {""}, +#line 36 "v.gpe" + {"endfunction", ENDFUNCTION, NO_TYPE}, +#line 29 "v.gpe" + {"endprimitive", ENDPRIMITIVE, NO_TYPE}, +#line 110 "v.gpe" + {"trior", NETTYPE, NET_TRIOR_TYPE}, +#line 108 "v.gpe" + {"triand", NETTYPE, NET_TRIAND_TYPE}, +#line 45 "v.gpe" + {"integer", INTEGER, NO_TYPE}, +#line 47 "v.gpe" + {"event", EVENT, NO_TYPE}, +#line 73 "v.gpe" + {"or", OR, NO_TYPE}, +#line 106 "v.gpe" + {"tri", NETTYPE, NET_TRI_TYPE}, +#line 79 "v.gpe" + {"nor", LOGIC, GATE_NOR_TYPE}, +#line 44 "v.gpe" + {"time", TIME, NO_TYPE}, +#line 84 "v.gpe" + {"not", BUFFER, GATE_NOT_TYPE}, +#line 75 "v.gpe" + {"medium", MEDIUM, NO_TYPE}, +#line 91 "v.gpe" + {"rnmos", BUFIF, GATE_RNMOS_TYPE}, +#line 62 "v.gpe" + {"disable", DISABLE, NO_TYPE}, + {""}, +#line 58 "v.gpe" + {"repeat", REPEAT, NO_TYPE}, +#line 34 "v.gpe" + {"endtask", ENDTASK, NO_TYPE}, +#line 39 "v.gpe" + {"output", OUTPUT, NO_TYPE}, +#line 40 "v.gpe" + {"inout", INOUT, NO_TYPE}, +#line 23 "v.gpe" + {"module", MODULE, NO_TYPE}, +#line 70 "v.gpe" + {"join", JOIN, NO_TYPE}, +#line 38 "v.gpe" + {"input", INPUT, NO_TYPE}, +#line 27 "v.gpe" + {"endspecify", ENDSPECIFY, NO_TYPE}, + {""}, +#line 28 "v.gpe" + {"primitive", PRIMITIVE, NO_TYPE}, +#line 81 "v.gpe" + {"xor", LOGIC, GATE_XOR_TYPE}, +#line 82 "v.gpe" + {"xnor", LOGIC, GATE_XNOR_TYPE}, +#line 89 "v.gpe" + {"nmos", BUFIF, GATE_NMOS_TYPE}, +#line 77 "v.gpe" + {"and", LOGIC, GATE_AND_TYPE}, +#line 78 "v.gpe" + {"nand", LOGIC, GATE_NAND_TYPE}, +#line 97 "v.gpe" + {"tran", TRAN, GATE_TRAN_TYPE}, +#line 92 "v.gpe" + {"rpmos", BUFIF, GATE_RPMOS_TYPE}, +#line 66 "v.gpe" + {"default", DEFAULT, NO_TYPE}, +#line 63 "v.gpe" + {"deassign", DEASSIGN, NO_TYPE}, + {""}, +#line 128 "v.gpe" + {"specparam", SPECPARAM, NO_TYPE}, +#line 35 "v.gpe" + {"function", FUNCTION, NO_TYPE}, + {""}, {""}, +#line 31 "v.gpe" + {"table", TABLE, NO_TYPE}, +#line 48 "v.gpe" + {"defparam", DEFPARAM, NO_TYPE}, +#line 71 "v.gpe" + {"posedge", POSEDGE, NO_TYPE}, +#line 65 "v.gpe" + {"release", RELEASE, NO_TYPE}, +#line 60 "v.gpe" + {"for", FOR, NO_TYPE}, +#line 105 "v.gpe" + {"wire", NETTYPE, NET_WIRE_TYPE}, +#line 64 "v.gpe" + {"force", FORCE, NO_TYPE}, +#line 90 "v.gpe" + {"pmos", BUFIF, GATE_PMOS_TYPE}, +#line 57 "v.gpe" + {"forever", FOREVER, NO_TYPE}, +#line 26 "v.gpe" + {"specify", SPECIFY, NO_TYPE}, +#line 52 "v.gpe" + {"else", ELSE, NO_TYPE}, +#line 42 "v.gpe" + {"vectored", VECTORED, NO_TYPE}, +#line 30 "v.gpe" + {"assign", ASSIGN, NO_TYPE}, +#line 109 "v.gpe" + {"wor", NETTYPE, NET_WOR_TYPE}, +#line 37 "v.gpe" + {"parameter", PARAMETER, NO_TYPE}, +#line 102 "v.gpe" + {"rtranif1", BUFIF, GATE_RTRANIF1_TYPE}, +#line 94 "v.gpe" + {"rcmos", CMOS, GATE_RCMOS_TYPE}, +#line 49 "v.gpe" + {"initial", INITIAL, NO_TYPE}, +#line 111 "v.gpe" + {"tri1", NETTYPE, NET_TRI1_TYPE}, +#line 59 "v.gpe" + {"while", WHILE, NO_TYPE}, + {""}, +#line 33 "v.gpe" + {"task", TASK, NO_TYPE}, + {""}, +#line 101 "v.gpe" + {"rtranif0", BUFIF, GATE_RTRANIF0_TYPE}, +#line 124 "v.gpe" + {"strong1", STRENGTH1, STRENGTH_STRONG1_TYPE}, +#line 69 "v.gpe" + {"fork", FORK, NO_TYPE}, +#line 112 "v.gpe" + {"tri0", NETTYPE, NET_TRI0_TYPE}, +#line 96 "v.gpe" + {"pulldown", PULL, GATE_PULLDN_TYPE}, +#line 51 "v.gpe" + {"if", IF, NO_TYPE}, +#line 88 "v.gpe" + {"notif1", BUFIF, GATE_NOTIF1_TYPE}, +#line 129 "v.gpe" + {"edge", EDGE, NO_TYPE}, +#line 93 "v.gpe" + {"cmos", CMOS, GATE_CMOS_TYPE}, +#line 119 "v.gpe" + {"strong0", STRENGTH0, STRENGTH_STRONG0_TYPE}, +#line 72 "v.gpe" + {"negedge", NEGEDGE, NO_TYPE}, +#line 107 "v.gpe" + {"wand", NETTYPE, NET_WAND_TYPE}, +#line 83 "v.gpe" + {"buf", BUFFER, GATE_BUF_TYPE}, +#line 46 "v.gpe" + {"real", REAL, NO_TYPE}, +#line 87 "v.gpe" + {"notif0", BUFIF, GATE_NOTIF0_TYPE}, + {""}, +#line 67 "v.gpe" + {"begin", BEGIN, NO_TYPE}, +#line 115 "v.gpe" + {"trireg", TRIREG, NET_TRIREG_TYPE}, + {""}, +#line 61 "v.gpe" + {"wait", WAIT_, NO_TYPE}, +#line 53 "v.gpe" + {"case", CASE, NO_TYPE}, +#line 95 "v.gpe" + {"pullup", PULL, GATE_PULLUP_TYPE}, +#line 54 "v.gpe" + {"casez", CASEZ, NO_TYPE}, +#line 113 "v.gpe" + {"supply1", SUPPLY1, NET_SUPPLY1_TYPE}, +#line 41 "v.gpe" + {"scalared", SCALARED, NO_TYPE}, +#line 24 "v.gpe" + {"macromodule", MACROMODULE, NO_TYPE}, + {""}, +#line 99 "v.gpe" + {"tranif1", BUFIF, GATE_TRANIF1_TYPE}, +#line 136 "v.gpe" + {"$setuphold", SETUPHOLD, NO_TYPE}, + {""}, {""}, +#line 114 "v.gpe" + {"supply0", SUPPLY0, NET_SUPPLY0_TYPE}, +#line 74 "v.gpe" + {"small", SMALL, NO_TYPE}, +#line 137 "v.gpe" + {"$nochange", NOCHANGE, NO_TYPE}, +#line 132 "v.gpe" + {"$period", PERIOD, NO_TYPE}, +#line 98 "v.gpe" + {"tranif0", BUFIF, GATE_TRANIF0_TYPE}, +#line 86 "v.gpe" + {"bufif1", BUFIF, GATE_BUFIF1_TYPE}, + {""}, +#line 55 "v.gpe" + {"casex", CASEX, NO_TYPE}, + {""}, +#line 135 "v.gpe" + {"$recovery", RECOVERY, NO_TYPE}, + {""}, +#line 131 "v.gpe" + {"$hold", HOLD, NO_TYPE}, +#line 130 "v.gpe" + {"$setup", SETUP, NO_TYPE}, +#line 85 "v.gpe" + {"bufif0", BUFIF, GATE_BUFIF0_TYPE}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 125 "v.gpe" + {"pull1", STRENGTH1, STRENGTH_PULL1_TYPE}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 120 "v.gpe" + {"pull0", STRENGTH0, STRENGTH_PULL0_TYPE}, + {""}, {""}, +#line 126 "v.gpe" + {"weak1", STRENGTH1, STRENGTH_WEAK1_TYPE}, +#line 50 "v.gpe" + {"always", ALWAYS, NO_TYPE}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 121 "v.gpe" + {"weak0", STRENGTH0, STRENGTH_WEAK0_TYPE}, + {""}, +#line 133 "v.gpe" + {"$width", WIDTH, NO_TYPE}, + {""}, {""}, {""}, +#line 43 "v.gpe" + {"reg", REG, NO_TYPE}, + {""}, {""}, +#line 127 "v.gpe" + {"highz1", STRENGTH1, STRENGTH_HIGHZ1_TYPE}, + {""}, +#line 134 "v.gpe" + {"$skew", SKEW, NO_TYPE}, + {""}, {""}, {""}, {""}, {""}, +#line 122 "v.gpe" + {"highz0", STRENGTH0, STRENGTH_HIGHZ0_TYPE} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { + register int key = hash(str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) { + register const char *s = wordlist[key].name; + + if (*str == *s && !strcmp(str + 1, s + 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/src/verisys.cc b/src/verisys.cc new file mode 100644 index 0000000..345b782 --- /dev/null +++ b/src/verisys.cc @@ -0,0 +1,578 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* VERISYS.C - PLI system routine hooks */ +#define VERISYS_C + +#include +#include +#include +#include "veriuser.h" +#include "acc_user.h" +#include "glue.h" +#include "vtypes.h" +#include "tree.h" +#include "veriwell.h" +#include "io.h" +#include +#include +#include "verisys.h" + +int timeformatcheck(int, int); +int timeformatcall(int, int); +int p(int user, int reason); +int pcheck(int user, int reason); +int mon_check(int user, int reason); +int mon_call(int user, int reason); +int mon_misc(int data, int reason); +int pmisc(int user, int reason); + + +#include "sdf.h" + + +#include "plihacks.h" + +s_tfcell verisystfs[] = { + /*** Template for an entry: + { usertask|userfunction, data, checktf(), sizetf(), calltf(), misctf(), + "$tfname", forwref?, Vtool?, ErrMsg? }, + Example: + { usertask, 0, my_check, 0, my_func, my_misctf, "$my_task" }, + ***/ + + /*** add user entries here ***/ + {usertask, 0, timeformatcheck, 0, timeformatcall, 0, "$timeformat"}, + {usertask, 0, showallinstances_call, 0, showallinstances_call, 0, + "$showallinstances"}, + {usertask, 0, pcheck, 0, p, pmisc, "$p"}, + {usertask, 1, mon_check, 0, mon_call, mon_misc, "$my_monitor"}, + {usertask, 0, dumpstructure_call, 0, dumpstructure_call, + dumpstructure_call, + "$$dumpstructure"}, + {usertask, 0, 0, 0, abort_call, 0, "$$abort"}, + {usertask, 0, 0, 0, setvalue_call, 0, "$$testsetvalue"}, + + {usertask, 0, sdf_check, 0, sdf_call, sdf_misc, "$sdf_annotate"}, + + + {0} /*** final entry must be 0 ***/ +}; + +#include + +int p(int user, int reason) +{ + printf("Get here on execution, user is %d, reason is %d\n", user, + reason); + + printf("Number of arguments: %d\n", tf_nump()); + tf_rosynchronize(); + tf_synchronize(); + return (0); +} + +int pcheck(int user, int reason) +{ + printf("Get here on compile, user is %d, reason is %d\n", user, + reason); + return (0); +} + +int pmisc(int user, int reason) +{ + return (0); +} + +/********************************************** + * vcl example from manual + **********************************************/ + +int mon_consume(p_vc_record); + +typedef struct t_mon_node { + handle param; + char name[256]; + short int value; +} s_mon_node, *p_mon_node; + +p_mon_node mon_array; +char *mon_instance_p; +int mon_num_params; + +int mon_check(int data, int reason) +{ + int i; + handle object; + static int net_reg_list[3] = { accNet, accRegister, 0 }; + + acc_initialize(); + acc_configure(accDevelopmentVersion, "1.6a"); + + for (i = 1; i <= tf_nump(); i++) { + if (!(object = acc_handle_tfarg(i))) + tf_error("parameter #%d to $my_monitor illegal", i); + + if (acc_fetch_type(object) != accNet + && acc_fetch_type(object) != accRegister) + tf_error("parameter #%d to $my_monitor illegal", i); + + if (acc_fetch_size(object) != 1) + tf_error("parameter #%d to $my_monitor illegal", i); + } + + acc_close(); + return (0); +} + +int mon_call(int data, int reason) +{ + int i; + char *value_str; + + acc_initialize(); + acc_configure(accDevelopmentVersion, "1.6a"); + + mon_instance_p = tf_getinstance(); + mon_num_params = tf_nump(); + + mon_array = (p_mon_node) malloc(mon_num_params * (sizeof(s_mon_node))); + + for (i = 0; i < mon_num_params; i++) { + mon_array[i].param = acc_handle_tfarg(i + 1); + strcpy(mon_array[i].name, acc_fetch_name(mon_array[i].param)); + + value_str = acc_fetch_value(mon_array[i].param, "%b"); + switch (value_str[0]) { + case '0': + mon_array[i].value = vcl0; + break; + case '1': + mon_array[i].value = vcl1; + break; + case 'x': + mon_array[i].value = vclX; + break; + case 'z': + mon_array[i].value = vclZ; + break; + default: + tf_error("Unknown value..."); + break; + } + acc_vcl_add(mon_array[i].param, mon_consume, + (char *) &mon_array[i], vcl_verilog_logic); + } + acc_close(); + tf_synchronize(); + return (0); +} + +int mon_consume(p_vc_record change_data) +{ + p_mon_node curr_mon_node; + + switch (change_data->vc_reason) { + case logic_value_change: + case sregister_value_change: + curr_mon_node = (p_mon_node) change_data->user_data; + curr_mon_node->value = change_data->out_value.logic_value; + tf_isynchronize(mon_instance_p); + break; + default: + tf_error("Illegal callback from VCL"); + } + return (TRUE); +} + +int mon_misc(int data, int reason) +{ + int i; + char *value; + + switch (reason) { + case reason_synch: + io_printf("%s ", tf_strgettime()); + + for (i = 0; i < mon_num_params; i++) { + switch (mon_array[i].value) { + case vcl0: + value = "0"; + break; + + case vcl1: + value = "1"; + break; + + case vclX: + value = "x"; + break; + + case vclZ: + value = "z"; + break; + } + io_printf("%s=%s ", mon_array[i].name, value); + } + io_printf("\n"); + break; + + } + return (0); +} + + +/* $timeformat (units, prec, suffix, width) */ + +/* This is for $timeformat. NOTE: This is imported by print.c! */ + +struct timeformat { + int units; + int precision; + char *suffix; + int width; + int use_defaults; +} timeformat; + + +int timeformatcall(int user, int reason) +{ + char *tmp_suffix; + + acc_initialize(); + timeformat.units = tf_getp(1); /* units */ + timeformat.precision = tf_getp(2); /* precision */ + + if (!timeformat.use_defaults) /* deallocate old stuff, if any */ + free(timeformat.suffix); + tmp_suffix = tf_getcstringp(3); /* suffix string */ + timeformat.suffix = (char *) xmalloc(strlen(tmp_suffix) + 1); + strcpy(timeformat.suffix, tmp_suffix); /* make perm copy */ + + timeformat.width = tf_getp(4); + timeformat.use_defaults = 0; + + return 0; +} + +int timeformatcheck(int user, int reason) +{ + return 0; +} + +/* this is called from print.c when %t is used (file_handle is the VeriWell file + handle) */ + +void timeformatprint(handle_t file_handle, tree scope, double this_time) +{ + char spec_format[100]; /* this holds the print spec */ + s_timescale_info timescale; + int printunits; + int scaleunits; /* how much to rescale this_time */ + double realmult; /* multiplier */ + double printtime; /* The time to print after rescaling */ + int numwidth; /* width of number part */ + +/* get the timescale for the module containing the display */ + + acc_fetch_timescale_info((handle) scope, ×cale); + + + if (timeformat.use_defaults) { + printunits = acc_fetch_precision(); /* get smallest precision */ + strcpy(spec_format, "%20.0f"); /* default time format */ + } else { + printunits = timeformat.units; + numwidth = timeformat.width - strlen(timeformat.suffix); + if (numwidth < 0) + numwidth = 0; + sprintf(spec_format, "%%%d.%df%s", timeformat.width, + timeformat.precision, timeformat.suffix); + } + +/* the given time has already been scaled to local units; unscale and + scale to timeformat units */ + + scaleunits = timescale.unit - printunits; + realmult = pow(10, scaleunits); + + printtime = this_time * realmult; /* rescale */ + + fprintf_V(file_handle, spec_format, printtime); /* finally, print it */ + +} + +/***************************************************************** + * + * showallinstances_call + * implements $showallinstances + * + ***************************************************************** + */ + + +static ShowallEntry_t **showallTable; + +int showallinstances_call(int data, int reason) +{ + handle object; + + acc_initialize(); + + switch (reason) { + case reason_checktf: + if (tf_nump() != 0) { + tf_error("$showallinstances takes no arguments"); + } + break; + + case reason_calltf: + if (!showall_init()) { + break; + } + object = null; + while (TRUE) { + object = acc_next_topmod(object); + if (object == null) { + break; + } + if (!showall_search(object)) { + acc_close(); + return 0; + } + } + showall_output(); + break; + } + + acc_close(); + return 0; + +} + +/*--------------------------------------------------- + showall_init + - initialize hash table +-----------------------------------------------------*/ +int showall_init(void) +{ + int i; + + showallTable = (ShowallEntry_t **) xmalloc(SHOWALL_HASH_SIZE * + sizeof(ShowallEntry_t + *)); + if (showallTable == NULL) { + tf_error("$showallinstances: not enough memory"); + return FALSE; + } + for (i = 0; i < SHOWALL_HASH_SIZE; i++) { + showallTable[i] = NULL; + } + return TRUE; +} + +/*--------------------------------------------------- + showall_register + - log the object +-----------------------------------------------------*/ +int showall_register(handle object) +{ + char *ptr; + int type; + char *name; + char *filename; + s_location location; + int index; + ShowallEntry_t *entry; + int fulltype; + + name = acc_fetch_defname(object); + acc_fetch_location(&location, object); + + type = acc_fetch_type(object); + fulltype = acc_fetch_fulltype(object); + if (type == accModule || fulltype == accCombPrim + || fulltype == accSeqPrim) { + if (type == accModule && fulltype != accTopModule) { + type = accModule; + } else { + type = fulltype; + } + } + + index = 0; + for (ptr = name; *ptr; ptr = ptr + 1) { + index = index ^ (unsigned) *ptr; + } + index &= 0xff; + + for (entry = showallTable[index]; entry; entry = entry->next) { + if (!strcmp(entry->name, name) && entry->type == type) { + entry->count++; + return TRUE; + } + } + entry = (ShowallEntry_t *) xmalloc(sizeof(ShowallEntry_t)); + if (entry == NULL) { + tf_error("$showallinstances: Out of memory"); + return FALSE; + } + + entry->name = name; + entry->type = type; + entry->count = 1; + entry->next = showallTable[index]; + entry->filename = location.filename; + showallTable[index] = entry; + + return TRUE; + +} + +/*--------------------------------------------------- + showall_search + - traverse the hierarchy +-----------------------------------------------------*/ +int showall_search(handle object) +{ + int type; + handle newObject; + + type = acc_fetch_type(object); + + switch (type) { + case accModule: + if (!showall_register(object)) { + return FALSE; + } + case accTask: + case accFunction: + newObject = null; + while (TRUE) { + newObject = acc_next_primitive(object, newObject); + if (newObject == null) { + break; + } + if (!showall_register(newObject)) { + return FALSE; + } + } + + newObject = null; + while (TRUE) { + newObject = acc_next_scope(object, newObject); + if (newObject == null) { + break; + } + if (!showall_search(newObject)) { + return FALSE; + } + } + break; + } + return TRUE; +} + +/*--------------------------------------------------- + showall_output + - dump object list and free structures +-----------------------------------------------------*/ +void showall_output(void) +{ + ShowallEntry_t *entry; + ShowallEntry_t *temp; + int i; + int moduleCount; + int primitiveCount; + int gateCount; + + + gateCount = 0; + primitiveCount = 0; + moduleCount = 0; + + for (i = 0; i < SHOWALL_HASH_SIZE; i++) { + entry = showallTable[i]; + while (entry) { + switch (entry->type) { + case accModule: + moduleCount += entry->count; + break; + case accPrimitive: + gateCount += entry->count; + break; + case accSeqPrim: + case accCombPrim: + gateCount += entry->count; + primitiveCount += entry->count; + break; + } + entry = entry->next; + } + } + io_printf("Total number of module instances = %d\n", moduleCount); + io_printf("Total number of primitive instances = %d\n", + primitiveCount); + + for (i = 0; i < SHOWALL_HASH_SIZE; i++) { + entry = showallTable[i]; + while (entry) { + switch (entry->type) { + case accTopModule: + io_printf("\ttop level module %s, from file \"%s\"\n", + entry->name, entry->filename); + break; + case accSeqPrim: + case accCombPrim: + io_printf("\t%d of primitive %s, from file \"%s\"\n", + entry->count, entry->name, entry->filename); + break; + case accModule: + io_printf("\t%d of module %s, from file \"%s\"\n", + entry->count, entry->name, entry->filename); + break; + } + entry = entry->next; + } + } + + io_printf("Total number of gates = %d\n", gateCount); + + for (i = 0; i < SHOWALL_HASH_SIZE; i++) { + entry = showallTable[i]; + while (entry) { + switch (entry->type) { + case accPrimitive: + io_printf("\t%d of %s\n", entry->count, entry->name); + break; + } + temp = entry; + entry = entry->next; + free(temp); + } + } + + free(showallTable); + showallTable = NULL; +} + +void init_verisys() +{ + timeformat.use_defaults = 1; +} diff --git a/src/verisys.h b/src/verisys.h new file mode 100644 index 0000000..14701d0 --- /dev/null +++ b/src/verisys.h @@ -0,0 +1,54 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* VERISYS.H - verisys.c routine prototypes */ + +#ifndef VERISYS_H +#define VERISYS_H + +// public methods + +void init_verisys(void); + +// private methods + +#ifdef VERISYS_C + +#define SHOWALL_HASH_SIZE (256) + +typedef struct ShowallEntry_tag { + struct ShowallEntry_tag *next; + char *name; + char *filename; + int type; + int count; +} ShowallEntry_t; + +int showallinstances_call(int, int); +int showall_init(void); +int showall_register(handle); +int showall_search(handle); +void showall_output(void); +int timeformatcall(int user, int reason); +int timeformatcheck(int user, int reason); +void timeformatprint(handle_t file_handle, tree scope, double this_time); + +#endif // VERISYS_C + +#endif // VERIWELL_H diff --git a/src/veriuser.c b/src/veriuser.c new file mode 100644 index 0000000..1a86a3f --- /dev/null +++ b/src/veriuser.c @@ -0,0 +1,52 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* VERIUSER.C - PLI user routine hooks */ + +/* Filename: veriuser.c */ +#define VERIUSER_C + +#include "veriuser.h" +#include "acc_user.h" + +//char *veriuser_version_str = "Sample PLI version string 1.0\n"; +char *veriuser_version_str = ""; + int (*endofcompile_routines[]) () = { + /*** my_eoc_routine, ***/ + 0 /*** final entry must be 0 ***/ +}; + +/* +bool err_intercept(level,facility,code) +int level; char *facility; char *code; +{ return(true); } +*/ + +s_tfcell veriusertfs[] = { + /*** Template for an entry: + { usertask|userfunction, data, checktf(), sizetf(), calltf(), misctf(), + "$tfname", forwref?, Vtool?, ErrMsg? }, + Example: + { usertask, 0, my_check, 0, my_func, my_misctf, "$my_task" }, + ***/ + + /*** add user entries here ***/ + + {0} /*** final entry must be 0 ***/ +}; diff --git a/src/veriuser.h b/src/veriuser.h new file mode 100644 index 0000000..fcefd32 --- /dev/null +++ b/src/veriuser.h @@ -0,0 +1,467 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* VERIUSER.H - PLI user routine header */ + +#ifndef VERIUSER_H +#define VERIUSER_H + +#ifdef _LP64 +#define LP64 long +#else +#define LP64 int +#endif + + +/* general defines */ + +#define true 1 +#define false 0 +#define TRUE 1 +#define FALSE 0 + +/* defines for error interception */ + +#define ERR_MESSAGE 1 +#define ERR_WARNING 2 +#define ERR_ERROR 3 +#define ERR_INTERNAL 4 +#define ERR_SYSTEM 5 + + +/* VERILOG user tasks and functions C header file */ + +typedef struct t_tfcell { + short type; /* either usertask or userfunction */ + short data; /* parameter for the following routines */ + int (*checktf) (int, int); /* routine for checking parameters */ + int (*sizetf) (int, int); /* for providing size of function return value */ + int (*calltf) (int, int); /* routine called during simulation */ + int (*misctf) (int, int); /* miscellaneous routine (see below) */ + char *tfname; /* the name of the system task or function */ + int forwref; /* indicates special parameters allowed */ + char *tfveritool; /* Which Veritool owns the task */ + char *tferrmessage; /* An optional special case error message + which will be printed if the task is skipped */ + + /* these components are for system usage only */ + int hash; + struct t_tfcell *left_p; + struct t_tfcell *right_p; + char *namecell_p; + int warning_printed; /* Flag is set when skipping warning is printed */ +} s_tfcell, *p_tfcell; + +struct t_tfexprinfo; +struct t_vecval; + +/* values for component 'type' in tfcell structure */ +#define usertask 1 +#define USERTASK 1 +#define userfunction 2 +#define USERFUNCTION 2 +#define userrealfunction 3 +#define USERREALFUNCTION 3 + + +/* The routines checktf, sizetf, calltf and misctf are always +passed two arguments: 'data' and 'reason'. +The value for 'data' is defined as the second component +supplied by the user in the above table structure. +The value for 'reason' is defined as follows: + + reason_checktf for checktf + reason_sizetf for sizetf + reason_calltf for calltf + reason_save for misctf during $save + reason_restart for misctf during $restart + reason_disable for misctf during disable + reason_paramvc for misctf at a parameter value change (when enabled) + reason_synch for misctf at end of time slot for synchronisation + reason_finish for misctf at finish of simulation + reason_reactivate for misctf at a delayed reactivation event + reason_rosynch for misctf at end of time slot read-only synchronisation + reason_paramdrc for misctf at a driver value change (when enabled) + +(see below for the #defines on these) + +Note that any of the routine pointers maybe 0, in which +case the calls from VERILOG are not made. + +For the misctf at a parameter value change, the parameter +number is passed as the 3rd argument. +*/ + +/* values for 'reason' passed as 2nd argument */ +#define reason_checktf 1 +#define REASON_CHECKTF 1 +#define reason_sizetf 2 +#define REASON_SIZETF 2 +#define reason_calltf 3 +#define REASON_CALLTF 3 +#define reason_save 4 +#define REASON_SAVE 4 +#define reason_restart 5 +#define REASON_RESTART 5 +#define reason_disable 6 +#define REASON_DISABLE 6 +#define reason_paramvc 7 +#define REASON_PARAMVC 7 +#define reason_synch 8 +#define REASON_SYNCH 8 +#define reason_finish 9 +#define REASON_FINISH 9 +#define reason_reactivate 10 +#define REASON_REACTIVATE 10 +#define reason_rosynch 11 +#define REASON_ROSYNCH 11 +#define reason_paramdrc 12 +#define REASON_PARAMDRC 12 + +#define reason_interactive 14 +#define REASON_INTERACTIVE 14 +#define reason_endofcompile 15 +#define REASON_ENDOFCOMPILE 15 +#define reason_force 16 +#define REASON_FORCE 16 +#define reason_release 17 +#define REASON_RELEASE 17 +#define reason_scope 18 +#define REASON_SCOPE 18 + +#ifdef __cplusplus +extern "C" { +#endif + +/* user error message string */ + extern char *tf_error_message; + +/******** utility routines *********************/ + char *tf_getinstance(); + + int tf_sizep(int); + int tf_isizep(int, char *); + + int tf_nump(); + int tf_inump(char *); + + int tf_typep(int); + int tf_itypep(int, char *); + + LP64 tf_getp(int); + LP64 tf_igetp(int, char *); + void tf_putp(int, int); + void tf_iputp(int, int, char *); + + int tf_getlongp(int *, int); + int tf_igetlongp(int *, int, char *); + void tf_putlongp(int, int, int); + void tf_iputlongp(int, int, int, char *); + + double tf_getrealp(int); + double tf_igetrealp(int, char *); + void tf_putrealp(int, double); + void tf_iputrealp(int, double, char *); + + char *tf_strgetp(int, char); + char *tf_istrgetp(int, char, char *); + + struct t_tfexprinfo *tf_exprinfo(int, struct t_tfexprinfo *); + struct t_tfexprinfo *tf_iexprinfo(int, struct t_tfexprinfo *, char *); + struct t_tfnodeinfo *tf_nodeinfo(int, struct t_tfnodeinfo *); + struct t_tfnodeinfo *tf_inodeinfo(int, struct t_tfnodeinfo *, char *); + + void tf_evaluatep(int); + void tf_ievaluatep(int, char *); + + void tf_propagatep(int); + void tf_ipropagatep(int, char *); + + void tf_asynchon(); + void tf_iasynchon(char *); + void tf_asynchoff(); + void tf_iasynchoff(char *); + + void tf_synchronize(); + void tf_isynchronize(char *); + void tf_rosynchronize(); + void tf_irosynchronize(char *); + + int tf_gettime(); + double tf_getrealtime(); + void io_printf(char *, ...); + void tf_error(char *, ...); + void tf_warning(char *, ...); + void tf_text(char *, ...); + void tf_message(int, char *, char *, char *, ...); + void tf_dostop(); + void tf_dofinish(); + char *tf_getcstringp(int); + char *tf_igetcstringp(int, char *); + int tf_gettimeprecision(void); + int tf_igettimeprecision(char *); + int tf_gettimeunit(void); + int tf_igettimeunit(char *); + void tf_finish(void); + void tf_stop(void); + + extern char *tf_dumpfilename(); + extern int tf_setdelay(int delay); + extern int tf_isetdelay(int delay, char *instance); + extern int tf_setlongdelay(int low, int high); + extern int tf_isetlongdelay(int low, int high, char *instance); + extern int tf_setrealdelay(double delay); + extern int tf_isetrealdelay(double delay, char *instance); + + extern void tf_clearalldelays(); + extern void tf_iclearalldelays(char *instance); + + extern int tf_strdelputp(int nparam, int bitlength, int format_char, + char *value_p, int delay, int delaytype); + extern int tf_istrdelputp(int nparam, int bitlength, int format_char, + char *value_p, int delay, int delaytype, + char *instance); + extern int tf_strlongdelputp(int nparam, int bitlength, + int format_char, char *value_p, int low, + int high, int delaytype); + extern int tf_istrlongdelputp(int nparam, int bitlength, + int format_char, char *value_p, int low, + int high, int delaytype, char *instance); + extern int tf_strrealdelputp(int nparam, int bitlength, + int format_char, char *value_p, + double delay, int delaytype); + extern int tf_istrrealdelputp(int nparam, int bitlength, + int format_char, char *value_p, + double delay, int delaytype, + char *instance); + + extern int tf_copypvc_flag(int); + extern int tf_icopypvc_flag(int, char *); + extern int tf_movepvc_flag(int); + extern int tf_imovepvc_flag(int, char *); + extern int tf_testpvc_flag(int); + extern int tf_itestpvc_flag(int, char *); + extern int tf_getpchange(int); + extern int tf_igetpchange(int, char *); + + extern void tf_setworkarea(char *); + extern void tf_isetworkarea(char *, char *); + extern char *tf_getworkarea(); + extern char *tf_igetworkarea(char *); + extern char *(*tf_getroutine()) (); + extern char *(*tf_igetroutine()) (); + extern char *tf_gettflist(); + extern char *tf_igettflist(); + + extern char *tf_mipname(); + extern char *tf_imipname(char *); + extern char *tf_spname(); + extern char *tf_ispname(char *); + + extern void io_mcdprintf(int, char *, ...); + + extern char *mc_scan_plusargs(char *startarg); + + extern int tf_getlongtime(int *); + extern int tf_igetlongtime(int *, char *); + extern char *tf_strgettime(); + + extern int tf_getnextlongtime(int *aof_lowtime, int *aof_hightime); + extern int tf_getnextrealtime(); + extern char *tf_longtime_tostr(int lowtime, int hightime); + + extern int tf_compare_long(int low1, int high1, int low2, int high2); + extern void tf_add_long(int *low1p, int *high1p, int low2, int high2); + extern void tf_subtract_long(int *low1p, int *high1p, int low2, + int high2); + + extern void tf_multiply_long(int *low1p, int *high1p, int low2, + int high2); + extern void tf_divide_long(int *low1p, int *high1p, int low2, + int high2); + + extern void tf_scale_realdelay(char *instance_p, double realdelay, + double *aof_realdelay); + extern void tf_scale_longdelay(char *, int, int, int *, int *); + extern void tf_unscale_realdelay(char *instance_p, double realdelay, + double *aof_realdelay); + extern void tf_unscale_longdelay(char *, int, int, int *, int *); + + extern void tf_long_to_real(int low, int high, double *aof_real); + extern void tf_real_to_long(double realvalue, int *aof_int_lo, + int *aof_int_hi); + extern int tf_write_save(char *blockptr, int blocklen); + extern int tf_read_restart(char *blockptr, int blocklen); + + +#ifdef __cplusplus +} +#endif +/***********************************************//* data structure for use with tf_exprinfo routine to get + expression information +*/ typedef struct t_tfexprinfo { + short expr_type; /* expression type information, one of: + tf_nullparam + tf_string + tf_readonly + tf_readwrite + tf_rwbitselect + tf_rwpartselect + tf_rwmemselect + tf_readonlyreal + tf_readwritereal + */ + struct t_vecval *expr_value_p; /* pointer to expression value */ + double real_value; /* expression value for 'real' expressions */ + char *expr_string; /* pointer to string when parameter is a string */ + int expr_ngroups; /* no of groups in expression value */ + int expr_vec_size; /* no of bits in expression value */ + int expr_sign; /* sign of the expression value: + 0 for unsigned , non-zero for signed */ + int expr_lhs_select; /* not used at present + result of either: + bit-select + msb of part-select + element selection + */ + int expr_rhs_select; /* not used at present + result of either: + bit-select (same value as previous component) + lsb of part-select + element selection (same value as previous component) + */ +} s_tfexprinfo, *p_tfexprinfo; + + + +/* data structure for use with tf_nodeinfo routine to get + node information +*/ +typedef struct t_tfnodeinfo { + short node_type; /* expression type information, one of: + tf_null_node + tf_reg_node + tf_integer_node + tf_time_node + tf_netvector_node + tf_netscalar_node + tf_memory_node + tf_real_node + */ + union { + struct t_vecval *vecval_p; /* reg, integer, time, net vector value */ + struct t_strengthval *strengthval_p; /* net scalar value */ + char *memoryval_p; /* memory value */ + double *real_val_p; /* type 'real' value */ + } node_value; + char *node_symbol; /* identifying string of node */ + int node_ngroups; /* no of groups in node value */ + int node_vec_size; /* no of bits in node value */ + int node_sign; /* sign of the node value + 0 for unsigned , non-zero for signed */ + int node_ms_index; /* not used at present + most significant index of node value */ + int node_ls_index; /* not used at present + least significant index of node value */ + int node_mem_size; /* no of elements in memory structure */ + int node_lhs_element; /* not used at present + lhs memory element address */ + int node_rhs_element; /* not used at present + rhs memory element address */ + int *node_handle; /*jjp052389 add handle field for access integration */ +} s_tfnodeinfo, *p_tfnodeinfo; + + + +/* data structure of vector values */ +typedef struct t_vecval { + int avalbits; /* bit-coding for each bit of vector: */ + int bvalbits; /* ab: 00=0, 10=1, 11=X, 01=Z */ +} s_vecval, *p_vecval; + + + +/* data structure of scalar net strength values */ +typedef struct t_strengthval { + int strength0; /* 0 strength component */ + int strength1; /* 1 strength component */ +} s_strengthval, *p_strengthval; + + + +/* + data structure of memory values + byte array organized in format: + + struct + { + char avalbits[ngroups]; bit-coding for each element: + char bvalbits[ngroups]; ab: 00=0, 10=1, 11=X, 01=Z + } memval[mem_size]; + + with element addressed by left-hand-side index in + declaration as the first word. + N.B. this data structure cannot be represented in C, thus it + it is declared as an array of char's. +*/ + + + + +/* types used by tf_typep() and expr_type in tf_exprinfo structure */ +#define tf_nullparam 0 +#define TF_NULLPARAM 0 +#define tf_string 1 +#define TF_STRING 1 +#define tf_specialparam 2 +#define TF_SPECIALPARAM 2 +#define tf_readonly 10 +#define TF_READONLY 10 +#define tf_readwrite 11 +#define TF_READWRITE 11 +#define tf_rwbitselect 12 +#define TF_RWBITSELECT 12 +#define tf_rwpartselect 13 +#define TF_RWPARTSELECT 13 +#define tf_rwmemselect 14 +#define TF_RWMEMSELECT 14 +#define tf_readonlyreal 15 +#define TF_READONLYREAL 15 +#define tf_readwritereal 16 +#define TF_READWRITEREAL 16 + +/* types used by node_type in tf_nodeinfo structure */ +#define tf_null_node 100 +#define TF_NULL_NODE 100 +#define tf_reg_node 101 +#define TF_REG_NODE 101 +#define tf_integer_node 102 +#define TF_INTEGER_NODE 102 +#define tf_time_node 103 +#define TF_TIME_NODE 103 +#define tf_netvector_node 104 +#define TF_NETVECTOR_NODE 104 +#define tf_netscalar_node 105 +#define TF_NETSCALAR_NODE 105 +#define tf_memory_node 106 +#define TF_MEMORY_NODE 106 +#define tf_real_node 107 +#define TF_REAL_NODE 107 + +#endif diff --git a/src/veriwell.cc b/src/veriwell.cc new file mode 100644 index 0000000..2a8b2b6 --- /dev/null +++ b/src/veriwell.cc @@ -0,0 +1,970 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* veriwell.c - Main, parse arguments, misc utilities */ + +#define VERIWELL_C + +#include +#include +#include +#include +#include +#include +#include +#include +#include "vtypes.h" +#include "tree.h" +#include "schedule.h" +#include "veriwell.h" +#include "lex.h" +#include "flags.h" +#include "runtime.h" +#include "macro.h" +#include "io.h" +#include "glue.h" +#include "scope.h" +#include "veriwell.h" +#include "pass3.h" +#include "gates.h" +#include "exec.h" +#include "pass2.h" +#include "acc_user.h" +#include "pli.h" +#include "systask.h" + +int dump_it = 0; +FILE *dumpfile; +unsigned _ovrbuffer = 0x400; +void *zero_ptr = 0; /* for monitoring 0000:0000 in debugger */ +tree dbg; /* for debugging */ +tree dbg1; /* for debugging */ + +extern LibPath_t *ypathList; + +char *versionString = VERSION; + +#define MAX_LEVEL 25 +Bit mask_right[sizeof(Bit) * 8 + 1]; +Bit mask_right1[sizeof(Bit) * 8 + 1]; + +int globalArgc; +char **globalArgv; + +clock_t clock_start; +clock_t clock_compile; +clock_t clock_load; +clock_t clock_simulate; +clock_t clock_pause = 0; + +/* The current program counter (actually a pointer to a tree node to be + "executed" */ + +#define CPS sysconf(_SC_CLK_TCK) +static clock_t mclock() +{ + struct tms tms; + times(&tms); + return tms.tms_utime + tms.tms_stime; +} + +tree save_pc; + +/* The name of this program (Verilog) */ +char *progname; + +extern int yydebug; /* was in BISON.SIM; now here to avoid multiple definitions + (now that there are two parsers) */ + +/* Ignore the argument after an unsupported option for now */ +int extra_flag = 0; + + +/* Default net type and delay type (min/typ/max) can be changed by + compiler directive or command-line option */ +enum tree_type default_net_type = NET_WIRE_TYPE; +enum delay_type delay_type = TYP_DELAY; + + +/* Print the header, check for key/passwd/whatever, init a few other things */ +void init() +{ + extern char *veriuser_version_str; + time_t t = time(NULL); + + /* Print out our header */ + printf_V("\n\n\t%s version %s, \n" + "\tCopyright (C) 1993-2005 Elliot Mednick and Mark Hummel\n\n" + "\tVeriwell comes with ABSOLUTELY NO WARRANTY; This is free\n" + "\tsoftware, and you are welcome to redistribute it under the\n" + "\tterms of the GNU General Public License as published by\n" + "\tthe Free Software Foundation; either version 2 of the License,\n" + "\tor (at your option) any later version. " + "\n\n", VERIWELL, VERSION); + printf_V(veriuser_version_str); + + + /* initialize tree structures */ + + /* mask_right is 0:0, 1:1, 2:3, 3:7, 4:15, ..., 32:-1 + * mask_right1 is 0:-1, 1:1, 2:3, ..., 32:0 + */ + mask_right[0] = 0; + mask_right1[0] = (Bit) - 1; + mask_right[sizeof(Bit) * 8] = (Bit) - 1; + mask_right1[sizeof(Bit) * 8] = 0; + + for (int i = 1; i < sizeof(Bit) * 8; i++) { + mask_right[sizeof(Bit) * 8 - i] = (Bit) - 1 >> i; + mask_right1[sizeof(Bit) * 8 - i] = (Bit) - 1 >> i; + } + if (dump_it) + dumpfile = shell_fopen("dump.out", "wb"); +} + +/* Number of error messages and warning messages so far. */ + +int errorcount = 0; +int warningcount = 0; + +/* Count an error or warning. Return 1 if the message should be printed. */ + +int count_error(int warningp) +{ + if (warningp && inhibit_warnings) { + return 0; + } + + if (warningp) { + warningcount++; + } else { + errorcount++; + } + return 1; +} + +/* Print a fatal error message. NAME is the text. + Also include a system error message based on `errno'. */ + +void fatal(char *s, char *v) +{ + error(s, v, (char *) NULL); + shell_exit(34); +} + +/* Prints out, if necessary, the name of the current function + which caused an error. Called from all error and warning functions. */ + +void report_error_function(char *file) +{ +} + +/* Report an error at line LINE of file FILE. + S and V are a string and an arg for `printf'. */ + +void +error_with_file_and_line(char *file, + lineno_t line, char *s, char *v, char *v2) +{ + count_error(0); + report_error_function(file); + if (is_interactive) { + printf_error_V("C%d: ", cmd_level); + new_cmd_level = cmd_level; + } else if (file) { + printf_error_V("%s: L%ld: ", file, line); + } else if (progname) { + printf_error_V("VeriWell: "); + } + + printf_error_V("error: "); + printf_error_V(s, v, v2); + printf_error_V("\n"); +} + +/* Report an error at the current line number. + S and V are a string and an arg for `printf'. */ + +void error(char *s, char *v, char *v2) +{ + error_with_file_and_line(input_filename, lineno, s, v, v2); +} + +/* Report a warning at line LINE. + S and V are a string and an arg for `printf'. */ + +void +warning_with_file_and_line(char *file, lineno_t line, char *s, char *v, + char *v2) +{ + if (count_error(1) == 0) { + return; + } + + report_error_function(file); + + if (file) { + printf_error_V("%s: L%ld: ", file, line); + } else { + printf_error_V("VeriWell: "); + } + printf_error_V("warning: "); + printf_error_V(s, v, v2); + printf_error_V("\n"); +} + +/* Report a warning at the current line number. + S and V are a string and an arg for `printf'. */ + +void warning(char *s, char *v, char *v2) +{ + warning_with_file_and_line(input_filename, lineno, s, v, v2); +} + +/* Report a warning at line LINE. + S and V are a string and an arg for `printf'. */ + +void +sorry_with_file_and_line(char *file, lineno_t line, + char *s, char *v, char *v2) +{ + if (count_error(0) == 0) { + return; + } + + report_error_function(file); + + if (file) { + printf_error_V("%s: L%ld: ", file, line); + } else { + printf_error_V("VeriWell: "); + } + printf_error_V("sorry: "); + printf_error_V(s, v, v2); + printf_error_V("\n"); +} + +/* Report a warning at the current line number. + S and V are a string and an arg for `printf'. */ + +void sorry(char *s) +{ + sorry_with_file_and_line(input_filename, lineno, s, NULL_CHAR, + NULL_CHAR); +} + +void sorry1(char *s, char *v) +{ + sorry_with_file_and_line(input_filename, lineno, s, v, NULL_CHAR); +} + +/* Warn about incompatibilities with Synopsys 2.0 */ + +void synopsys_warn(char *s) +{ + char msg[64]; + + strcpy(msg, s); + strcat(msg, " not supported by Synopsys HDL Compiler(tm)"); + warning(msg, NULL_CHAR, NULL_CHAR); +} + +void runtime_error(tree node) +{ + input_filename = STMT_SOURCE_FILE(node); + lineno = STMT_SOURCE_LINE(node); +} + + +/* Same as `malloc' but report error if no memory available. */ + +char *xmalloc(unsigned size) +{ + char *value; + value = (char *) malloc(size); + if (value == 0) { + fatal("Memory exhausted.", NULL); + } + return value; +} + +/* Same as `realloc' but report error if no memory available. */ + +char *xrealloc(char *ptr, int size) +{ + char *result = (char *) realloc(ptr, size); + if (!result) { + fatal("Memory exhausted.", NULL); + } + return result; +} + +typedef struct filelist { + char *name; + struct filelist *next; +} Filelist; + +static File *i_file; +char i_buf[BUFSIZ]; +static Filelist *f_first = 0; +static Filelist *f_last = 0; +static Filelist *source_first = 0; +static Filelist *source_last = 0; + + +int in_simulation = 0; + +/* test file; return 1 if file exists */ + +int test_file(char *filename) +{ + FILE *tmp = shell_fopen(filename, "r"); + if (!tmp) { + return 0; + } + fclose(tmp); + return 1; +} + +/* Parse the command line */ + +void Cmdline(int argc, char **argv) +{ + char input[256]; + Filelist *fp; + + /* First, read command line */ + + while (--argc > 0) { + process_cmdline(*++argv); + } + + if (f_flag) { + printf_error_V("Specifying -f without a filename is illegal\n"); + CmdlineHelp(); + shell_exit(1); + } + if (i_flag) { + printf_error_V("Specifying -i without a filename is illegal\n"); + CmdlineHelp(); + shell_exit(1); + } + if (l_flag) { + printf_error_V("Specifying -l without a filename is illegal\n"); + CmdlineHelp(); + shell_exit(1); + } + if (k_flag) { + printf_error_V("Specifying -k without a filename is illegal\n"); + CmdlineHelp(); + shell_exit(1); + } + + /* Open log file */ + if (!log_available) { + /* set if new file name given in command line */ + log_file_name = (char *) xmalloc(13); + strcpy(log_file_name, "veriwell.log"); + } + if (!strcmp(log_file_name, "nolog")) { + log_file = 0; + log_available = 0; + log_enable = 0; + warning("Proceeding without a log file", NULL_CHAR, NULL_CHAR); + } else { + log_file = shell_fopen(log_file_name, "w+t"); + if (!log_file) { + log_available = 0; + log_enable = 0; + warning("Cannot open log file '%s', proceeding without it", + log_file_name, NULL_CHAR); + } else { + log_available = 1; + log_enable = 1; + } + } + + /* Open key file */ + if (!key_available) { + /* set if new file name given in command line */ + key_file_name = (char *) xmalloc(13); + strcpy(key_file_name, "veriwell.key"); + } + if (!strcmp(key_file_name, "nokey")) { + key_file = 0; + key_available = 0; + key_enable = 0; + warning("Proceeding without a key file", NULL_CHAR, NULL_CHAR); + } else { + key_file = shell_fopen(key_file_name, "w+t"); + if (!key_file) { + key_available = 0; + key_enable = 0; + warning("Cannot open key file '%s', proceeding without it", + key_file_name, NULL_CHAR); + } else { + key_available = 1; + key_enable = 1; + } + } + + init_macro(); + init_input(); + + /* Now, parse all cmd arg files */ + + for (fp = f_first; fp != (Filelist *) 0; fp = fp->next) { + int c; + printf_V("Processing command file : %s\n", fp->name); + push_stream(fin, 0); + input_filename = fp->name; + lineno = 0; + if ((fin = File::fopen(fp->name, "r")) == NULL) { + printf_error_V("%s: can't open %s\n", progname, fp->name); + shell_exit(1); + } + while ((c = skip_white_space(fin->fgetc())) != EOF) { + fin->fungetc(c); + fin->fscanf("%s", input); + process_cmdline(input); + } + if (f_flag) { + printf_error_V + ("Specifying -f without a filename is illegal\n"); + CmdlineHelp(); + shell_exit(1); + } + if (i_flag) { + printf_error_V + ("Specifying -i without a filename is illegal\n"); + CmdlineHelp(); + shell_exit(1); + } + + if (fin) { + /* skipwhitespace will close this, but let's make sure */ + fin->fclose(); + } + pop_stream(); + } + + init(); + init_interactive(); + + /* Now, parse all source files */ + clock_start = mclock(); + + if (!errorcount) { + printf_V("Entering Phase I...\n"); + for (fp = source_first; fp != (Filelist *) 0; fp = fp->next) { + input_filename = fp->name; + moreinput(fp->name); + printf_V("Compiling source file : %s\n", fp->name); + PhaseI(); + } + } + clock_compile = mclock() - clock_start; + if (!errorcount) { + printf_V("\nEntering Phase II...\n"); + PhaseII(); + } + if (!errorcount) { + printf_V("Entering Phase III...\n"); + PhaseIII(); + } +#if VDEBUG != 0 + if (vdebug) + print_stats(); +#endif + + if (warningcount) { + if (warningcount == 1) { + printf_V("1 warning in compilation\n"); + } else { + printf_V("%d warnings in compilation\n", warningcount); + } + } + if (errorcount) { + if (errorcount == 1) { + printf_V("1 error in compilation\n"); + } else { + printf_V("%d errors in compilation\n", errorcount); + } + shell_exit(1); + } + printf_V("No errors in compilation\n"); + clock_load = mclock() - clock_start - clock_compile; + + if (!simulate) { + shell_exit(0); + } + initialize_scope(top_level); + initialize_gates(); + initialize_cont_assignments(); + save_pc = dispatch_pc((enum which_list) NULL); + init_interactive(); + print_top_modules(); + in_simulation = 1; + broadcast_tf(reason_endofcompile); + fin = File::Stdin(); + if (i_file) { + push_stream(fin, 0); + fin = i_file; + } +} + + +void process_cmdline(char *input) +{ + Filelist *fp; + char c; + int f_nest = 0; + int extra_flag = 0; + + /* + * Consider the "-f" filename case + */ + if (f_flag) { + if (!test_file(input)) { + fatal("Could not open (-f) input file '%s'\n", input); + } + f_flag = 0; + fp = (Filelist *) xmalloc(sizeof(Filelist)); + fp->name = (char *) xmalloc(strlen(input) + 1); /* +1 for '/0' */ + strcpy(fp->name, input); + fp->next = (Filelist *) 0; + if (f_last) { + f_last->next = fp; + } else { + f_first = fp; + } + f_last = fp; + } else if (i_flag) { + if ((i_file = File::fopen(input, "r")) == 0) { + fatal("Could not open (-i) input file '%s'\n", input); + } + i_flag = 0; + } else if (l_flag) { + l_flag = 0; + log_file_name = (char *) xmalloc(strlen(input) + 1); + strcpy(log_file_name, input); + /* in this context, indicates explicit log file name */ + log_available = 1; + } else if (k_flag) { + k_flag = 0; + key_file_name = (char *) xmalloc(strlen(input) + 1); + strcpy(key_file_name, input); + /* in this context, indicates explicit log file name */ + key_available = 1; + } else if (y_flag) { + LibPath_t *libPath; + y_flag = 0; + libPath = (LibPath_t *) xmalloc(sizeof(LibPath_t)); + libPath->next = ypathList; + ypathList = libPath; + libPath->path = (char *) xmalloc(strlen(input) + 1); + strcpy(libPath->path, input); + } else if (extra_flag) { + extra_flag = 0; /* ignore argument after option that takes args */ + /* + * Consider the command line switches + */ + } else if (!strcmp( input, "--help" ) ) { + CmdlineHelp(); + shell_exit(0); + } else if (!strcmp( input, "--version" ) ) { + printf( "%s\n", VERSION ); + shell_exit(0); + } else if (!strcmp( input, "--bindir" ) ) { + printf( "%s\n", BINDIR ); + shell_exit(0); + } else if (!strcmp( input, "--libdir" ) ) { + printf( "%s\n", LIBDIR ); + shell_exit(0); + } else if (!strcmp( input, "--includedir" ) ) { + printf( "%s\n", INCLUDEDIR ); + shell_exit(0); + } else if (!strcmp( input, "--cflags" ) ) { + printf( "%s\n", CFLAGS ); + shell_exit(0); + } else if (!strcmp( input, "--ldflags" ) ) { + printf( "%s\n", LDFLAGS ); + shell_exit(0); + } else if (!strcmp( input, "--libs" ) ) { + printf( "%s\n", LIBS ); + shell_exit(0); + } else if (input[0] == '-') { + while ((c = *++input) != 0) { + if (f_flag) { + fprintf(stderr, "-f option must be alone in" + " command line argument\n"); + shell_exit(1); + } + + if (i_flag) { + fprintf(stderr, + "-i option must be alone in command line argument\n"); + shell_exit(1); + } else { + switch (c) { + case 'd': + debug++; + break; +#if VDEBUG != 0 + case 'v': + vdebug = 1; + break; + case 'P': + program++; + break; +#endif + case 'c': + simulate = 0; + break; + case 'f': + if (++f_nest > MAX_LEVEL) { + fprintf(stderr, "Exceeded -f nesting capacity!\n"); + shell_exit(1); + } + if (input != &input[0]) { + fprintf(stderr, "-f option must be alone in" + " command line argument\n"); + shell_exit(1); + } + f_flag++; + break; + case 's': + s_flag = 1; + break; + case 't': + trace_flag = 1; + normal_flag = 0; + break; + case 'i': + if (input != &input[0]) { + fprintf(stderr, "-i option must be alone in" + " command line argument\n"); + shell_exit(1); + } + i_flag = 1; + break; + case 'l': + l_flag = 1; + break; + case 'k': + k_flag = 1; + break; + case 'r': + case 'y': + y_flag = 1; + break; + case '?': + case 'h': + CmdlineHelp(); + shell_exit(0); + break; + default:; + } + } + } /* while */ + } else { + /* Might be one of those plus options - compare against the list */ + if (input[0] == '+') { + input++; + if (!strcmp("synopsys", input)) { + synopsys_flag = 1; + } else if (!strcmp("mindelays", input)) { + delay_type = MIN_DELAY; + } else if (!strcmp("typdelays", input)) { + delay_type = TYP_DELAY; + } else if (!strcmp("maxdelays", input)) { + delay_type = MAX_DELAY; + } else if (!strncmp("define", input, 6)) { + char *p = strtok(input, "+"); /* skip "define+" */ + for (p = strtok(NULL, "+"); p; p = strtok(NULL, "+")) { + char *b = strchr(p, '='); + if (b == NULL) { + define_macro(build_string(strlen(p), p), + NULL_TREE); + } else { + *b++ = 0; + define_macro(build_string(strlen(p), p), + build_string(strlen(b), b)); + } + } + } else if (!strcmp("noshow_var_change", input)) { + var_debug_flag = 0; + } else if (!strncmp("libext", input, 6)) { + ylibext = (char *) xmalloc(strlen(input) - 5); + strcpy(ylibext, &input[7]); /* copy from past "libext" */ + } else if (!strncmp("incdir", input, 6)) { + int len = strlen(incdir); + char *prevIncDir = incdir; + incdir = (char *) xmalloc(len + 1 + strlen(input) - 5); + strcpy(incdir, prevIncDir); /* "incdir" is cummulative */ + if (len != 0) { + strcat(incdir, "+"); + } + strcat(incdir, &input[7]); /* copy from past "incdir" */ + free(prevIncDir); + } else if (!strcmp("yydebug", input)) { + yydebug = 1; +#ifdef DUMP + } else if (!strcmp("dump", input)) { + dump_it = 1; +#endif + } else if (!strcmp("MemTrace", input)) { + MemTrace = 1; + } else { + plusargs = tree_cons((tree) input, NULL_TREE, plusargs); + } + } else { + /* Is it a source file? */ + fp = (Filelist *) xmalloc(sizeof(Filelist)); + fp->name = (char *) xmalloc(strlen(input) + 1); + strcpy(fp->name, input); + fp->next = NULL; + if (!source_last) { + source_first = fp; + } else { + source_last->next = fp; + } + source_last = fp; + } + } +} + +int moreinput(char *infile) +{ + if (fin && fin != File::Stdin()) { + fin->fclose(); + } + init_lex(); + if ((fin = File::fopen(infile, "r")) == NULL) { + printf_error_V("%s: cannot open %s\n", progname, infile); + shell_exit(1); + } + return 1; +} + +/* + This routine just prints out the command line help message +*/ + +void CmdlineHelp() +{ + printf("Usage: veriwell [options] [...]\n"); + printf(" -c Compile only - do not simulate\n"); + printf(" -s Enter interactive mode before running\n"); + printf(" -t Turn trace on\n"); + printf(" -f Read options from \n"); + printf(" -i Read commands from \n"); + printf(" -l Set log file to \n"); + printf(" -l nolog Disable log file\n"); + printf(" -k Set key file to \n"); + printf(" -k nokey Disable key file\n"); + printf(" -?, -h This message\n"); + printf + (" +synopsys Enable Synopsys HDL Compiler(tm) 2.x checking\n"); + printf(" --help This message\n"); + printf(" --version print version\n"); + printf(" --bindir Binary install path\n"); + printf(" --libdir Library install path\n"); + printf(" --includedir Include install path\n"); + printf(" --cflags Compiler flags used\n"); + printf(" --ldflags Linker flags used\n"); + printf(" --libs Libraries used\n"); + printf(" All other options are tested for arguments and ignored\n"); +} + +/* Parse the input files and generate a syntax tree */ + +void PhaseI() +{ /* compile all input */ + prog_parse(); +} + +void PhaseII() +{ + build_hierarchy(); +} + +void PhaseIII() +{ + pass3_tree(top_level); + stack_allocate(); +} + +void segv(int sign_number) +{ + fputs("Caught internal error\n", stdout); + fflush(stdout); + shell_exit(1); +} + +void breaker(int sig_number) +{ + if (!in_simulation) { + fputs("Compilation terminated by user\n", stdout); + fflush(stdout); +#if VDEBUG != 0 + if (vdebug) { + print_stats(); + } +#endif + shell_exit(1); + } else { +#if VDEBUG != 0 + if (vdebug) { + printf_V("Ctl-C detected\n"); + } +#endif + normal_flag = 0; + break_flag = 1; + shell_signal(SIGINT, breaker); + } +} + +void __main_v(int argc, char **argv) +{ /* hoc6 */ + shell_signal(SIGINT, breaker); + + globalArgc = argc; + globalArgv = argv; + srand((unsigned) time(NULL)); + progname = argv[0]; + if (argc == 1) { /* print the standard "bad command line" */ + CmdlineHelp(); + shell_exit(0); + } + init_tree(); + Cmdline(argc, argv); + + exec_(save_pc); + shell_exit(0); +} + +void print_info(void) +{ + clock_t clock_current = mclock(); + + clock_simulate = clock_current - clock_start - clock_compile - + clock_load - clock_pause; + + printf_V("%d Error", errorcount); + if (errorcount != 1) { + printf_V("%c", (int) 's'); + } + printf_V(", %d Warning", warningcount); + if (warningcount != 1) { + printf_V("%c", (int) 's'); + } + printf_V("Compile time = %.1f, Load time = %.1f," + " Simulation time = %.1f\n", + (double) clock_compile / CPS, (double) clock_load / CPS, + (double) clock_simulate / CPS); +} + +void finish() +{ + broadcast_tf(reason_finish); + printf_V("\nNormal exit\n"); + printf_V("Thank you for using %s\n", VERIWELL); + shell_exit(0); +} + +void put_out(int w, FILE * file) +{ + int ww; + ww = w << 5; + ww += rand() % 32; + ww += (rand() % 2) << 15; + putc(*((unsigned char *) &(ww)), file); + putc(*((unsigned char *) &(ww) + 1), file); +} + +unsigned long mem_avail() +{ + return (0); +} + + +void heap_test(char *msg) +{ +} + +void flush_files() +{ + if (log_enable) { + fflush(log_file); + } + if (key_enable) { + fflush(key_file); + } +} + +#if defined (DEBUG) || defined(ASSERTIONS) +void _Assert(char *strFile, unsigned uLine) +{ + fflush(stdout); + fprintf(stderr, "\nAssertion failed: %s, line %lu\n", strFile, uLine); + fflush(stderr); + shell_abort(); +} +#endif + +/*************************************************************** + * + * initverilog + * - initialize global and static variables for verilog.c + * + *************************************************************** + */ + +void init_verilog() +{ + dump_it = 0; + _ovrbuffer = 0x400; + zero_ptr = 0; /* for monitoring 0000:0000 in debugger */ + clock_pause = 0; + extra_flag = 0; + default_net_type = NET_WIRE_TYPE; + delay_type = TYP_DELAY; + errorcount = 0; + warningcount = 0; + f_first = 0; + f_last = 0; + source_first = 0; + source_last = 0; + in_simulation = 0; + dumpfile = 0; + memset(&mask_right, 0, sizeof(mask_right)); + memset(&mask_right1, 0, sizeof(mask_right1)); + clock_start = 0; + clock_compile = 0; + clock_load = 0; + clock_simulate = 0; + save_pc = NULL_TREE; + progname = 0; +#ifdef VDEBUG + yydebug = 0; +#endif + i_file = 0; + memset(&i_buf, 0, sizeof(i_buf)); +} diff --git a/src/veriwell.h b/src/veriwell.h new file mode 100644 index 0000000..01af585 --- /dev/null +++ b/src/veriwell.h @@ -0,0 +1,71 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* veriwell.h - veriwell.c routine prototypes */ + +#ifndef VERIWELL_H +#define VERIWELL_H + +// public methods + +extern int globalArgc; +extern char **globalArgv; + +void runtime_error(tree node); +void print_info(void); +void finish(void); +void flush_files(void); +void synopsys_warn(char *s); +void init(void); +int count_error(int warningp); +void fatal(char *s, char *v); +void report_error_function(char *file); +void error_with_file_and_line(char *file, lineno_t line, char *s, + char *v, char *v2); +void error(char *s, char *v, char *v2); +void warning_with_file_and_line(char *file, lineno_t line, char *s, + char *v, char *v2); +void warning(char *s, char *v, char *v2); +void sorry_with_file_and_line(char *file, lineno_t line, char *s, + char *v, char *v2); +void sorry(char *s); +void sorry1(char *s, char *v); +char *xmalloc(unsigned size); +char *xrealloc(char *ptr, int size); +int test_file(char *filename); +void Cmdline(int argc, char **argv); +void process_cmdline(char *input); +int moreinput(char *infile); +void CmdlineHelp(void); +void PhaseI(void); +void PhaseII(void); +void PhaseIII(void); +void segv(int); +void breaker(int sig_number); +void checkdate(void); +void __main_v(int argc, char **argv); +void print_info(void); +void finish(void); +void put_out(int w, FILE * file); +unsigned long mem_avail(void); +void heap_test(char *msg); +void init_verilog(void); +void _Assert(char *strFile, unsigned uLine); + +#endif // VERIWELL_H diff --git a/src/vtypes.h b/src/vtypes.h new file mode 100644 index 0000000..2b169a0 --- /dev/null +++ b/src/vtypes.h @@ -0,0 +1,197 @@ +/***************************************************************************** + * Copyright 1994-2005, Elliot Mednick and Mark Hummel + * This file is part of Veriwell. + * + * Veriwell is free software; you can 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. + * + * Veriwell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/* vtypes.h - Compiler-independent data types; common prototypes */ + +#ifndef VTYPES_H +#define VTYPES_H + +#if HAVE_CONFIG_H +# include +#endif + +#ifdef __cplusplus +# define BEGIN_C_DECLS extern "C" { +# define END_C_DECLS } +#else /* !__cplusplus */ +# define BEGIN_C_DECLS +# define END_C_DECLS +#endif + +enum logical_value { ZERO = 0, ONE = 1, Z = 2, X = 3 }; +//#define H_NBITS(X, Y) HIERARCHICAL_ATTR (node) ? TREE_NBITS (X) : TREE_NBITS (Y); +#define H_(X, Y) HIERARCHICAL_ATTR (Y) ? (X) : (Y) +#define NULL_CHAR ((char *) 0) + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +#define BADPTR ((void*)(0xff)) + +struct SCB; + +struct Time64 { + unsigned timeh; + unsigned timel; +}; + +#define ADDTIME6432(RESULT, TIME, NUM) \ + { \ + (RESULT)->timeh = ((TIME)->timel > ~(NUM)) \ + ? (TIME)->timeh + 1 : (TIME)->timeh; \ + (RESULT)->timel = (TIME)->timel + (NUM); \ + } + +#define ADDTIME6464(RESULT, TIME1, TIME2) \ + { \ + (RESULT)->timeh = ((TIME1)->timel > ~(TIME2)->timel) \ + ? (TIME1)->timeh + (TIME2)->timeh + 1 : (TIME1)->timeh + (TIME2)->timeh; \ + (RESULT)->timel = (TIME1)->timel + (TIME2)->timel; \ + } + +/* Return 0 if equal, a negative number is TIME1 < TIME2, else a positive number */ + +#define CMPTIME64(TIME1, TIME2) \ + ((TIME1)->timeh != (TIME2)->timeh \ + ? (((TIME1)->timeh < (TIME2)->timeh)?-1:1) \ + : (((TIME1)->timel < (TIME2)->timel))?-1: \ + ((TIME1)->timel != (TIME2)->timel?1:0)) + +#define ASSIGNTIME64(DEST, SRC) \ + { \ + (DEST)->timeh = (SRC)->timeh; \ + (DEST)->timel = (SRC)->timel; \ + } + + +#define max(x,y) ((x) > (y) ? (x) : (y)) +#define min(x,y) ((x) < (y) ? (x) : (y)) +#define ALIGN_32 +#define PATHSEP "/" +#define CLOCK_T + +#define VERIWELL "Veriwell" + +/* Attempt to put all machine dependent types here */ + +#define MAX_BITS_IN_NUMBER 32 +/* It takes 8 bytes to store 32 bits; in one 64k segment, there can be + 8192 groups. Take two away malloc header overhead. */ +#define MAX_GROUPS (8192L-2) +#define MAX_BITS (MAX_GROUPS*32) +#define MAX_ARRAY ((unsigned) -1) + + +typedef unsigned unsigned_32_t; +typedef signed int signed_32_t; +typedef unsigned short unsigned_16_t; +typedef signed short signed_16_t; + +/* For storing a single group; for 32-bit compilers, this should be 32 bits. */ +typedef unsigned_32_t Bit; +#define BITS_IN_GROUP (sizeof (Bit) * 8) + +/* For storing the number of bits for a datum */ +typedef signed_32_t nbits_t; + +/* For storing the number of groups for a datum */ +typedef int ngroups_t; +typedef unsigned_32_t lineno_t; +typedef unsigned_32_t delay_t; +typedef struct Time64 time64; +typedef unsigned_32_t handle_t; +typedef unsigned int array_t; + +#define SIZEOF_INTEGER sizeof (Group) + + +/* number of bits to shift nbits by to get n groups. 5 -> 32 bits, 4 -> 16 */ +//#define GROUP_SHIFT_BITS 5 +#define bits_to_groups(BITS) ((BITS==0)?0:((Bit)((BITS) - 1) >> 5)) +#define chars_to_groups(CHARS) ((Bit)((CHARS) - 1) >> 2) +#define NBITS_MASK 0x1f + +#define ABS(N) ((N) >= 0 ? (N) : -(N)) + +typedef union group { + struct { /* 0 1 z x */ + Bit aval; /* aval: 0 1 0 1 */ + Bit bval; /* bval: 0 0 1 1 */ + } bit; + double real; +} Group; + +#define NGROUPS(p) (p)->ngroups +#define GROUP(p) (p)->group +#define NBITS(p) (p)->nbits +#define D_INTEGER(p) (p)->integer +#define D_CONSTANT(p) (p)->constant + +#define AVAL(G) ((G)->bit.aval) +#define BVAL(G) ((G)->bit.bval) + +#define REAL_(G) ((G)->real) + +#define FLAGS(p) (unsigned_16_t *)(p) + + +extern Bit mask_right[]; +extern Bit mask_right1[]; + +extern void error(char *, char *, char *); +extern void warning(char *, char *, char *); +extern void sorry(char *); +extern void sorry1(char *, char *); + +union tree_node; +extern void store(union tree_node *, union tree_node *); + + + +#if defined(DEBUG) || defined(ASSERTIONS) +#ifndef ASSERT +void _Assert(char *, unsigned); /* defined in verilog.c */ + +#define ASSERT(f) \ + if (f) \ + NULL; \ + else \ + _Assert(__FILE__, __LINE__) + +#endif +#else +#ifdef ASSERT +#undef ASSERT +#endif +#define ASSERT(f) NULL +#endif + +#if defined(DEBUG) +#define DEBUGPRINT(P) printf (P) +#else +#define DEBUGPRINT(P) +#endif + +#define HEAPTEST(X) + +#endif // VTYPES_H